plugins are now enabled by config.yml or custom.yml (closes #114)
This commit is contained in:
parent
56b1d21bb0
commit
bbe5540c43
sdcard/rootfs/root/pwnagotchi
config.yml
scripts
@ -3,7 +3,11 @@ main:
|
|||||||
# currently implemented: en (default), de, nl, it
|
# currently implemented: en (default), de, nl, it
|
||||||
lang: en
|
lang: en
|
||||||
# custom plugins path, if null only default plugins with be loaded
|
# custom plugins path, if null only default plugins with be loaded
|
||||||
plugins: null
|
custom_plugins:
|
||||||
|
# which plugins to load and enable
|
||||||
|
plugins:
|
||||||
|
- gps
|
||||||
|
- twitter
|
||||||
# monitor interface to use
|
# monitor interface to use
|
||||||
iface: mon0
|
iface: mon0
|
||||||
# command to run to bring the mon interface up in case it's not up already
|
# command to run to bring the mon interface up in case it's not up already
|
||||||
@ -15,7 +19,9 @@ main:
|
|||||||
# if true, will not restart the wifi module
|
# if true, will not restart the wifi module
|
||||||
no_restart: false
|
no_restart: false
|
||||||
# access points to ignore
|
# access points to ignore
|
||||||
whitelist: []
|
whitelist:
|
||||||
|
- EXAMPLE_NETWORK
|
||||||
|
- ANOTHER_EXAMPLE_NETWORK
|
||||||
# if not null, filter access points by this regular expression
|
# if not null, filter access points by this regular expression
|
||||||
filter: null
|
filter: null
|
||||||
# cryptographic key for identity
|
# cryptographic key for identity
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import os
|
|
||||||
import argparse
|
import argparse
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
@ -33,9 +32,9 @@ args = parser.parse_args()
|
|||||||
config = utils.load_config(args)
|
config = utils.load_config(args)
|
||||||
utils.setup_logging(args, config)
|
utils.setup_logging(args, config)
|
||||||
|
|
||||||
plugins.load_from_path(plugins.default_path)
|
plugins.load_from_path(plugins.default_path, enabled=config['main']['plugins'])
|
||||||
if 'plugins' in config['main'] and config['main']['plugins'] is not None:
|
if 'custom_plugins' in config['main'] and config['main']['custom_plugins'] is not None:
|
||||||
plugins.load_from_path(config['main']['plugins'])
|
plugins.load_from_path(config['main']['custom_plugins'], enabled=config['main']['plugins'])
|
||||||
|
|
||||||
plugins.on('loaded')
|
plugins.on('loaded')
|
||||||
|
|
||||||
|
@ -27,14 +27,13 @@ def load_from_file(filename):
|
|||||||
return plugin_name, instance
|
return plugin_name, instance
|
||||||
|
|
||||||
|
|
||||||
def load_from_path(path):
|
def load_from_path(path, enabled=()):
|
||||||
global loaded
|
global loaded
|
||||||
|
|
||||||
for filename in glob.glob(os.path.join(path, "*.py")):
|
for filename in glob.glob(os.path.join(path, "*.py")):
|
||||||
name, plugin = load_from_file(filename)
|
name, plugin = load_from_file(filename)
|
||||||
if name in loaded:
|
if name in loaded:
|
||||||
raise Exception("plugin %s already loaded from %s" % (name, plugin.__file__))
|
raise Exception("plugin %s already loaded from %s" % (name, plugin.__file__))
|
||||||
elif not plugin.__enabled__:
|
elif name not in enabled:
|
||||||
# print("plugin %s is not enabled" % name)
|
# print("plugin %s is not enabled" % name)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
@ -3,7 +3,6 @@ __version__ = '1.0.0'
|
|||||||
__name__ = 'hello_world'
|
__name__ = 'hello_world'
|
||||||
__license__ = 'GPL3'
|
__license__ = 'GPL3'
|
||||||
__description__ = 'An example plugin for pwnagotchi that implements all the available callbacks.'
|
__description__ = 'An example plugin for pwnagotchi that implements all the available callbacks.'
|
||||||
__enabled__ = False # IMPORTANT: set this to True to enable your plugin.
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ __version__ = '1.0.0'
|
|||||||
__name__ = 'gps'
|
__name__ = 'gps'
|
||||||
__license__ = 'GPL3'
|
__license__ = 'GPL3'
|
||||||
__description__ = 'Save GPS coordinates whenever an handshake is captured.'
|
__description__ = 'Save GPS coordinates whenever an handshake is captured.'
|
||||||
__enabled__ = True # set to false if you just don't use GPS
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
|
@ -7,7 +7,6 @@ __version__ = '1.0.0'
|
|||||||
__name__ = 'memtemp'
|
__name__ = 'memtemp'
|
||||||
__license__ = 'GPL3'
|
__license__ = 'GPL3'
|
||||||
__description__ = 'A plugin that will add a memory and temperature indicator'
|
__description__ = 'A plugin that will add a memory and temperature indicator'
|
||||||
__enabled__ = False
|
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ __version__ = '1.0.0'
|
|||||||
__name__ = 'twitter'
|
__name__ = 'twitter'
|
||||||
__license__ = 'GPL3'
|
__license__ = 'GPL3'
|
||||||
__description__ = 'This plugin creates tweets about the recent activity of pwnagotchi'
|
__description__ = 'This plugin creates tweets about the recent activity of pwnagotchi'
|
||||||
__enabled__ = True
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from pwnagotchi.voice import Voice
|
from pwnagotchi.voice import Voice
|
||||||
|
@ -12,7 +12,6 @@ __version__ = '1.0.0'
|
|||||||
__name__ = 'ups_lite'
|
__name__ = 'ups_lite'
|
||||||
__license__ = 'GPL3'
|
__license__ = 'GPL3'
|
||||||
__description__ = 'A plugin that will add a voltage indicator for the UPS Lite v1.1'
|
__description__ = 'A plugin that will add a voltage indicator for the UPS Lite v1.1'
|
||||||
__enabled__ = False
|
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user