From 32de654b74dfff563681d47bf930474c586dc662 Mon Sep 17 00:00:00 2001 From: Mathy Vanhoef Date: Sat, 30 Jan 2021 06:52:45 +0400 Subject: [PATCH] fragattack: detect unexpected scapy version --- .gitignore | 3 +++ research/fragattack.py | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b064303ce..12b2f28c5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ wpaspy/build **/parallel-vm.log tags build/ +*.d +*.o +venv/ diff --git a/research/fragattack.py b/research/fragattack.py index 773f3054f..98f9731a1 100755 --- a/research/fragattack.py +++ b/research/fragattack.py @@ -164,7 +164,15 @@ def args2msdu(args): return None +def get_expected_scapy_ver(): + for line in open("requirements.txt"): + if line.startswith("scapy=="): + return line[7:].strip() + return None + if __name__ == "__main__": + log(STATUS, f"This is fragattack version {FRAGVERSION}.") + parser = argparse.ArgumentParser(description=f"Test for fragmentation vulnerabilities (version {FRAGVERSION}).") parser.add_argument('iface', help="Interface to use for the tests.") parser.add_argument('testname', help="Name or identifier of the test to run.") @@ -207,6 +215,12 @@ if __name__ == "__main__": parser.add_argument('--stay-up', default=False, action='store_true', help="Don't quit when test has finished.") options = parser.parse_args() + # Check if we're using the expected scapy version + expected_ver = get_expected_scapy_ver() + if expected_ver!= None and scapy.VERSION != expected_ver: + log(WARNING, f"You are using scapy version {scapy.VERSION} instead of the expected {expected_ver}") + log(WARNING, "Are you executing the script from inside the correct python virtual environment?") + # Default value for options that should not be command line parameters options.inject_mf_workaround = False @@ -241,7 +255,6 @@ if __name__ == "__main__": change_log_level(-options.debug) # Now start the tests --- TODO: Inject Deauths before connecting with client... - log(STATUS, f"This is fragattack version {FRAGVERSION}.") if options.ap: daemon = Authenticator(options) else: