diff --git a/bin/pwnagotchi b/bin/pwnagotchi index 15adb05a..e09024e1 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -50,6 +50,7 @@ def pwnagotchi_cli(): agent.mode = 'auto' agent.start() + config = agent.config() while True: try: @@ -66,6 +67,9 @@ def pwnagotchi_cli(): # for each ap on this channel for ap in aps: + if ap['mac'][:13].lower in config['main']['whitelist'] or ap['hostname'] in config['main']['whitelist']: + logging.info(f"Found your MAC address {ap['mac']} - {config['main']['whitelist']}") + continue # send an association frame in order to get for a PMKID agent.associate(ap) # deauth all client stations in order to get a full handshake diff --git a/builder/raspberrypi64.yml b/builder/raspberrypi64.yml index 2942222d..1cd5cbd3 100644 --- a/builder/raspberrypi64.yml +++ b/builder/raspberrypi64.yml @@ -52,13 +52,20 @@ - libpcap0.8-dev_1.9.1-4_arm64.deb - libpcap0.8_1.9.1-4_arm64.deb hold: + - firmware-atheros + - firmware-brcm80211 + - firmware-libertas + - firmware-misc-nonfree + - firmware-realtek - libpcap-dev - libpcap0.8 - - libpcap0.8-dev - libpcap0.8-dbg + - libpcap0.8-dev remove: - avahi-daemon - dhpys-swapfile + - libcurl-ocaml-dev + - libssl-ocaml-dev - nfs-common - triggerhappy - wpasupplicant @@ -91,6 +98,8 @@ - libc-ares-dev - libc6-dev - libcap-dev + - libcurl-ocaml-dev + - libssl-ocaml-dev - libdbus-1-dev - libdbus-glib-1-dev - libeigen3-dev @@ -164,7 +173,7 @@ ARCHFLAGS: "-arch aarch64" tasks: - # First we install and remove unnecessary packages + # First we install packages - name: install packages apt: name: "{{ packages.apt.install }}" @@ -172,13 +181,6 @@ update_cache: yes install_recommends: false - - name: remove unnecessary apt packages - apt: - name: "{{ packages.apt.remove }}" - state: absent - purge: yes - register: removed - # Now we set up /boot/firmware - name: Create pi user copy: @@ -272,6 +274,24 @@ dest: /usr/local/lib/libpcap.so.0.8 state: link + # install latest hcxtools + + - name: clone hcxtools + git: + repo: https://github.com/ZerBea/hcxtools.git + dest: /usr/local/src/hcxtools + + - name: install hcxtools + shell: "make && make install" + args: + executable: /bin/bash + chdir: /usr/local/src/hcxtools + + - name: remove hcxtools directory + file: + state: absent + path: /usr/local/src/hcxtools + # Install nexmon to fix wireless scanning (takes 2.5G of space) - name: clone nexmon repository git: @@ -627,6 +647,14 @@ args: executable: /bin/bash + # Now we remove packages + - name: remove unnecessary apt packages + apt: + name: "{{ packages.apt.remove }}" + state: absent + purge: yes + register: removed + handlers: - name: reload systemd services systemd: diff --git a/pwnagotchi/agent.py b/pwnagotchi/agent.py index af9227c4..00d4f964 100644 --- a/pwnagotchi/agent.py +++ b/pwnagotchi/agent.py @@ -31,7 +31,6 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer): AsyncTrainer.__init__(self, config) self._started_at = time.time() - self._filter = None if not config['main']['filter'] else re.compile(config['main']['filter']) self._current_channel = 0 self._tot_aps = 0 self._aps_on_channel = 0 @@ -164,11 +163,6 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer): self.wait_for(recon_time, sleeping=False) - def _filter_included(self, ap): - return self._filter is None or \ - self._filter.match(ap['hostname']) is not None or \ - self._filter.match(ap['mac']) is not None - def set_access_points(self, aps): self._access_points = aps plugins.on('wifi_update', self, aps) @@ -184,13 +178,10 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer): for ap in s['wifi']['aps']: if ap['encryption'] == '' or ap['encryption'] == 'OPEN': continue - elif ap['hostname'] in whitelist or ap['mac'][:8].lower() in whitelist: + elif ap['hostname'] in whitelist or ap['mac'][:13].lower() in whitelist or ap['mac'].lower() in whitelist: continue - elif ap['hostname'] 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) + else: + aps.append(ap) except Exception as e: logging.exception("Error while getting access points (%s)", e) @@ -371,8 +362,7 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer): plugins.on('handshake', self, filename, ap_mac, sta_mac) else: (ap, sta) = ap_and_station - self._last_pwnd = ap['hostname'] if ap['hostname'] != '' and ap[ - 'hostname'] != '' else ap_mac + self._last_pwnd = ap['hostname'] if ap['hostname'] != '' and ap['hostname'] != '' 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']) @@ -433,7 +423,6 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer): if self.is_stale(): logging.debug("recon is stale, skipping assoc(%s)", ap['mac']) return - if throttle == -1 and "throttle_a" in self._config['personality']: throttle = self._config['personality']['throttle_a']