Commit Graph
4044 Commits
Author SHA1 Message Date
JayofelonyandGitHub 3d7894cb4c Merge pull request #517 from CoderFX/fix/fix-services-typo
fix(fix_services): fix "interfaceface" typo in log message
2026-03-11 07:19:15 +01:00
JayofelonyandGitHub f10c01f2ab Merge pull request #513 from CoderFX/feature/pisugarx-implement-stubs
feat(pisugarx): implement all 17 stub methods for PiSugar3
2026-03-11 07:19:01 +01:00
JayofelonyandGitHub 1b676ef707 Merge pull request #512 from CoderFX/fix/pisugarx-i2c-robustness
fix(pisugarx): improve I2C thread safety, error recovery, and write protection
2026-03-11 07:18:42 +01:00
JayofelonyandGitHub 92c5526cca Merge pull request #510 from CoderFX/fix/pisugarx-double-voltage
fix(pisugarx): prevent double voltage append with charge protection
2026-03-11 07:18:25 +01:00
JayofelonyandGitHub 5367acecad Merge pull request #508 from CoderFX/fix/pisugarx-null-safety
fix(pisugarx): guard against None self.ps in on_loaded and on_ui_update
2026-03-11 07:17:38 +01:00
JayofelonyandGitHub 10216f854b Merge pull request #506 from CoderFX/fix/pisugarx-model-name-mismatch
fix(pisugarx): correct model name mismatch in web UI
2026-03-11 07:16:18 +01:00
CoderFX 7fc4bef0ab fix(fix_services): fix interfaceface typo in log message
Typo "wifi.interfaceface" should be "wifi.interface" in the debug
log for the bettercap set wifi.interface command result.

Signed-off-by: PwnPacker <4704376+CoderFX@users.noreply.github.com>
2026-03-11 02:42:04 +02:00
CoderFX 73f8524af4 feat(pisugarx): implement all stub methods for PiSugar3
All 17 stub methods now return real data by reading PiSugar3 I2C
registers directly or from pisugar-power-manager config.

Register reads (from cached i2creg, address 0x57):
- get_battery_current: registers 0x26-0x27
- get_anti_mistouch: CTR1 (0x02) bit 3
- get_battery_auto_power_on: CTR1 (0x02) bit 4
- get_battery_soft_poweroff: CTR2 (0x03) bit 4
- get_battery_charging: derived from power_plugged + allow_charging
- get_system_time: RTC registers 0x31-0x37 (BCD decoded)
- get_rtc_adjust_ppm: registers 0x3A-0x3B (frequency compensation)
- get_rtc_alarm_repeat: registers 0x40, 0x44-0x47

I2C writes:
- set_battery_allow_charging (PiSugar3): CTR1 bit 6 set
- set_battery_notallow_charging (PiSugar3): CTR1 bit 6 clear
- rtc_web: write system time as BCD to RTC registers 0x31-0x37

Config-derived:
- get_battery_safe_shutdown_level: from plugin config
- get_battery_safe_shutdown_delay: 10s (PiSugar3 hardware)
- get_battery_charging_range: from max_charge_voltage_protection
- get_battery_full_charge_duration: N/A (no hardware support)

Pisugar-power-manager config reads:
- get_tap_enable: reads {tap}_tap_enable from config.json
- get_tap_shell: reads {tap}_tap_shell from config.json

Also fixes model name mismatch in web UI ('Pisugar 3' -> 'PiSugar3')
so PiSugar3-specific fields display correctly.

Signed-off-by: PwnPacker <4704376+CoderFX@users.noreply.github.com>
2026-03-11 01:37:00 +02:00
CoderFX 380d05cca9 fix(pisugarx): improve I2C thread safety, error recovery, and write protection
Four robustness improvements to PiSugarServer I2C communication:

1. Race condition: build i2creg into temp list, swap atomically with
   threading lock so UI thread never reads partial register data.

2. Bus recovery: add error counter with exponential backoff (3s-30s),
   log suppression after 3 errors, and SMBus reconnect after 5
   consecutive failures to recover from MCU deep sleep.

3. Write protection: restructure as try/finally so register 0x0B is
   always re-enabled even if the middle write fails.

4. Shutdown safety: wrap I2C writes in try/except/finally so failures
   are logged but never prevent pwnagotchi.shutdown() from executing.

Fixes #511

Signed-off-by: PwnPacker <4704376+CoderFX@users.noreply.github.com>
2026-03-11 01:07:27 +02:00
CoderFX 1fbfe4bc86 fix(pisugarx): prevent double voltage append with charge protection
For PiSugar2/2Plus with max_charge_voltage_protection enabled,
battery_voltage was appended to voltage_history twice per cycle:
once inside the charge protection block and once unconditionally
at the end. This skews the trimmed-mean battery level calculation.

Make the final append conditional so each model appends exactly
once per cycle regardless of charge protection setting.

Fixes #509

Signed-off-by: PwnPacker <4704376+CoderFX@users.noreply.github.com>
2026-03-11 01:04:19 +02:00
CoderFX 2246a91590 fix(pisugarx): guard against None self.ps in on_loaded and on_ui_update
on_loaded crashes with AttributeError when PiSugar is not connected
because it accesses self.ps without a None check. Also uses direct
dict access on self.options which crashes if keys are missing.

on_ui_update crashes when checking battery_plugged outside the
self.ready guard, hitting self.ps.get_battery_power_plugged on None.

Changes:
- Wrap self.ps access in on_loaded with None guard
- Use self.options.get() with safe defaults
- Move battery_plugged inside self.ready + self.ps check
- Downgrade "PiSugar is not ready" from info to debug

Fixes #507

Signed-off-by: PwnPacker <4704376+CoderFX@users.noreply.github.com>
2026-03-11 01:02:07 +02:00
CoderFX 55f294ec77 fix(pisugarx): correct model name mismatch in web UI
The web UI checks for 'Pisugar 3' (with space, lowercase 's') but
the model detection sets self.model = 'PiSugar3' (no space, uppercase 'S').
This causes 5 PiSugar3-specific fields to never display their actual values.

Replace all occurrences to match the value set during initialization.

Fixes #505

Signed-off-by: PwnPacker <4704376+CoderFX@users.noreply.github.com>
2026-03-11 00:57:54 +02:00
JayofelonyandGitHub 8b1297d836 Merge pull request #497 from CoderFX/fix/handshake-capture-optimizations
Optimize handshake capture: fix bugs and improve attack efficiency
2026-03-10 22:43:05 +01:00
JayofelonyandGitHub 241513c2f8 Merge pull request #504 from CoderFX/feature/pisugar3-scripts
Add PiSugar 3 shutdown/startup scripts and watchdog
2026-03-10 22:42:12 +01:00
JayofelonyandGitHub 0df8d4b2ec Merge pull request #501 from CoderFX/fix/fix-services-syslog-spam
Fix Fix_Services syslog handler spamming errors when bettercap is unstable
2026-03-10 22:41:34 +01:00
JayofelonyandGitHub 1793a76d12 Merge pull request #498 from CoderFX/fix/whitelist-handshake-filter
Fix whitelist not filtering passively captured handshakes
2026-03-10 22:40:35 +01:00
CoderFX dff77e105d Add PiSugar 3 shutdown/startup scripts and watchdog
PiSugar 3 users need graceful shutdown with e-ink feedback, boot-loop
prevention when charging from dead battery, and automatic recovery
when pisugar-server loses I2C connection after MCU wake.

- safe-shutdown.sh: stops pwnagotchi, draws sleeping face on e-ink,
  powers off. Boot-loop guard skips shutdown when battery <10% and
  charging.
- pisugar-watchdog.sh + systemd timer: detects MCU wake from deep
  sleep and restarts pisugar-server when I2C is present but daemon
  reports disconnected.
- epd-shutdown.py / epd-startup.py: e-ink display faces for
  Waveshare V4. Exit silently on non-V4 displays.

Signed-off-by: CoderFX <4704376+CoderFX@users.noreply.github.com>
2026-03-10 23:33:51 +02:00
CoderFX 3162fdf2aa Fix Fix_Services syslog handler spamming errors when bettercap is unstable
on_bcap_sys_log fires on every bettercap syslog event matching "wifi
error while hopping to channel". When bettercap is in a bad state, it
sends many such events per second. Each one triggers agent.run() to
flip wifi.recon, which also fails because bettercap is unstable. This
creates a cascade of TypeError errors filling the log — 61 errors in
a few minutes in observed logs.

Two fixes:

1. Safe Message access: use event.get() with isinstance check instead
   of direct dict access into re.search(). Prevents TypeError when
   Message is None or non-string, and KeyError if event structure is
   unexpected.

2. Add 30-second cooldown: check self.LASTTRY before attempting a
   recon flip, matching the debounce pattern already used in on_epoch
   and _tryTurningItOffAndOnAgain. Update LASTTRY on all outcomes
   (success, failure, exception) to prevent cascading retries.

Signed-off-by: CoderFX <4704376+CoderFX@users.noreply.github.com>
2026-03-10 23:12:42 +02:00
CoderFX f2c73f5bbe Fix whitelist not filtering passively captured handshakes
The whitelist in config.toml is checked in get_access_points() to
filter APs from active attacks, but bettercap still passively captures
handshakes from all networks including whitelisted ones. The
_on_event() handler processes wifi.client.handshake events without
any whitelist check, so handshakes from the user's own networks are
saved and reported as new captures.

Add whitelist filtering to _on_event() with two checks:
- By MAC address immediately after extracting ap_mac (catches
  MAC-based whitelist entries before any processing)
- By hostname after _find_ap_sta_in() resolves the AP (catches
  name-based whitelist entries)

When a whitelisted handshake is detected, the pcap file that
bettercap already wrote to disk is removed to prevent accumulation.

Signed-off-by: CoderFX <4704376+CoderFX@users.noreply.github.com>
2026-03-10 22:52:01 +02:00
CoderFX 3c8aa55a57 Fix auto-tune plugin: history compat, XSS, channel dedup, defaults
- Fix interaction display to handle new history dict format
  ({count, first_seen} from handshake capture optimization PR)
- Escape preset names in HTML output to prevent XSS
- Deduplicate channel list to avoid scanning same channel twice
- Replace deprecated logging.warn() with logging.warning()
- Reduce default extra_channels from 15 to 5 (15 scans nearly all
  2.4GHz channels every epoch, defeating focused scanning)

Signed-off-by: CoderFX <153912+CoderFX@users.noreply.github.com>
Signed-off-by: CoderFX <4704376+CoderFX@users.noreply.github.com>
2026-03-10 20:11:50 +02:00
CoderFX 8c1c51f158 Optimize handshake capture: fix bugs and improve attack efficiency
agent.py:
- Fix _has_handshake() substring match bug: was matching partial MACs
  (e.g. "AA:BB:CC" matching "AA:BB:CC:DD:EE:FF"), causing APs to be
  skipped. Now splits key on ' -> ' and checks exact MAC match.
- Add time-based decay to interaction history: previously once an AP/STA
  hit max_interactions it was permanently skipped for the session. Now
  resets count after 5 minutes, allowing retry of stubborn targets.
- Cap recon time increase when inactive: was doubling (30s->60s), now
  adds at most 15s to avoid long idle periods with fewer channel hops.
- Interleave populated and sparse channels instead of always hitting
  most-populated first, giving sparse channels fair coverage.
- Use set for whitelist lookup (O(1) instead of O(n) per AP).
- Remove fragile mac[:13] prefix whitelist match, use full MAC only.
- Add backward compat for recovery data format change.

cli.py:
- Reduce inter-deauth sleep from 1.0s to 0.3s. The 1s delay was overly
  conservative for nexmon firmware; 0.3s is sufficient and processes
  multi-client APs 3x faster.

Signed-off-by: CoderFX <153912+CoderFX@users.noreply.github.com>
Signed-off-by: CoderFX <4704376+CoderFX@users.noreply.github.com>
2026-03-10 19:57:26 +02:00
Jeroen Oudshoorn 6808063e9b Update file paths to use /etc/pwnagotchi for configuration and data storage 2026-02-27 17:21:47 +01:00
JayofelonyandGitHub ee44500c1d Merge pull request #487 from wsvdmeer/noai
Update Bluetooth Tether Plugin to Latest Version
2026-02-26 22:27:53 +01:00
wsvdmeer 00c3c84c17 update bt-tether plugin to newest version 2026-02-26 21:56:58 +01:00
JayofelonyandGitHub b1abe80340 Delete README-google.md 2026-02-24 18:37:23 +01:00
JayofelonyandGitHub e5a53975b4 Merge pull request #480 from wsvdmeer/bugfix/plugins-page
bugfix tooltip plugins
2026-02-22 15:22:06 +01:00
JayofelonyandGitHub 7842b40f91 Merge pull request #479 from wsvdmeer/bugfix/bt-tether-helper
Bugfix BT-Tether
2026-02-22 15:21:52 +01:00
wsvdmeer ecb831f806 bugfix tooltip plugins 2026-02-22 15:14:52 +01:00
wsvdmeer 91444ff1ba updated toml + bt-tether.py 2026-02-22 12:32:40 +01:00
Jeroen Oudshoorn a0f29a5a71 Update bt-tether plugin settings
Remove gdrivesync settings, as plugin is removed
2026-02-21 20:36:04 +01:00
Jeroen Oudshoorn 62e115ce57 Remove unused regex import from cli.py 2026-02-21 20:12:04 +01:00
Jeroen Oudshoorn 71389426ba Remove connection scripts 2026-02-21 20:11:54 +01:00
Jeroen Oudshoorn a2634ab5cd Remove unused google_cmd parser and wizard installation logic from cli.py 2026-02-21 20:11:32 +01:00
Jeroen Oudshoorn 9d317650e9 Update layout dimensions and rendering logic in waveshare2in13b_V4.py 2026-02-21 19:59:10 +01:00
Jeroen Oudshoorn 843b4ff8e6 Change bt-tether for bt-tether-helper and rename back to bt-tether. 2026-02-21 19:49:37 +01:00
Jeroen Oudshoorn 1d6fd6039e bump version to 2.9.5.5 2026-02-21 19:43:40 +01:00
JayofelonyandGitHub 8034dd789d Merge pull request #474
Web UI Redesign & Modernization updated
2026-02-21 19:43:03 +01:00
Wiebe Steven van der MeerandGitHub bef2316b08 Merge branch 'noai' into feature/web-ui
Signed-off-by: Wiebe Steven van der Meer <wsvdmeer@hotmail.com>
2026-02-21 19:40:38 +01:00
wsvdmeer 0b35c31410 bugfix handler.py 2026-02-21 19:27:35 +01:00
JayofelonyandGitHub 4f7e7e3112 Merge pull request #475 from wpa-2/noai
Fix plugin routing - <n> parameter should be <name>
2026-02-21 19:09:47 +01:00
wpa-2 2ef8b4451d Fix plugin routing - <n> parameter should be <name> 2026-02-21 18:06:29 +00:00
wiebesteven 2e86b07f91 Merge remote-tracking branch 'upstream/noai' into feature/web-ui 2026-02-21 17:37:04 +01:00
wiebesteven acae52a2bf Merge branch 'feature/web-ui' of github-personal:wsvdmeer/pwnagotchi into feature/web-ui 2026-02-21 17:34:18 +01:00
wiebesteven 269cae95c2 added svg's for theme + configurable accent colors + bugfixes 2026-02-21 17:34:16 +01:00
JayofelonyandGitHub 2a05456158 Merge pull request #472
Web UI Redesign & Modernization
2026-02-21 15:19:48 +01:00
JayofelonyandGitHub 39ceadb150 Merge branch 'noai' into feature/web-ui
Signed-off-by: Jayofelony <oudshoorn.jeroen@gmail.com>
2026-02-21 15:19:24 +01:00
JayofelonyandGitHub 6b3a92f3b2 Merge pull request #473
Bug Fixes & Dead Code Cleanup
2026-02-21 15:13:56 +01:00
wpa2 5520e13ad7 Add PwnStore as default plugin 2026-02-21 12:55:09 +00:00
wpa2 4553f13ada Fix IndentationError in log.py and identity.py - restore missing except bodies 2026-02-20 23:38:33 +00:00
wsvdmeer 88f0517dde bugfixes
Signed-off-by: wiebesteven <wiebesteven@freed.nl>
2026-02-20 22:54:02 +01:00