Bug Fix on AircrackOnly.py plugin

The code will always delete the pcap file unless there is a PMKID due to the structure of the if statements. Added a new variable handshakeFound that will allow the file not to be deleted if there is a handshake and also it will scan for PMKID only if no handshake is found... If no handshake is found and no PMKID, only then the file is marked as to be deleted
This commit is contained in:
FrixosTh
2019-11-03 02:31:13 +02:00
committed by GitHub
parent ace61836e5
commit b4b14ba9fd

@ -27,16 +27,16 @@ class AircrackOnly(plugins.Plugin):
def on_handshake(self, agent, filename, access_point, client_station): def on_handshake(self, agent, filename, access_point, client_station):
display = agent._view display = agent._view
todelete = 0 todelete = 0
handshakeFound = 0
result = subprocess.run(('/usr/bin/aircrack-ng ' + filename + ' | grep "1 handshake" | awk \'{print $2}\''), result = subprocess.run(('/usr/bin/aircrack-ng ' + filename + ' | grep "1 handshake" | awk \'{print $2}\''),
shell=True, stdout=subprocess.PIPE) shell=True, stdout=subprocess.PIPE)
result = result.stdout.decode('utf-8').translate({ord(c): None for c in string.whitespace}) result = result.stdout.decode('utf-8').translate({ord(c): None for c in string.whitespace})
if result: if result:
handshakeFound = 1
logging.info("[AircrackOnly] contains handshake") logging.info("[AircrackOnly] contains handshake")
else:
todelete = 1
if todelete == 0: if handshakeFound == 0:
result = subprocess.run(('/usr/bin/aircrack-ng ' + filename + ' | grep "PMKID" | awk \'{print $2}\''), result = subprocess.run(('/usr/bin/aircrack-ng ' + filename + ' | grep "PMKID" | awk \'{print $2}\''),
shell=True, stdout=subprocess.PIPE) shell=True, stdout=subprocess.PIPE)
result = result.stdout.decode('utf-8').translate({ord(c): None for c in string.whitespace}) result = result.stdout.decode('utf-8').translate({ord(c): None for c in string.whitespace})