mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
fix: fixed a LastSession bug which prevented the grid plugin from working when no previous session was available (fixes #228)
This commit is contained in:
@ -22,6 +22,29 @@ class LastSession(object):
|
|||||||
HANDSHAKE_TOKEN = '!!! captured new handshake '
|
HANDSHAKE_TOKEN = '!!! captured new handshake '
|
||||||
PEER_TOKEN = 'detected unit '
|
PEER_TOKEN = 'detected unit '
|
||||||
|
|
||||||
|
def __init__(self, config):
|
||||||
|
self.config = config
|
||||||
|
self.voice = Voice(lang=config['main']['lang'])
|
||||||
|
self.path = config['main']['log']
|
||||||
|
self.last_session = []
|
||||||
|
self.last_session_id = ''
|
||||||
|
self.last_saved_session_id = ''
|
||||||
|
self.duration = ''
|
||||||
|
self.duration_human = ''
|
||||||
|
self.deauthed = 0
|
||||||
|
self.associated = 0
|
||||||
|
self.handshakes = 0
|
||||||
|
self.peers = 0
|
||||||
|
self.last_peer = None
|
||||||
|
self.epochs = 0
|
||||||
|
self.train_epochs = 0
|
||||||
|
self.min_reward = 1000
|
||||||
|
self.max_reward = -1000
|
||||||
|
self.avg_reward = 0
|
||||||
|
self._peer_parser = re.compile(
|
||||||
|
'detected unit (.+)@(.+) \(v.+\) on channel \d+ \(([\d\-]+) dBm\) \[sid:(.+) pwnd_tot:(\d+) uptime:(\d+)\]')
|
||||||
|
self.parsed = False
|
||||||
|
|
||||||
def _get_last_saved_session_id(self):
|
def _get_last_saved_session_id(self):
|
||||||
saved = ''
|
saved = ''
|
||||||
try:
|
try:
|
||||||
@ -158,26 +181,5 @@ class LastSession(object):
|
|||||||
self._parse_stats()
|
self._parse_stats()
|
||||||
self.parsed = True
|
self.parsed = True
|
||||||
|
|
||||||
def __init__(self, config):
|
|
||||||
self.config = config
|
|
||||||
self.voice = Voice(lang=config['main']['lang'])
|
|
||||||
self.path = config['main']['log']
|
|
||||||
self.last_session = None
|
|
||||||
self.last_session_id = ''
|
|
||||||
self.last_saved_session_id = ''
|
|
||||||
self.duration = ''
|
|
||||||
self.duration_human = ''
|
|
||||||
self.deauthed = 0
|
|
||||||
self.associated = 0
|
|
||||||
self.handshakes = 0
|
|
||||||
self.peers = 0
|
|
||||||
self.last_peer = None
|
|
||||||
self._peer_parser = re.compile(
|
|
||||||
'detected unit (.+)@(.+) \(v.+\) on channel \d+ \(([\d\-]+) dBm\) \[sid:(.+) pwnd_tot:(\d+) uptime:(\d+)\]')
|
|
||||||
self.last_session = []
|
|
||||||
self.last_session_id = None
|
|
||||||
self.last_saved_session_id = None
|
|
||||||
self.parsed = False
|
|
||||||
|
|
||||||
def is_new(self):
|
def is_new(self):
|
||||||
return self.last_session_id != self.last_saved_session_id
|
return self.last_session_id != self.last_saved_session_id
|
||||||
|
Reference in New Issue
Block a user