Skip to content

Commit ca4bc87

Browse files
committed
Handle different structure in /usr/share/ieee-data/oui.txt
That file has multi-line entries like those: 24-05-F5 (hex) Integrated Device Technology (Malaysia) Sdn. Bhd. 2405F5 (base 16) Integrated Device Technology (Malaysia) Sdn. Bhd. Phase 3, Bayan Lepas FIZ Bayan Lepas Penang 11900 MY Thus we skip lines starting with spaces and we drop the parenthesis to get back to the plain text format of ieee-oui.txt.
1 parent 327457a commit ca4bc87

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

wifite/config.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,16 @@ def initialize(cls, load_interface=True):
117117
manufacturers = './ieee-oui.txt'
118118

119119
if os.path.exists(manufacturers):
120+
cls.manufacturers = {}
120121
with open(manufacturers, "r") as f:
121122
# Parse txt format into dict
122-
lines = f.read().splitlines()
123-
k = lambda line: line.split()[0]
124-
v = lambda line: ' '.join(line.split()[1:3]).rstrip('.')
125-
cls.manufacturers = {k(line):v(line) for line in lines}
123+
for line in f:
124+
if not re.match(r"^\w", line):
125+
continue
126+
line = line.replace('(hex)', '').replace('(base 16)', '')
127+
fields = line.split()
128+
if len(fields) >= 2:
129+
cls.manufacturers[fields[0]] = " ".join(fields[1:]).rstrip('.')
126130

127131
# WPS variables
128132
cls.wps_filter = False # Only attack WPS networks

0 commit comments

Comments
 (0)