Skip to content

Commit

Permalink
Added vault
Browse files Browse the repository at this point in the history
  • Loading branch information
Chan9390 committed Dec 18, 2017
1 parent 5a3132d commit fca270f
Show file tree
Hide file tree
Showing 26 changed files with 117 additions and 75 deletions.
2 changes: 1 addition & 1 deletion config_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
twitter_consumer_key=""
twitter_consumer_secret=""
twitter_access_token = ""
twiter_access_token_secret = ""
twitter_access_token_secret = ""
zoomeyeuser = ""
zoomeyepass = ""
clearbit_apikey = ""
Expand Down
13 changes: 9 additions & 4 deletions domain/domain_censys.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import base
import re, sys, json, time, requests
import config as cfg
import vault
from termcolor import colored


Expand All @@ -13,7 +13,7 @@ class style:

def check_api_keys():
try:
if cfg.censysio_id != "" and cfg.censysio_id != "XYZ" and cfg.censysio_secret != "" and cfg.censysio_secret != "XYZ":
if vault.get_key('censysio_id') != None and vault.get_key('censysio_secret') != None:
return True
else:
return False
Expand All @@ -26,12 +26,15 @@ def censys_search(domain):
pages = float('inf')
page = 1

censysio_id = vault.get_key('censysio_id')
censysio_secret = vault.get_key('censysio_secret')

while page <= pages:
print "Parsed and collected results from page %s" % (str(page))
#time.sleep(0.5)
params = {'query': domain, 'page': page}
res = requests.post("https://www.censys.io/api/v1/search/ipv4", json=params,
auth=(cfg.censysio_id, cfg.censysio_secret))
auth=(censysio_id, censysio_secret))
payload = res.json()

if 'error' not in payload.keys():
Expand Down Expand Up @@ -62,8 +65,10 @@ def censys_search(domain):


def view(server, temp_dict):
censysio_id = vault.get_key('censysio_id')
censysio_secret = vault.get_key('censysio_secret')
res = requests.get("https://www.censys.io/api/v1/view/ipv4/%s" % (server),
auth=(cfg.censysio_id, cfg.censysio_secret))
auth=(censysio_id, censysio_secret))
payload = res.json()

try:
Expand Down
7 changes: 4 additions & 3 deletions domain/domain_emailhunter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import base
import config as cfg
import vault
import requests
import json
import sys
Expand All @@ -19,7 +19,8 @@ class style:
def emailhunter(domain):
collected_emails = []
time.sleep(0.3)
url = "https://api.emailhunter.co/v1/search?api_key=%s&domain=%s" % (cfg.emailhunter, domain)
emailhunter_api = vault.get_key('emailhunter')
url = "https://api.emailhunter.co/v1/search?api_key=%s&domain=%s" % (emailhunter_api, domain)
res = requests.get(url)
try:
parsed = json.loads(res.text)
Expand All @@ -38,7 +39,7 @@ def banner():


def main(domain):
if cfg.emailhunter != "":
if vault.get_key('emailhunter') != None:
return emailhunter(domain)
else:
return [False, "INVALID_API"]
Expand Down
9 changes: 5 additions & 4 deletions domain/domain_github.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import base
import config as cfg
import vault
import sys
import json
import requests
Expand All @@ -16,7 +16,8 @@ class style:


def github_search(query):
endpoint_git = "https://api.github.com/search/code?q=\"%s\"&access_token=%s" % (query, cfg.github_access_token)
github_access_token = vault.get_key('github_access_token')
endpoint_git = "https://api.github.com/search/code?q=\"%s\"&access_token=%s" % (query, github_access_token)
req = requests.get(endpoint_git)
data = json.loads(req.content)
return data.get('total_count'), data.get('items')
Expand All @@ -27,9 +28,9 @@ def banner():


def main(domain):
if cfg.github_access_token != "":
if vault.get_key('github_access_token') != None:
count, results = github_search(domain)
return [count, results]
return [count, results]
else:
return [False, "INVALID_API"]

Expand Down
7 changes: 3 additions & 4 deletions domain/domain_googletracking.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/usr/bin/env python

import base
import config as cfg
import vault
import re
import requests
import sys
from config import spyonweb_access_token
from termcolor import colored

ENABLED = True
Expand Down Expand Up @@ -70,7 +69,7 @@ def extract_tracking_codes(domain):

def spyonweb_request(data,request_type="domain"):
params = {}
params['access_token'] = spyonweb_access_token
params['access_token'] = vault.get_key('spyonweb_access_token')
response = requests.get('https://api.spyonweb.com/v1/' +
request_type + '/' + data, params=params)
if response.status_code == 200:
Expand Down Expand Up @@ -102,7 +101,7 @@ def spyonweb_analytics_codes(connections):


def main(domain):
if spyonweb_access_token != "XYZ" and spyonweb_access_token != "":
if vault.get_key('spyonweb_access_token') != None:
connections = extract_tracking_codes(domain)
if 'err' in connections:
return [ connections ]
Expand Down
10 changes: 6 additions & 4 deletions domain/domain_pastes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import base
import config as cfg
import vault
import requests
import json
import sys
Expand Down Expand Up @@ -36,8 +36,10 @@ def colorize(string):


def google_search(domain):
google_cse_key = vault.get_key('google_cse_key')
google_cse_cx = vault.get_key('google_cse_cx')
url = "https://www.googleapis.com/customsearch/v1?key=%s&cx=%s&q=\"%s\"&start=1" % (
cfg.google_cse_key, cfg.google_cse_cx, domain)
google_cse_key, google_cse_cx, domain)
all_results = []
r = requests.get(url, headers={'referer': 'www.datasploit.info/hello'})
data = json.loads(r.content)
Expand All @@ -48,7 +50,7 @@ def google_search(domain):
while "nextPage" in data['queries']:
next_index = data['queries']['nextPage'][0]['startIndex']
url = "https://www.googleapis.com/customsearch/v1?key=%s&cx=%s&q=\"%s\"&start=%s" % (
cfg.google_cse_key, cfg.google_cse_cx, domain, next_index)
google_cse_key, google_cse_cx, domain, next_index)
data = json.loads(requests.get(url).content)
if 'error' in data:
return True, all_results
Expand All @@ -62,7 +64,7 @@ def banner():


def main(domain):
if cfg.google_cse_key != "" and cfg.google_cse_key != "XYZ" and cfg.google_cse_cx != "" and cfg.google_cse_cx != "XYZ":
if vault.get_key('google_cse_key') != None and vault.get_key('google_cse_cx') != None:
status, data = google_search(domain)
return [status, data]
else:
Expand Down
6 changes: 3 additions & 3 deletions domain/domain_shodan.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import base
import config as cfg
import vault
import requests
import json
import sys
Expand All @@ -19,7 +19,7 @@ class style:
def shodandomainsearch(domain):
time.sleep(0.3)
endpoint = "https://api.shodan.io/shodan/host/search?key=%s&query=hostname:%s&facets={facets}" % (
cfg.shodan_api, domain)
vault.get_key('shodan_api'), domain)
req = requests.get(endpoint)
return req.content

Expand All @@ -29,7 +29,7 @@ def banner():


def main(domain):
if cfg.shodan_api != "":
if vault.get_key('shodan_api') != None:
return json.loads(shodandomainsearch(domain))
else:
return [False, "INVALID_API"]
Expand Down
9 changes: 4 additions & 5 deletions domain/domain_zoomeye.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import requests
import json
import sys
import config as cfg
import vault
from termcolor import colored
import time

Expand All @@ -17,8 +17,8 @@ class style:


def get_accesstoken_zoomeye(domain):
username = cfg.zoomeyeuser
password = cfg.zoomeyepass
username = vault.get_key('zoomeyeuser')
password = vault.get_key('zoomeyepass')
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
datalogin = '{"username": "%s","password": "%s"}' % (username, password)
s = requests.post("https://api.zoomeye.org/user/login", data=datalogin, headers=headers)
Expand All @@ -44,7 +44,7 @@ def banner():


def main(domain):
if cfg.zoomeyepass != "" and cfg.zoomeyeuser != "":
if vault.get_key('zoomeyepass') != "" and vault.get_key('zoomeyeuser') != "":
zoomeye_results = search_zoomeye(domain)
if zoomeye_results[0]:
return True, json.loads(zoomeye_results)
Expand Down Expand Up @@ -81,4 +81,3 @@ def output(data, domain=""):
result = main(domain)
if result:
output(result, domain)

2 changes: 1 addition & 1 deletion domain/template.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import base
import config as cfg
import vault
import sys

# Control whether the module is enabled or not
Expand Down
7 changes: 4 additions & 3 deletions emails/email_basic_checks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import base
import config as cfg
import vault
import requests
import json
import sys
Expand All @@ -18,8 +18,9 @@ class style:

def basic_checks(email):
if re.match('[^@]+@[^@]+\.[^@]+', email):
if cfg.mailboxlayer_api != "" and cfg.mailboxlayer_api != "XYZ" and cfg.mailboxlayer_api != "" and cfg.mailboxlayer_api != "XYZ":
url = "http://apilayer.net/api/check?access_key=%s&email=%s&smtp=1&format=1" % (cfg.mailboxlayer_api, email)
mailboxlayer_api = vault.get_key('mailboxlayer_api')
if vault.get_key('mailboxlayer_api') != None:
url = "http://apilayer.net/api/check?access_key=%s&email=%s&smtp=1&format=1" % (mailboxlayer_api, email)
req = requests.get(url)
resp = json.loads(req.text)
return resp
Expand Down
7 changes: 4 additions & 3 deletions emails/email_clearbit.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import base
import config as cfg
import vault
import sys
import requests
import json
Expand All @@ -21,8 +21,9 @@ def banner():


def main(email):
if cfg.clearbit_apikey != "":
headers = {"Authorization": "Bearer %s" % cfg.clearbit_apikey}
clearbit_apikey = vault.get_key('clearbit_apikey')
if clearbit_apikey != None:
headers = {"Authorization": "Bearer %s" % clearbit_apikey}
req = requests.get("https://person.clearbit.com/v1/people/email/%s" % (email), headers=headers)
person_details = json.loads(req.content)
if "error" in req.content and "queued" in req.content:
Expand Down
7 changes: 4 additions & 3 deletions emails/email_fullcontact.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import base
import requests
import sys
import config as cfg
import vault
import json
from termcolor import colored

Expand All @@ -16,9 +16,10 @@ class style:


def main(email):
if cfg.fullcontact_api != "":
fullcontact_api = vault.get_key('fullcontact_api')
if fullcontact_api != None:
req = requests.get("https://api.fullcontact.com/v2/person.json?email=%s" % email,
headers={"X-FullContact-APIKey": cfg.fullcontact_api})
headers={"X-FullContact-APIKey": fullcontact_api})
data = json.loads(req.content)
return data
else:
Expand Down
1 change: 0 additions & 1 deletion emails/email_haveibeenpwned.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python

import base
import config as cfg
import sys
import requests
import json
Expand Down
21 changes: 10 additions & 11 deletions emails/email_pastes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import base
import config as cfg
import vault
import requests
import json
import sys
Expand Down Expand Up @@ -36,8 +36,10 @@ def colorize(string):


def google_search(email):
google_cse_key = vault.get_key('google_cse_key')
google_cse_cx = vault.get_key('google_cse_cx')
url = "https://www.googleapis.com/customsearch/v1?key=%s&cx=%s&q=\"%s\"&start=1" % (
cfg.google_cse_key, cfg.google_cse_cx, email)
google_cse_key, google_cse_cx, email)
all_results = []
r = requests.get(url, headers={'referer': 'www.datasploit.info/hello'})
data = json.loads(r.content)
Expand All @@ -48,7 +50,7 @@ def google_search(email):
while "nextPage" in data['queries']:
next_index = data['queries']['nextPage'][0]['startIndex']
url = "https://www.googleapis.com/customsearch/v1?key=%s&cx=%s&q=\"%s\"&start=%s" % (
cfg.google_cse_key, cfg.google_cse_cx, email, next_index)
google_cse_key, google_cse_cx, email, next_index)
data = json.loads(requests.get(url).content)
if 'error' in data:
return True, all_results
Expand All @@ -62,14 +64,11 @@ def banner():


def main(email):
try:
if cfg.google_cse_key != "" and cfg.google_cse_key != "XYZ" and cfg.google_cse_cx != "" and cfg.google_cse_cx != "XYZ":
status, data = google_search(email)
return [status, data]
else:
return False, "INVALID_API"
except:
return False, "INVALID_API"
if vault.get_key('google_cse_key') != None and vault.get_key('google_cse_cx') != None:
status, data = google_search(email)
return [status, data]
else:
return [False, "INVALID_API"]


def output(data, email):
Expand Down
2 changes: 1 addition & 1 deletion emails/template.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import base
import config as cfg
import vault
import sys

# Control whether the module is enabled or not
Expand Down
Loading

0 comments on commit fca270f

Please sign in to comment.