fix: fixed grid plugin exclusion list use
This commit is contained in:
parent
e6777eba8a
commit
be75fc53d4
@ -132,13 +132,26 @@ def api_report_ap(last_session, keys, token, essid, bssid):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def is_excluded(what):
|
||||||
|
for skip in OPTIONS['exclude']:
|
||||||
|
skip = skip.lower()
|
||||||
|
what = what.lower()
|
||||||
|
if skip in what or skip.replace(':', ':') in what:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def on_internet_available(agent):
|
def on_internet_available(agent):
|
||||||
global REPORT
|
global REPORT
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
logging.debug("internet available")
|
||||||
|
|
||||||
config = agent.config()
|
config = agent.config()
|
||||||
keys = agent.keypair()
|
keys = agent.keypair()
|
||||||
|
|
||||||
|
logging.debug("checking pcaps")
|
||||||
|
|
||||||
pcap_files = glob.glob(os.path.join(config['bettercap']['handshakes'], "*.pcap"))
|
pcap_files = glob.glob(os.path.join(config['bettercap']['handshakes'], "*.pcap"))
|
||||||
num_networks = len(pcap_files)
|
num_networks = len(pcap_files)
|
||||||
reported = REPORT.data_field_or('reported', default=[])
|
reported = REPORT.data_field_or('reported', default=[])
|
||||||
@ -149,23 +162,24 @@ def on_internet_available(agent):
|
|||||||
if num_new > 0:
|
if num_new > 0:
|
||||||
if OPTIONS['report']:
|
if OPTIONS['report']:
|
||||||
logging.info("grid: %d new networks to report" % num_new)
|
logging.info("grid: %d new networks to report" % num_new)
|
||||||
|
logging.debug("OPTIONS: %s" % OPTIONS)
|
||||||
|
logging.debug(" exclude: %s" % OPTIONS['exclude'])
|
||||||
|
|
||||||
for pcap_file in pcap_files:
|
for pcap_file in pcap_files:
|
||||||
net_id = os.path.basename(pcap_file).replace('.pcap', '')
|
net_id = os.path.basename(pcap_file).replace('.pcap', '')
|
||||||
do_skip = False
|
if net_id not in reported:
|
||||||
for skip in OPTIONS['exclude']:
|
if is_excluded(net_id):
|
||||||
skip = skip.lower()
|
logging.info("skipping %s due to exclusion filter" % pcap_file)
|
||||||
net = net_id.lower()
|
continue
|
||||||
if skip in net or skip.replace(':', '') in net:
|
|
||||||
do_skip = True
|
|
||||||
break
|
|
||||||
|
|
||||||
if net_id not in reported and not do_skip:
|
|
||||||
essid, bssid = parse_pcap(pcap_file)
|
essid, bssid = parse_pcap(pcap_file)
|
||||||
if bssid:
|
if bssid:
|
||||||
if api_report_ap(agent.last_session, keys, token, essid, bssid):
|
if is_excluded(essid) or is_excluded(bssid):
|
||||||
reported.append(net_id)
|
logging.debug("not reporting %s due to exclusion filter" % pcap_file)
|
||||||
REPORT.update(data={'reported': reported})
|
|
||||||
|
elif api_report_ap(agent.last_session, keys, token, essid, bssid):
|
||||||
|
reported.append(net_id)
|
||||||
|
REPORT.update(data={'reported': reported})
|
||||||
else:
|
else:
|
||||||
logging.debug("grid: reporting disabled")
|
logging.debug("grid: reporting disabled")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user