Merge pull request #472 from neutralinsomniac/grid_handle_malformed_filenames

fix: don't attempt to parse/upload pcaps with malformed filenames
This commit is contained in:
evilsocket 2019-10-31 14:17:00 +01:00 committed by GitHub
commit f03e07f0cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ import os
import logging
import time
import glob
import re
import pwnagotchi.grid as grid
from pwnagotchi.utils import StatusFile, WifiInfo, extract_from_pcap
@ -36,6 +37,10 @@ def parse_pcap(filename):
# /root/handshakes/BSSID.pcap
essid, bssid = '', net_id
mac_re = re.compile('[0-9a-fA-F]{12}')
if not mac_re.match(bssid):
return '', ''
it = iter(bssid)
bssid = ':'.join([a + b for a, b in zip(it, it)])