-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdashboard2.py
184 lines (169 loc) · 5.97 KB
/
dashboard2.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
import datetime
import logging
import os
import pwnagotchi
import pwnagotchi.plugins as plugins
import pwnagotchi.ui.fonts as fonts
from pwnagotchi.ui.components import LabeledValue
from pwnagotchi.ui.view import BLACK
class Dashboard2(plugins.Plugin):
__GitHub__ = ""
__author__ = "(edited by: itsdarklikehell [email protected]), doki"
__version__ = "1.0.0"
__license__ = "GPL3"
__description__ = "Dashboard2 plugin is a consolidation of the clock, deauth counter, memtemp, pivoyager and added few features such as cracked handshake counter and internet status."
__name__ = "Dashboard2"
__help__ = "Dashboard2 plugin is a consolidation of the clock, deauth counter, memtemp, pivoyager and added few features such as cracked handshake counter and internet status."
__dependencies__ = {"pip": ["scapy"]}
__defaults__ = {
"enabled": False,
}
# Initiate deauthcounter plugin
def __init__(self):
self.deauth_counter = 0
self.handshake_counter = 0
logging.debug(f"[{self.__class__.__name__}] plugin init")
def on_loaded(self):
# Initiate clock plugin
if "date_format" in self.options:
self.date_format = self.options["date_format"]
else:
self.date_format = "%m/%d/%y"
logging.info(f"[{self.__class__.__name__}] plugin loaded")
def mem_usage(self):
return int(pwnagotchi.mem_usage() * 100)
def cpu_load(self):
return int(pwnagotchi.cpu_load() * 100)
def cpu_temp(self):
return int(pwnagotchi.temperature())
def on_ui_setup(self, ui):
ui.add_element(
"clock",
LabeledValue(
color=BLACK,
label="",
value="-/-/--:--",
position=(
int(self.options["clock_x_pos"]),
int(self.options["clock_y_pos"]),
),
label_font=fonts.Small,
text_font=fonts.Small,
),
)
ui.add_element(
"ram",
LabeledValue(
color=BLACK,
label="",
value="mem",
position=(
int(self.options["mem_x_pos"]),
int(self.options["mem_y_pos"]),
),
label_font=fonts.Small,
text_font=fonts.Bold,
),
)
ui.add_element(
"cpu",
LabeledValue(
color=BLACK,
label="",
value="cpu",
position=(
int(self.options["cpu_x_pos"]),
int(self.options["cpu_y_pos"]),
),
label_font=fonts.Small,
text_font=fonts.Bold,
),
)
ui.add_element(
"tmp",
LabeledValue(
color=BLACK,
label="",
value="tmp",
position=(
int(self.options["tmp_x_pos"]),
int(self.options["tmp_y_pos"]),
),
label_font=fonts.Small,
text_font=fonts.Bold,
),
)
ui.add_element(
"deauth",
LabeledValue(
color=BLACK,
label="",
value=str(self.deauth_counter),
position=(
int(self.options["deauth_x_pos"]),
int(self.options["deauth_y_pos"]),
),
label_font=fonts.Bold,
text_font=fonts.Bold,
),
)
ui.add_element(
"hand",
LabeledValue(
color=BLACK,
label="",
value=str(self.handshake_counter),
position=(
int(self.options["hand_x_pos"]),
int(self.options["hand_y_pos"]),
),
label_font=fonts.Bold,
text_font=fonts.Bold,
),
)
ui.add_element(
"cracked",
LabeledValue(
color=BLACK,
label="",
value="",
position=(
int(self.options["cracked_x_pos"]),
int(self.options["cracked_y_pos"]),
),
label_font=fonts.Bold,
text_font=fonts.Bold,
),
)
def on_unload(self, ui):
with ui._lock:
try:
ui.remove_element("clock")
ui.remove_element("ram")
ui.remove_element("cpu")
ui.remove_element("tmp")
ui.remove_element("deauth")
ui.remove_element("hand")
ui.remove_element("cracked")
logging.info(f"[{self.__class__.__name__}] plugin unloaded")
except Exception as e:
logging.error(f"[{self.__class__.__name__}] unload: %s" % e)
def on_ui_update(self, ui):
now = datetime.datetime.now()
time_rn = now.strftime(self.date_format + " %I:%M%p")
status = self.get_status()
total_cracked = "uniq -i /root/handshakes/wpa-sec.cracked.potfile | wc -l"
ui.set("clock", time_rn)
ui.set("cracked", "%s" % (os.popen(total_cracked).read().rstrip()))
ui.set("ram", str(self.mem_usage()) + "%")
ui.set("cpu", str(self.cpu_load()) + "%")
ui.set("tmp", str(self.cpu_temp()) + "°C")
ui.set("deauth", str(self.deauth_counter))
ui.set("hand", str(self.handshake_counter))
# called when the agent is deauthenticating a client station from an AP
def on_deauthentication(self, agent, access_point, client_station):
self.deauth_counter += 1
def on_handshake(self, agent, filename, access_point, client_station):
self.handshake_counter += 1
def on_webhook(self, path, request):
logging.info(f"[{self.__class__.__name__}] webhook pressed")