Commit Graph
4112 Commits
Author SHA1 Message Date
Jeroen Oudshoorn 39341f6525 Moved cache plugin to core functionality of Pwnagotchi.
Moved bt-tether to core functionality of Pwnagotchi.
Moved auto-tune to core functionality of Pwnagotchi.

They are no longer plugins, except for bt-tether which can still be disabled if you don't want it.

Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2026-07-27 21:09:38 +02:00
Jeroen OudshoornandClaude Haiku 4.5 a6e283c25b config(defaults): add strategy options, remove disabled auto-tune plugin
Updated defaults.toml to reflect strategy extraction:

Added [main] configuration:
- extra_channels = 15  (number of random channels to explore per epoch)
- restrict_channels = commented example (optional: limit to specific channels)

Removed:
- [main.plugins.auto-tune] section (now moved to core pwnagotchi/strategy)

The channel selection strategy is now configured via [main] section instead of
as a plugin, making it a core infrastructure component with clear, simple
configuration options.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-27 17:36:29 +02:00
Jeroen OudshoornandClaude Haiku 4.5 22d35b5eb6 integrate(strategy): wire channel strategy into agent lifecycle
Connected pwnagotchi/strategy module to agent.py so channel selection is always active:

Changes:
1. Import Strategy in agent.py
2. Initialize strategy in Agent.__init__()
3. Wire strategy event handlers to key agent methods:
   - on_wifi_update(): called when WiFi list refreshed
   - select_next_channels(): called to set channels for next epoch
   - on_association(): track assoc interactions per channel
   - on_deauthentication(): track deauth interactions per channel
   - on_handshake(): track handshake captures per channel

Integration points:
- set_access_points(): updates strategy and selects next channels
- associate(): reports association to strategy
- deauth(): reports deauth to strategy
- _on_event_new_handshake(): reports handshake to strategy

The strategy now:
- Receives every relevant agent event
- Maintains per-channel statistics
- Selects next channels to scan based on active APs + random exploration
- Updates config['personality']['channels'] for next epoch
- Guides agent behavior through channel selection

This makes channel selection strategy a core, always-active component instead of
an optional plugin, ensuring intelligent adaptation to environment changes.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-27 17:30:20 +02:00
Jeroen OudshoornandClaude Haiku 4.5 b9e8d1484f refactor(plugins): disable auto-tune plugin - moved to core strategy module
The auto-tune plugin has been disabled (.disabled) since its core functionality
(channel selection strategy, AP tracking, statistics) is now in pwnagotchi/strategy.

Why:
- Channel selection strategy is essential, not optional
- Should not be disableable via plugin system
- Cleaner to have it as core infrastructure
- Reduces plugin complexity

Users who want advanced tuning/presets can recreate the web UI as a separate plugin
that reads from the new Strategy facade, but that's now optional, not essential.

Original: auto-tune.py.backup for reference
Disabled: auto-tune.py.disabled (won't be loaded by plugin system)
New core: pwnagotchi/strategy/ module (always active)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-27 17:27:50 +02:00
Jeroen OudshoornandClaude Haiku 4.5 9fa3264440 refactor(strategy): extract auto-tune core logic into pwnagotchi/strategy module
Extracted intelligent channel selection strategy from auto-tune plugin into core
as pwnagotchi/strategy/ module with 3 focused components:

1. channels.py: ChannelStrategy
   - Selects channels for each epoch (active + extra unscanned)
   - Builds on active_channels and explores new areas
   - Handles channel list repopulation from config/agent

2. statistics.py: ChannelStatistics
   - Tracks per-channel statistics (AP counts, interactions)
   - Maintains known AP database
   - Manages active vs unscanned channel lists
   - Records interactions (assoc, deauth, handshakes)

3. __init__.py: Strategy facade
   - Unified entry point for agent integration
   - Event handler dispatch
   - Public API for stats access

Key changes:
- Strategy is now ALWAYS active (not optional like plugin)
- Personality/config loaded from config.toml, not plugin options
- No web UI or preset management (core only)
- Clean event integration with agent
- Removed ~600 lines of UI/preset code

Auto-tune.py is now DISABLED. Original backed up as auto-tune.py.backup.

The strategy replaces the removed RL-based AI with intelligent heuristics:
- Always scan active channels (high capture probability)
- Explore unscanned channels (discovery)
- Track statistics to guide behavior
- Adapt to environment changes

Configuration in config.toml:
    [main]
    extra_channels = 15
    restrict_channels = [1, 6, 11]  # optional

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-27 17:27:38 +02:00
Jeroen OudshoornandClaude Haiku 4.5 5c1d342893 refactor(bluetooth-ui): restore full HTML template in thin plugin wrapper
Updated bt-tether-thin.py to include the complete original HTML interface with:
- Full styling (dark theme, responsive design)
- Connection status monitoring with real-time updates
- Trusted devices summary
- Device discovery and scanning UI
- Internet connectivity testing
- Live log viewer with auto-scroll
- Interactive control buttons (Connect/Disconnect/Pair/Scan)

The simplified template has been replaced with the full feature-rich version,
maintaining 100% visual and functional parity with the original plugin while
delegating core Bluetooth logic to the modular pwnagotchi.bluetooth service.

This ensures a smooth migration path: users can simply rename bt-tether-thin.py
to bt-tether.py once testing is complete, with no loss of functionality.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-27 17:23:15 +02:00
Jeroen OudshoornandClaude Haiku 4.5 0b87b1b472 refactor(bluetooth): extract bt-tether core logic into reusable module
Split the monolithic 5000+ line bt-tether plugin into:

1. Core module (pwnagotchi/bluetooth/) with 7 focused submodules:
   - device.py: Device state and validation
   - connection.py: Core Bluetooth operations (pairing, connect, disconnect)
   - network.py: PAN interface and network management
   - agent.py: Pairing agent lifecycle
   - monitor.py: Connection monitoring and auto-reconnect
   - ui.py: Display rendering and status caching
   - __init__.py: Service facade with public API

2. Thin plugin wrapper (bt-tether-thin.py):
   - Delegates to BluetoothService
   - Reduced from 5000+ to ~750 lines
   - Maintains plugin interface compatibility
   - Handles webhook routing and event dispatch

Benefits:
- Core Bluetooth logic is now testable and reusable
- Clear separation of concerns (each module has single responsibility)
- Non-blocking UI updates via UICache pattern
- Proper error handling and timeout management
- Threading/locking concerns isolated by module
- Formal event system for plugin-core communication

Original bt-tether.py backed up as bt-tether.py.backup for reference.

Fixed security issue: replaced os.system() command injection in handler.py with subprocess.run()

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-27 17:19:57 +02:00
Jeroen Oudshoorn eebe4e69d7 Add bt-tether config settings
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2026-03-26 10:21:28 +01:00
Jeroen Oudshoorn ab33e0eb79 Add bt-tether config settings
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2026-03-26 10:12:01 +01:00
Jeroen Oudshoorn 693750ea7d Updated
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2026-03-26 10:10:03 +01:00
Jeroen Oudshoorn c166942586 feat(ui): enhance web interface with new logtail and web configuration features
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2026-03-26 09:33:31 +01:00
Jeroen Oudshoorn 7999a0455f feat(ui): enhance web interface with new logtail and web configuration features
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2026-03-26 09:32:40 +01:00
Jeroen Oudshoorn 36632bcbd5 feat(ui): enhance web interface with new logtail and web configuration features
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2026-03-25 20:58:29 +01:00
Jeroen Oudshoorn d98143b022 feat(display): add support for whisplay display type and update related configurations
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2026-03-25 20:53:07 +01:00
Jeroen Oudshoorn aad8c01f65 Update to 2.9.5.5
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2026-03-25 19:25:43 +01:00
Jeroen Oudshoorn 01c6ab856d Revert to 2.9.5.4
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2026-03-25 19:01:56 +01:00
Jeroen Oudshoorn 214658bbcf Revert "Add handshakes-dl plugin with network map and handshake tracking"
This reverts commit 0d5a0ccb01.
2026-03-25 18:20:14 +01:00
Jeroen Oudshoorn 5594fa59ff Revert "feat(fix_services): add interface name validation helper"
This reverts commit 45d846c348.
2026-03-25 18:20:13 +01:00
Jeroen Oudshoorn b4727bcf87 Revert "fix(fix_services): add threading lock around LASTTRY and isReloadingMon"
This reverts commit f894649e51.
2026-03-25 18:20:11 +01:00
Jeroen Oudshoorn 6e8dbaf90c Revert "fix(fix_services): merge duplicate pattern handlers 5 and 6"
This reverts commit 3962c75730.
2026-03-25 18:20:10 +01:00
Jeroen Oudshoorn 4ec96bdc85 Revert "fix(fix_services): update LASTTRY in all on_epoch pattern handlers"
This reverts commit c2e61a1517.
2026-03-25 18:20:03 +01:00
Jeroen Oudshoorn ead26b5a3f Revert "fix(fix_services): remove unused imports Text, BLACK, fonts"
This reverts commit 36647cb367.
2026-03-25 18:19:54 +01:00
Jeroen Oudshoorn 14d2c68980 Revert "fix(fix_services): fix display null reference crash in on_epoch"
This reverts commit 0fd715b554.
2026-03-25 18:19:49 +01:00
Jeroen Oudshoorn 4ee52614cf Revert "fix(fix_services): remove dead code in on_ui_setup"
This reverts commit bbf1d95bfc.
2026-03-25 18:19:47 +01:00
Jeroen Oudshoorn b42d01ddc2 Revert "fix(fix_services): remove unused Popen in on_ready (resource leak)"
This reverts commit 283be16549.
2026-03-25 18:19:45 +01:00
Jeroen Oudshoorn 9080a4c768 Revert "feat(pisugarx): implement all stub methods for PiSugar3"
This reverts commit 73f8524af4.
2026-03-25 18:19:41 +01:00
Jeroen Oudshoorn 17bb0c3c53 Revert "fix(pisugarx): improve I2C thread safety, error recovery, and write protection"
This reverts commit 380d05cca9.
2026-03-25 18:19:40 +01:00
Jeroen Oudshoorn b927aff704 Revert "fix(pisugarx): prevent double voltage append with charge protection"
This reverts commit 1fbfe4bc86.
2026-03-25 18:19:38 +01:00
Jeroen Oudshoorn 71c704047a Revert "fix(pisugarx): guard against None self.ps in on_loaded and on_ui_update"
This reverts commit 2246a91590.
2026-03-25 18:19:37 +01:00
Jeroen Oudshoorn add1f51b91 Revert "fix(pisugarx): correct model name mismatch in web UI"
This reverts commit 55f294ec77.
2026-03-25 18:19:36 +01:00
Jeroen Oudshoorn b2e24a8e48 Revert "Add PiSugar 3 shutdown/startup scripts and watchdog"
This reverts commit dff77e105d.
2026-03-25 18:19:29 +01:00
Jeroen Oudshoorn b661286545 Revert "Fix whitelist not filtering passively captured handshakes"
This reverts commit f2c73f5bbe.
2026-03-25 18:19:18 +01:00
Jeroen Oudshoorn 249cac0420 Revert "Fix auto-tune plugin: history compat, XSS, channel dedup, defaults"
This reverts commit 3c8aa55a57.
2026-03-25 18:19:17 +01:00
Jeroen Oudshoorn 52c1306719 Revert "Optimize handshake capture: fix bugs and improve attack efficiency"
This reverts commit 8c1c51f158.
2026-03-25 18:19:15 +01:00
Jeroen Oudshoorn 103f473376 Revert log changes
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2026-03-24 21:44:45 +01:00
JayofelonyandGitHub 7cfc0cc9c9 Merge pull request #370
support syslog or console logging instead of files. disable session s…
2026-03-24 21:37:53 +01:00
JayofelonyandGitHub 2d8f61dddd Merge pull request #306
added ui.faces.scale = # to png faces
2026-03-24 21:37:08 +01:00
JayofelonyandGitHub 77555bb594 Merge pull request #553
Add handshakes-dl plugin with network map
2026-03-24 21:31:52 +01:00
JayofelonyandGitHub 2fabaa301b Merge pull request #550
feat(fix_services): add interface name validation helper
2026-03-24 21:31:03 +01:00
JayofelonyandGitHub 9f099d3664 Merge pull request #544
fix(fix_services): add threading lock for LASTTRY race condition
2026-03-24 21:30:16 +01:00
JayofelonyandGitHub e9257b2520 Merge pull request #526
fix(fix_services): merge duplicate pattern handlers 5 and 6
2026-03-24 21:29:02 +01:00
Jeroen Oudshoorn 581d038925 Merge remote-tracking branch 'origin/noai' into noai 2026-03-24 21:11:46 +01:00
Jeroen Oudshoorn a5a2027cef Add PiSugar Whisplay to supported displays.
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2026-03-24 21:11:05 +01:00
CoderFX 0d5a0ccb01 Add handshakes-dl plugin with network map and handshake tracking
Adds a new default plugin that provides a web UI for browsing,
downloading, and analyzing captured WiFi handshakes and network data.

Features:
- Browse and search captured .pcap handshake files
- Download individual files or all as a zip archive
- Interactive network map with D3.js force-directed graph
  - Zoom, pan, drag nodes to rearrange
  - AP nodes colored by encryption type, sized by client count
  - Click AP to highlight its connected clients
  - Auto-fits to viewport after layout settles
- Sortable table view with expandable AP rows showing clients
- Handshake column with download links for captured .pcap files
- Historical AP import from existing pcap filenames
- Live data from bettercap session merged with persistent history
- Stats bar: AP count, unique clients, total data volume
- Persistent JSON storage surviving reboots
2026-03-11 21:56:26 +02:00
CoderFX 45d846c348 feat(fix_services): add interface name validation helper
Add _IFACE_RE regex and _validate_iface() classmethod that validates
Linux network interface names (max 15 chars, alphanumeric plus dash
and underscore). Provides a safety net against malformed names if
interface configuration is ever externalized.
2026-03-11 17:36:45 +02:00
CoderFX f894649e51 fix(fix_services): add threading lock around LASTTRY and isReloadingMon
on_epoch and on_bcap_sys_log run from different threads (main loop vs
bettercap event handler). Both read and write self.LASTTRY without
synchronization, creating a race where two recovery actions fire
simultaneously. Similarly, isReloadingMon can be checked and set by
concurrent threads leading to overlapping restarts.

Add a threading.Lock to serialize cooldown checks and state mutations:
- on_bcap_sys_log: lock around LASTTRY cooldown check
- on_epoch: lock around LASTTRY cooldown check
- _tryTurningItOffAndOnAgain: lock around duplicate-attempt guard,
  early return instead of else-block to flatten indentation

Signed-off-by: PwnPacker <4704376+CoderFX@users.noreply.github.com>
2026-03-11 17:28:21 +02:00
CoderFX 3962c75730 fix(fix_services): merge duplicate pattern handlers 5 and 6
Patterns 5 (concurrent map iteration) and 6 (panic: runtime error) had
identical handlers — both log "Bettercap has crashed!", restart bettercap,
and restart pwnagotchi. Merge into a single elif with an or condition.

Closes #539

Signed-off-by: PwnPacker <4704376+CoderFX@users.noreply.github.com>
2026-03-11 17:12:37 +02:00
JayofelonyandGitHub 3d9280a61a Merge pull request #533 from CoderFX/fix/fix-services-print-to-logging
fix(fix_services): replace print() calls with logging
2026-03-11 07:29:37 +01:00
JayofelonyandGitHub 012efdbaf4 Merge pull request #535 from CoderFX/fix/fix-services-lasttry-update
fix(fix_services): update LASTTRY cooldown after pattern matches
2026-03-11 07:21:06 +01:00
JayofelonyandGitHub 635f00f4e7 Merge pull request #531 from CoderFX/fix/fix-services-unused-imports
fix(fix_services): remove unused imports Text, BLACK, fonts
2026-03-11 07:20:46 +01:00