Skip to content

Commit 4116d07

Browse files
committed
Fixing __init__.py files to make imports easier, enabling running Osint scripts using import, fix virustotal module to prevent breaking on import
1 parent 4bff9c0 commit 4116d07

File tree

7 files changed

+42
-11
lines changed

7 files changed

+42
-11
lines changed

__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from __future__ import absolute_import
2+
3+
from . import username, emails, domain, ip, domainOsint, emailOsint, ipOsint, usernameOsint, datasploit
4+
5+
__all__ = ["username", "emails", "domain", "ip", "domainOsint", "emailOsint", "ipOsint", "usernameOsint", "datasploit"]
6+
__title__ = 'datasploit'
7+
__version__ = '1.0'
8+
__author__ = 'Shubham Mittal, Sudhanshu Chauhan, Kunal Aggarwal'
9+
__license__ = 'GPL-3.0'
10+
11+
del absolute_import

domain/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
from os.path import dirname, basename, isfile
2-
import glob
1+
from os.path import dirname, basename, isfile, abspath
2+
import glob, importlib, sys
33

44
modules = glob.glob(dirname(__file__) + "/domain_*.py")
55
__all__ = [basename(f)[:-3] for f in modules if isfile(f)]
6+
sys.path.append(dirname(abspath(__file__)))
7+
8+
for m in __all__:
9+
__import__(m, locals(), globals())
10+
del m, f, dirname, basename, isfile, abspath, glob, importlib, sys, modules

emails/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
from os.path import dirname, basename, isfile
2-
import glob
1+
from os.path import dirname, basename, isfile, abspath
2+
import glob, importlib, sys
33

44
modules = glob.glob(dirname(__file__) + "/email_*.py")
55
__all__ = [basename(f)[:-3] for f in modules if isfile(f)]
6+
sys.path.append(dirname(abspath(__file__)))
7+
8+
for m in __all__:
9+
__import__(m, locals(), globals())
10+
del m, f, dirname, basename, isfile, abspath, glob, importlib, sys, modules

ip/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
from os.path import dirname, basename, isfile
2-
import glob
1+
from os.path import dirname, basename, isfile, abspath
2+
import glob, importlib, sys
33

44
modules = glob.glob(dirname(__file__) + "/ip_*.py")
55
__all__ = [basename(f)[:-3] for f in modules if isfile(f)]
6+
sys.path.append(dirname(abspath(__file__)))
7+
8+
for m in __all__:
9+
__import__(m, locals(), globals())
10+
del m, f, dirname, basename, isfile, abspath, glob, importlib, sys, modules

ip/ip_virustotal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
# Control whether the module is enabled or not
1111
ENABLED = True
12-
api = cfg.virustotal_public_api
1312

1413
class style:
1514
BOLD = '\033[1m'
@@ -24,6 +23,7 @@ def banner():
2423
def main(ip):
2524
# Use the ip variable to do some stuff and return the data
2625
print ip
26+
api = cfg.virustotal_public_api
2727
params = "{'ip': '%s', 'apikey': '%s'}" % (ip, api)
2828
url = "http://www.virustotal.com/vtapi/v2/ip-address/report?ip=%s&apikey=%s" % (ip, api)
2929
req = requests.get(url, params)

osint_runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66

77
def run(component, module_dir, m_input):
8-
dir_path = os.path.abspath(module_dir)
8+
dir_path = "%s/%s" % (os.path.dirname(os.path.abspath(__file__)), module_dir)
99
sys.path.insert(0, dir_path)
10-
domain_files = glob("%s/%s_*.py" % (module_dir, component))
10+
domain_files = glob("%s/%s_*.py" % (dir_path, component))
1111
active_modules = []
1212
for index, i in enumerate(domain_files):
1313
module_name = os.path.basename(os.path.splitext(i)[0])

username/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
from os.path import dirname, basename, isfile
2-
import glob
1+
from os.path import dirname, basename, isfile, abspath
2+
import glob, importlib, sys
33

44
modules = glob.glob(dirname(__file__) + "/username_*.py")
55
__all__ = [basename(f)[:-3] for f in modules if isfile(f)]
6+
sys.path.append(dirname(abspath(__file__)))
7+
8+
for m in __all__:
9+
__import__(m, locals(), globals())
10+
del m, f, dirname, basename, isfile, abspath, glob, importlib, sys, modules

0 commit comments

Comments
 (0)