mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
add custom repos
This commit is contained in:
@ -2,6 +2,9 @@ main.name = ""
|
|||||||
main.lang = "en"
|
main.lang = "en"
|
||||||
main.confd = "/etc/pwnagotchi/conf.d/"
|
main.confd = "/etc/pwnagotchi/conf.d/"
|
||||||
main.custom_plugins = ""
|
main.custom_plugins = ""
|
||||||
|
main.custom_plugin_repos = [
|
||||||
|
"https://github.com/evilsocket/pwnagotchi-plugins-contrib/archive/master.zip"
|
||||||
|
]
|
||||||
main.iface = "mon0"
|
main.iface = "mon0"
|
||||||
main.mon_start_cmd = "/usr/bin/monstart"
|
main.mon_start_cmd = "/usr/bin/monstart"
|
||||||
main.mon_stop_cmd = "/usr/bin/monstop"
|
main.mon_stop_cmd = "/usr/bin/monstop"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# Handles the commandline stuff
|
# Handles the commandline stuff
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import glob
|
import glob
|
||||||
@ -11,7 +10,6 @@ from pwnagotchi.utils import download_file, unzip, save_config, parse_version, m
|
|||||||
from pwnagotchi.plugins import default_path
|
from pwnagotchi.plugins import default_path
|
||||||
|
|
||||||
|
|
||||||
REPO_URL = 'https://github.com/evilsocket/pwnagotchi-plugins-contrib/archive/master.zip'
|
|
||||||
SAVE_DIR = '/usr/local/share/pwnagotchi/availaible-plugins/'
|
SAVE_DIR = '/usr/local/share/pwnagotchi/availaible-plugins/'
|
||||||
DEFAULT_INSTALL_PATH = '/usr/local/share/pwnagotchi/installed-plugins/'
|
DEFAULT_INSTALL_PATH = '/usr/local/share/pwnagotchi/installed-plugins/'
|
||||||
|
|
||||||
@ -75,7 +73,7 @@ def handle_cmd(args, config):
|
|||||||
Parses the arguments and does the thing the user wants
|
Parses the arguments and does the thing the user wants
|
||||||
"""
|
"""
|
||||||
if args.plugincmd == 'update':
|
if args.plugincmd == 'update':
|
||||||
return update()
|
return update(config)
|
||||||
elif args.plugincmd == 'search':
|
elif args.plugincmd == 'search':
|
||||||
args.installed = True # also search in installed plugins
|
args.installed = True # also search in installed plugins
|
||||||
return list_plugins(args, config, args.pattern)
|
return list_plugins(args, config, args.pattern)
|
||||||
@ -349,14 +347,21 @@ def _analyse_dir(path):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
def update():
|
def update(config):
|
||||||
"""
|
"""
|
||||||
Updates the database
|
Updates the database
|
||||||
"""
|
"""
|
||||||
global REPO_URL, SAVE_DIR
|
global SAVE_DIR
|
||||||
|
|
||||||
|
urls = config['main']['custom_plugin_repos']
|
||||||
|
if not urls:
|
||||||
|
logging.info('No plugin repositories configured.')
|
||||||
|
return 1
|
||||||
|
|
||||||
|
rc = 0
|
||||||
DEST = os.path.join(SAVE_DIR, 'plugins.zip')
|
DEST = os.path.join(SAVE_DIR, 'plugins.zip')
|
||||||
logging.info('Downloading plugins to %s', DEST)
|
for REPO_URL in urls:
|
||||||
|
logging.info('Downloading plugins from %s to %s', REPO_URL, DEST)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.makedirs(SAVE_DIR, exist_ok=True)
|
os.makedirs(SAVE_DIR, exist_ok=True)
|
||||||
@ -383,7 +388,7 @@ def update():
|
|||||||
if changed:
|
if changed:
|
||||||
logging.info('%d file(s) were changed.', changed)
|
logging.info('%d file(s) were changed.', changed)
|
||||||
|
|
||||||
return 0
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logging.error('Error while updating plugins %s', ex)
|
logging.error('Error while updating plugins: %s', ex)
|
||||||
return 1
|
rc = 1
|
||||||
|
return rc
|
||||||
|
Reference in New Issue
Block a user