Open anantshri opened 7 years ago
A simpler approach to deal with this could be
try:
from config import spyonweb_access_token
ENABLED = True
except:
print "[*] Skipping : Google Tracking : spyonweb_access_token value required"
ENABLED=False
Code block like this will allow author's to decide if a specific token is important for working in the module and hence module could be auto disabled as the variable is not present.
alternative approach.
import os
import sys
dir_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(dir_path)
from config_sample import *
add this at the top of config.py
This would ensure the config_sample.py is loaded so all blank variables loaded from here and then new variables values loaded from config.py.
Pro's : after first initial setup all future issues will be sorted automatically.
Con's. Initial setup is required in non controlled file config.py
The method suggested earlier around changing template would be more in line with the way things should be but needs to be followed by every modules author.
Hey @anantshri , this issue has been solved by introducing a vault module (which checks if the variable is present, if not it prints an error message and passes to the next module).
Commit: https://github.com/DataSploit/datasploit/commit/fca270f154aa757d4c215253f5f2b26323bcccc8
I think its time to close this issue. :)
Looks good can someone please go and update the document http://datasploit.info/Writing_Modules/
for newer modules if there is a new variable added in the config file and that's not present in user config it causes an error.