Update file paths to use /etc/pwnagotchi for configuration and data storage

This commit is contained in:
Jeroen Oudshoorn
2026-02-27 17:21:47 +01:00
parent ee44500c1d
commit 6808063e9b
11 changed files with 213 additions and 219 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Ask2AgentMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

2
.idea/misc.xml generated
View File

@@ -3,7 +3,7 @@
<component name="Black">
<option name="sdkName" value="Python 3.11 (pwnagotchi)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (pwnagotchi)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13" project-jdk-type="Python SDK" />
<component name="PythonCompatibilityInspectionAdvertiser">
<option name="version" value="3" />
</component>

2
.idea/pwnagotchi.iml generated
View File

@@ -5,7 +5,7 @@
<excludeFolder url="file://$MODULE_DIR$/.venv" />
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.12 (pwnagotchi)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.13" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">

View File

@@ -21,14 +21,14 @@ custom_plugin_repos = [
"https://github.com/wpa-2/Pwnagotchi-Plugins/archive/master.zip",
"https://github.com/cyberartemio/wardriver-pwnagotchi-plugin/archive/main.zip"
]
custom_plugins = "/usr/local/share/pwnagotchi/custom-plugins/"
custom_plugins = "/etc/pwnagotchi/custom-plugins/"
[main.plugins.auto-tune]
enabled = true
[main.plugins.auto_backup] #More options availble https://github.com/wpa-2/Pwnagotchi-Plugins/blob/main/auto_backup_config.md
enabled = true
backup_location = "/home/pi/backups"
backup_location = "/etc/pwnagotchi/backups"
[main.plugins.auto-update]
enabled = true
@@ -234,7 +234,7 @@ rotation = 180
type = "waveshare_4"
[bettercap]
handshakes = "/home/pi/handshakes"
handshakes = "/etc/pwnagotchi/handshakes"
silence = [
"ble.device.new",
"ble.device.lost",

View File

@@ -57,7 +57,7 @@ class auto_tune(plugins.Plugin):
"sta_ttl": "Clients older than this will ignored",
}
self.options = dict()
self.presets_dir = os.path.expanduser("~/auto-tune-presets")
self.presets_dir = os.path.expanduser("/etc/pwnagotchi/auto-tune-presets")
self._ensure_presets_dir()
def _ensure_presets_dir(self):

View File

@@ -72,7 +72,7 @@ def check(version, repo, native=True, token=""):
def make_path_for(name):
path = os.path.join("/home/pi/", name)
path = os.path.join("/opt/", name)
if os.path.exists(path):
logging.debug("[update] deleting %s" % path)
shutil.rmtree(path, ignore_errors=True, onerror=None)
@@ -155,7 +155,7 @@ def install(display, update):
try:
# Activate the virtual environment and install the package
subprocess.run(
["bash", "-c", f"source /home/pi/.pwn/bin/activate && pip install {source_path}"],
["bash", "-c", f"source /opt/.pwn/bin/activate && pip install {source_path}"],
check=True
)

View File

@@ -20,20 +20,13 @@ class AutoBackup(plugins.Plugin):
# Hardcoded defaults for Pwnagotchi
DEFAULT_FILES = [
"/root/settings.yaml",
"/root/client_secrets.json",
"/root/.api-report.json",
"/root/.ssh",
"/root/.bashrc",
"/root/.profile",
"/root/peers",
"/etc/pwnagotchi/",
"/usr/local/share/pwnagotchi/custom-plugins",
"/etc/ssh/",
"/home/pi/handshakes/",
"/home/pi/.bashrc",
"/home/pi/.profile",
"/home/pi/.wpa_sec_uploads",
]
DEFAULT_INTERVAL_SECONDS = 60 * 60 # 60 minutes

View File

@@ -491,7 +491,7 @@ class SessionStats(plugins.Plugin):
)
DEFAULT_UPDATE_INTERVAL = 15 # RPi-friendly: 15 sec = 4 disk writes/min
DEFAULT_SAVE_PATH = (
"/home/pi/pwnagotchi/sessions/" # Standard location for user data
"/etc/pwnagotchi/sessions/" # Standard location for user data
)
def __init__(self):

View File

@@ -34,7 +34,7 @@ class WpaSec(plugins.Plugin):
self._init_db()
def _init_db(self):
db_conn = sqlite3.connect('/home/pi/.wpa_sec_db')
db_conn = sqlite3.connect('/etc/pwnagotchi/.wpa_sec_db')
db_conn.execute('pragma journal_mode=wal')
with db_conn:
db_conn.execute('''
@@ -72,7 +72,7 @@ class WpaSec(plugins.Plugin):
if not remove_whitelisted([filename], config['main']['whitelist']):
return
db_conn = sqlite3.connect('/home/pi/.wpa_sec_db')
db_conn = sqlite3.connect('/etc/pwnagotchi/.wpa_sec_db')
with db_conn:
db_conn.execute('''
INSERT INTO handshakes (path, status)
@@ -93,7 +93,7 @@ class WpaSec(plugins.Plugin):
display = agent.view()
try:
db_conn = sqlite3.connect('/home/pi/.wpa_sec_db')
db_conn = sqlite3.connect('/etc/pwnagotchi/.wpa_sec_db')
cursor = db_conn.cursor()
cursor.execute('SELECT path FROM handshakes WHERE status = ?', (self.Status.TOUPLOAD.value,))
@@ -264,7 +264,7 @@ class WpaSec(plugins.Plugin):
def on_ui_update(self, ui):
if 'show_pwd' in self.options and self.options['show_pwd'] and 'download_results' in self.options and self.options['download_results']:
file_path = '/home/pi/handshakes/wpa-sec.cracked.potfile'
file_path = '/etc/pwnagotchi/handshakes/wpa-sec.cracked.potfile'
try:
with open(file_path, 'r') as file:
# Read all lines and extract the required fields

View File

@@ -85,7 +85,7 @@ if errorlevel 1 (
)
echo [INFO] Backing up %UNIT_HOSTNAME% to %OUTPUT% ... >> "%LOGFILE%"
set "FILES_TO_BACKUP=/root/settings.yaml /root/client_secrets.json /root/auto-tune-presets /root/.ssh /root/.api-report.json /root/.bashrc /root/.profile /home/pi/handshakes /root/peers /etc/pwnagotchi/ /usr/local/share/pwnagotchi/custom-plugins /etc/ssh/ /home/pi/.bashrc /home/pi/.profile /home/pi/.wpa_sec_uploads"
set "FILES_TO_BACKUP=/root/settings.yaml /root/client_secrets.json /root/auto-tune-presets /root/.ssh /root/.api-report.json /root/.bashrc /root/.profile /root/peers /etc/pwnagotchi/ /etc/ssh/"
ssh %UNIT_USERNAME%@%UNIT_HOSTNAME% "sudo tar -cf - %FILES_TO_BACKUP% | gzip -9" > "%OUTPUT%" 2>> "%LOGFILE%"
if errorlevel 1 (

View File

@@ -82,14 +82,9 @@ do_backup() {
/root/.ssh
/root/.bashrc
/root/.profile
/home/pi/handshakes
/root/peers
/etc/pwnagotchi/
/usr/local/share/pwnagotchi/custom-plugins
/etc/ssh/
/home/pi/.bashrc
/home/pi/.profile
/home/pi/.wpa_sec_uploads
"
# Convert multiline variable into a space-separated list
FILES_TO_BACKUP=$(echo "$FILES_TO_BACKUP" | tr '\n' ' ')