mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
fix: handling corrupted log lines (fixes #321)
This commit is contained in:
@ -2,6 +2,7 @@ import hashlib
|
|||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from pwnagotchi.voice import Voice
|
from pwnagotchi.voice import Voice
|
||||||
@ -87,6 +88,8 @@ class LastSession(object):
|
|||||||
parts = line.split(']')
|
parts = line.split(']')
|
||||||
if len(parts) < 2:
|
if len(parts) < 2:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
line_timestamp = parts[0].strip('[')
|
line_timestamp = parts[0].strip('[')
|
||||||
line = ']'.join(parts[1:])
|
line = ']'.join(parts[1:])
|
||||||
stopped_at = self._parse_datetime(line_timestamp)
|
stopped_at = self._parse_datetime(line_timestamp)
|
||||||
@ -142,6 +145,8 @@ class LastSession(object):
|
|||||||
cache[pubkey] = self.last_peer
|
cache[pubkey] = self.last_peer
|
||||||
else:
|
else:
|
||||||
cache[pubkey].adv['pwnd_tot'] = pwnd_tot
|
cache[pubkey].adv['pwnd_tot'] = pwnd_tot
|
||||||
|
except Exception as e:
|
||||||
|
logging.error("error parsing line '%s': %s" % (line, e))
|
||||||
|
|
||||||
if started_at is not None:
|
if started_at is not None:
|
||||||
self.duration = stopped_at - started_at
|
self.duration = stopped_at - started_at
|
||||||
|
Reference in New Issue
Block a user