Files
pwnagotchi_plugins/neurolyzer.py
AlienMajik 1440c943da Create neurolyzer.py
The Neurolyzer plugin introduces a significant enhancement to the Pwnagotchi platform, aiming to augment the device's stealth and privacy capabilities. Its main function is to automate the randomization of the MAC address for the designated Wi-Fi interface. This action helps make the Pwnagotchi less visible to network monitoring systems, thereby decreasing its digital footprint within the networks it scans. The plugin offers several noteworthy features:

    Varied Operational Modes: It introduces different modes of operation, including a 'stealth' mode. When activated, this mode triggers periodic changes to the device's MAC address, effectively masking its identity. This is particularly useful for operating within networks that are under strict surveillance.

    Adjustable MAC Address Change Interval: The plugin allows users to customize how frequently the MAC address changes, providing control over the degree of stealth based on the user's needs.

    User Interface Enhancements: Leveraging Pwnagotchi's existing UI framework, the Neurolyzer plugin offers immediate visual feedback on the device's screen. It displays the current mode of operation ('stealth' or 'normal') and the time until the next MAC address change. These interface elements are adjustable, enabling users to customize their display positions as needed.

    Wi-Fi Interface Customization: Users have the flexibility to define which Wi-Fi interface the plugin should manage, catering to devices with multiple or unconventional interface names.

    Seamless Activation/Deactivation: The plugin assesses its activation status upon loading, based on the configured settings, and commences its functions automatically if enabled. This feature allows for a hassle-free transition to stealth mode.

    Comprehensive Logging: The Neurolyzer plugin meticulously logs key events and potential errors during its operation. This aids in monitoring the plugin's performance and simplifying troubleshooting processes.

In essence, the Neurolyzer plugin significantly bolsters the Pwnagotchi's capability for stealthy operations, ensuring users can engage in ethical hacking and network exploration with an enhanced level of privacy. Through its thoughtful integration with the Pwnagotchi ecosystem, the plugin elevates the device's functionality, aligning with the objectives of privacy-conscious users and ethical hackers.
2024-03-09 17:00:32 -08:00

90 lines
3.3 KiB
Python

import logging
import subprocess
import time
import pwnagotchi.plugins as plugins
from pwnagotchi.ui.components import LabeledValue
from pwnagotchi.ui.view import BLACK
import pwnagotchi.ui.fonts as fonts
class Neurolyzer(plugins.Plugin):
__author__ = 'AlienMajik'
__version__ = '1.1.1'
__license__ = 'GPL3'
__description__ = "A plugin for enhanced stealth and privacy."
def __init__(self):
self.enabled = False
self.wifi_interface = 'wlan0'
self.operation_mode = 'stealth' # 'normal' or 'stealth'
self.mac_change_interval = 3600 # Interval in seconds
self.last_mac_change_time = time.time()
# UI custom positions
self.mode_label_position = (0, 0)
self.next_mac_change_label_position = (0, 0)
def on_loaded(self):
self.enabled = self.options.get('enabled', False)
self.wifi_interface = self.options.get('wifi_interface', 'wlan0')
self.operation_mode = self.options.get('operation_mode', 'stealth')
self.mac_change_interval = self.options.get('mac_change_interval', 3600)
# UI positions from config
self.mode_label_position = (self.options.get('mode_label_x', 0), self.options.get('mode_label_y', 0))
self.next_mac_change_label_position = (self.options.get('next_mac_change_label_x', 0), self.options.get('next_mac_change_label_y', 10))
if self.enabled:
logging.info("[Neurolyzer] Plugin loaded. Operating in %s mode." % self.operation_mode)
self.randomize_mac() # Initial MAC address randomization
else:
logging.info("[Neurolyzer] Plugin not enabled.")
def on_ui_setup(self, ui):
if not self.enabled:
return
self.mode_label = LabeledValue(
color=BLACK,
label="Mode:",
value=self.operation_mode.capitalize(),
position=self.mode_label_position,
label_font=fonts.Small,
text_font=fonts.Small
)
ui.add_element('neurolyzer_mode', self.mode_label)
self.next_mac_change_label = LabeledValue(
color=BLACK,
label="Next MAC change:",
value="Calculating...",
position=self.next_mac_change_label_position,
label_font=fonts.Small,
text_font=fonts.Small
)
ui.add_element('neurolyzer_next_mac', self.next_mac_change_label)
def on_ui_update(self, ui):
if not self.enabled:
return
remaining_time = self.mac_change_interval - (time.time() - self.last_mac_change_time)
self.next_mac_change_label.set(
"%dm" % (remaining_time // 60)
)
self.mode_label.set(self.operation_mode.capitalize())
def randomize_mac(self):
if self.operation_mode != 'stealth' or not self.enabled:
return
try:
subprocess.run(['macchanger', '-r', self.wifi_interface], check=True)
self.last_mac_change_time = time.time()
logging.info(f"[Neurolyzer] MAC address randomized for {self.wifi_interface}.")
except subprocess.CalledProcessError as e:
logging.error(f"[Neurolyzer] MAC randomization failed: {e}")
def on_unload(self):
if not self.enabled:
return
logging.info("[Neurolyzer] Plugin unloaded.")