-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathaircrackonly_ng.py
108 lines (94 loc) · 3.23 KB
/
aircrackonly_ng.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import pwnagotchi.plugins as plugins
import logging
import subprocess
import string
import os
"""
Aircrack-ng needed, to install:
> apt-get install aircrack-ng
"""
class AircrackOnly_ng(plugins.Plugin):
__GitHub__ = ""
__author__ = "(edited by: itsdarklikehell [email protected]), pwnagotchi [at] rossmarks [dot] uk"
__version__ = "1.0.1"
__license__ = "GPL3"
__description__ = "confirm pcap contains handshake/PMKID or delete it"
__name__ = "AircrackOnly_ng"
__help__ = "confirm pcap contains handshake/PMKID or delete it"
__dependencies__ = {
"apt": ["none"],
"pip": ["scapy"],
}
__defaults__ = {
"enabled": False,
}
def __init__(self):
logging.debug(f"[{self.__class__.__name__}] plugin init")
self.text_to_set = ""
self.options = dict()
def on_ready(self):
return
def on_loaded(self):
logging.info(f"[{self.__class__.__name__}] plugin loaded")
if "face" not in self.options:
self.options["face"] = "(>.<)"
check = subprocess.run(
"/usr/bin/dpkg -l aircrack-ng | grep aircrack-ng | awk '{print $2, $3}'",
shell=True,
stdout=subprocess.PIPE,
)
check = check.stdout.decode("utf-8").strip()
if check != "aircrack-ng <none>":
logging.info(f"[{self.__class__.__name__}] Found " + check)
else:
logging.warning(
f"[{self.__class__.__name__}] aircrack-ng is not installed!"
)
def on_handshake(self, agent, filename, access_point, client_station):
display = agent.view()
to_delete = 0
handshake_found = 0
result = subprocess.run(
(
"/usr/bin/aircrack-ng "
+ filename
+ " | grep \"1 handshake\" | awk '{print $2}'"
),
shell=True,
stdout=subprocess.PIPE,
)
result = result.stdout.decode("utf-8").translate(
{ord(c): None for c in string.whitespace}
)
if result:
handshake_found = 1
logging.info(f"[{self.__class__.__name__}] contains handshake")
if handshake_found == 0:
result = subprocess.run(
(
"/usr/bin/aircrack-ng "
+ filename
+ " | grep \"PMKID\" | awk '{print $2}'"
),
shell=True,
stdout=subprocess.PIPE,
)
result = result.stdout.decode("utf-8").translate(
{ord(c): None for c in string.whitespace}
)
if result:
logging.info(f"[{self.__class__.__name__}] contains PMKID")
else:
to_delete = 1
if to_delete == 1:
os.remove(filename)
self.text_to_set = "Removed an uncrackable pcap"
logging.warning(
f"[{self.__class__.__name__}] Removed uncrackable pcap " + filename
)
display.update(force=True)
def on_ui_update(self, ui):
if self.text_to_set:
ui.set("face", self.options["face"])
ui.set("status", self.text_to_set)
self.text_to_set = ""