fragattack: detect unexpected scapy version

This commit is contained in:
Mathy Vanhoef 2021-01-30 06:52:45 +04:00
parent 7eb3596f07
commit 32de654b74
2 changed files with 17 additions and 1 deletions

3
.gitignore vendored
View File

@ -6,3 +6,6 @@ wpaspy/build
**/parallel-vm.log **/parallel-vm.log
tags tags
build/ build/
*.d
*.o
venv/

View File

@ -164,7 +164,15 @@ def args2msdu(args):
return None 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__": if __name__ == "__main__":
log(STATUS, f"This is fragattack version {FRAGVERSION}.")
parser = argparse.ArgumentParser(description=f"Test for fragmentation vulnerabilities (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('iface', help="Interface to use for the tests.")
parser.add_argument('testname', help="Name or identifier of the test to run.") 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.") parser.add_argument('--stay-up', default=False, action='store_true', help="Don't quit when test has finished.")
options = parser.parse_args() 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 # Default value for options that should not be command line parameters
options.inject_mf_workaround = False options.inject_mf_workaround = False
@ -241,7 +255,6 @@ if __name__ == "__main__":
change_log_level(-options.debug) change_log_level(-options.debug)
# Now start the tests --- TODO: Inject Deauths before connecting with client... # Now start the tests --- TODO: Inject Deauths before connecting with client...
log(STATUS, f"This is fragattack version {FRAGVERSION}.")
if options.ap: if options.ap:
daemon = Authenticator(options) daemon = Authenticator(options)
else: else: