From ca4bc879ddbe928592e3dd4a5b1144dea4a30f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= Date: Tue, 25 Feb 2020 12:45:59 +0100 Subject: [PATCH] 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. --- wifite/config.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/wifite/config.py b/wifite/config.py index e6a42d3d3..cc930b960 100755 --- a/wifite/config.py +++ b/wifite/config.py @@ -117,12 +117,16 @@ def initialize(cls, load_interface=True): manufacturers = './ieee-oui.txt' if os.path.exists(manufacturers): + cls.manufacturers = {} with open(manufacturers, "r") as f: # Parse txt format into dict - lines = f.read().splitlines() - k = lambda line: line.split()[0] - v = lambda line: ' '.join(line.split()[1:3]).rstrip('.') - cls.manufacturers = {k(line):v(line) for line in lines} + for line in f: + if not re.match(r"^\w", line): + continue + line = line.replace('(hex)', '').replace('(base 16)', '') + fields = line.split() + if len(fields) >= 2: + cls.manufacturers[fields[0]] = " ".join(fields[1:]).rstrip('.') # WPS variables cls.wps_filter = False # Only attack WPS networks