1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/usr/bin/env python
# creates database based on info from the ndiswrapper wiki
import urllib2
import sys
def get_lists():
'''
returns a list containing all the urls to lists on the ndiswrapper wiki
'''
front = urllib2.urlopen('http://ndiswrapper.sourceforge.net/joomla/index.php?/component/option,com_openwiki/Itemid,33/id,list/')
front = front.read()
front = front.split('<li class="level1"><div class="li"> <a href="')
lists = []
for i in front:
if 'wikilink' in i:
lists.append(i.split('" class="wikilink1"')[0])
return lists
def getdatabase():
'''
returns a dictionary containing the databse
'''
dbase = {}
for url in get_lists():
site = urllib2.urlopen(url)
site = site.read()
site = site.split('<li class="level1"><div class="li"> ')
for i in site:
if 'pciid' in i:
pciid = ''
d = {}
i = i.split('</div>')
for j in i:
if 'pciid' in j:
pciid = j.split('pciid: ')[-1].strip()[:9]
if 'Card' in j:
d['name'] = j.split('Card: ')[-1]
if 'Chipset: ' in j:
d['chipset'] = j.split('Chipset: ')[-1]
if 'Other: ' in j:
d['other'] = j.split('Other: ')[-1]
if 'Driver: ' in j:
d['driver'] = j.split('<a href="')[-1].split('" class="urlextern"')[0]
if pciid != '' :
dbase[pciid] = d
return dbase
if __name__ == '__main__':
print getdatabase()
|