fix: --clear does not start the agent anymore

This commit is contained in:
Simone Margaritelli
2019-11-15 12:27:53 +01:00
parent a96dead519
commit 87e46610f9
2 changed files with 107 additions and 93 deletions

View File

@ -49,6 +49,10 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
if not os.path.exists(config['bettercap']['handshakes']):
os.makedirs(config['bettercap']['handshakes'])
logging.info("%s@%s (v%s)" % (pwnagotchi.name(), self.fingerprint(), pwnagotchi.version))
for _, plugin in plugins.loaded.items():
logging.debug("plugin '%s' v%s" % (plugin.__class__.__name__, plugin.__version__))
def config(self):
return self._config
@ -179,8 +183,8 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
if ap['encryption'] == '' or ap['encryption'] == 'OPEN':
continue
elif ap['hostname'] not in whitelist \
and ap['mac'].lower() not in whitelist \
and ap['mac'][:8].lower() not in whitelist:
and ap['mac'].lower() not in whitelist \
and ap['mac'][:8].lower() not in whitelist:
if self._filter_included(ap):
aps.append(ap)
except Exception as e:
@ -337,11 +341,12 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
(ap, sta) = ap_and_station
self._last_pwnd = ap['hostname'] if ap['hostname'] != '' and ap[
'hostname'] != '<hidden>' else ap_mac
logging.warning("!!! captured new handshake on channel %d, %d dBm: %s (%s) -> %s [%s (%s)] !!!" % ( \ ))
ap['channel'],
ap['rssi'],
sta['mac'], sta['vendor'],
ap['hostname'], ap['mac'], ap['vendor']))
logging.warning(
"!!! captured new handshake on channel %d, %d dBm: %s (%s) -> %s [%s (%s)] !!!" % (
ap['channel'],
ap['rssi'],
sta['mac'], sta['vendor'],
ap['hostname'], ap['mac'], ap['vendor']))
plugins.on('handshake', self, filename, ap, sta)
except Exception as e:
@ -394,7 +399,7 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
self._view.on_assoc(ap)
try:
logging.info("sending association frame to %s (%s %s) on channel %d [%d clients], %d dBm..." % ( \
logging.info("sending association frame to %s (%s %s) on channel %d [%d clients], %d dBm..." % ( \
ap['hostname'], ap['mac'], ap['vendor'], ap['channel'], len(ap['clients']), ap['rssi']))
self.run('wifi.assoc %s' % ap['mac'])
self._epoch.track(assoc=True)
@ -415,8 +420,8 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
self._view.on_deauth(sta)
try:
logging.info("deauthing %s (%s) from %s (%s %s) on channel %d, %d dBm ..." % (
sta['mac'], sta['vendor'], ap['hostname'], ap['mac'], ap['vendor'], ap['channel'], ap['rssi']))
logging.info("deauthing %s (%s) from %s (%s %s) on channel %d, %d dBm ..." % (
sta['mac'], sta['vendor'], ap['hostname'], ap['mac'], ap['vendor'], ap['channel'], ap['rssi']))
self.run('wifi.deauth %s' % sta['mac'])
self._epoch.track(deauth=True)
except Exception as e: