-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcounter.py
88 lines (76 loc) · 2.72 KB
/
counter.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
import logging
import os
from time import sleep
import pwnagotchi
from pwnagotchi import plugins
import pwnagotchi.agent
import pwnagotchi.plugins as plugins
import pwnagotchi.ui.fonts as fonts
from pwnagotchi.ui.components import LabeledValue
from pwnagotchi.ui.view import BLACK
class Counter(plugins.Plugin):
__GitHub__ = ""
__author__ = "(edited by: itsdarklikehell [email protected]), [email protected] (made the plugin this is based on) + Terminator"
__version__ = "1.0.0"
__license__ = "GPL3"
__description__ = (
"This will add some UI stuff to your Pwnagotchi to count assocs and deauths!"
)
__name__ = "Counter"
__help__ = (
"This will add some UI stuff to your Pwnagotchi to count assocs and deauths!"
)
__dependencies__ = {
"apt": ["none"],
"pip": ["scapy"],
}
__defaults__ = {
"enabled": False,
}
def __init__(self):
self.options = dict()
self.running = False
self.deauth_counter = 0
self.assoc_counter = 0
logging.debug(f"[{self.__class__.__name__}] plugin init")
def on_loaded(self):
logging.info(f"[{self.__class__.__name__}] plugin loaded")
self.running = True
def on_unload(self, ui):
self.running = False
logging.info(f"[{self.__class__.__name__}] plugin unloaded")
def on_ui_setup(self, ui):
ui.add_element(
"deauth",
LabeledValue(
color=BLACK,
label="Deauths: ",
value=str(self.deauth_counter),
position=(ui.width() / 2, ui.height() - 46),
label_font=fonts.Bold,
text_font=fonts.Medium,
),
)
ui.add_element(
"assocs",
LabeledValue(
color=BLACK,
label="Associations: ",
value=str(self.assoc_counter),
position=(ui.width() / 2, ui.height() - 26),
label_font=fonts.Bold,
text_font=fonts.Medium,
),
)
def on_ready(self, agent):
logging.info(f"[{self.__class__.__name__}] plugin ready")
self.agent = agent
def on_ui_update(self, ui):
ui.set("deauth", str(self.deauth_counter))
ui.set("assocs", str(self.assoc_counter))
def on_deauthentication(self, agent, access_point, client_station):
self.deauth_counter += 1
def on_association(self, agent, access_point):
self.assoc_counter += 1
def on_webhook(self, path, request):
logging.info(f"[{self.__class__.__name__}] webhook pressed")