DataSploit / datasploit

An #OSINT Framework to perform various recon techniques on Companies, People, Phone Number, Bitcoin Addresses, etc., aggregate all the raw data, and give data in multiple formats.
GNU General Public License v3.0
3.02k stars 425 forks source link

errors when new variable is introduced in the config.py #176

Open anantshri opened 7 years ago

anantshri commented 7 years ago

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.

import_error

anantshri commented 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.

anantshri commented 6 years ago

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.

Chan9390 commented 6 years ago

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. :)

anantshri commented 6 years ago

Looks good can someone please go and update the document http://datasploit.info/Writing_Modules/