forked from dvopsway/datasploit
-
Notifications
You must be signed in to change notification settings - Fork 434
/
Copy pathemail_clearbit.py
executable file
·62 lines (49 loc) · 1.85 KB
/
email_clearbit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python
import base
import config as cfg
import sys
import requests
import json
from termcolor import colored
# Control whether the module is enabled or not
ENABLED = False
class style:
BOLD = '\033[1m'
END = '\033[0m'
def banner():
print colored(style.BOLD + '\n---> Searching Clearbit\n' + style.END, 'blue')
def main(email):
if cfg.clearbit_apikey != "":
headers = {"Authorization": "Bearer %s" % cfg.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:
print "This might take some more time, Please run this script again, after 5 minutes."
else:
return person_details
else:
return [False, "INVALID_API"]
def output(data, email=""):
print data
if type(data) == list and data[1] == "INVALID_API":
print colored(
style.BOLD + '\n[-] Clearbit API Key not configured. Skipping Clearbit Search.\nPlease refer to https://datasploit.readthedocs.io/en/latest/apiGeneration/.\n' + style.END, 'red')
else:
for x in data.keys():
print '%s details:' % x
if type(data[x]) == dict:
for y in data[x].keys():
if data[x][y] is not None:
print "%s: %s, " % (y, data[x][y])
elif data[x] is not None:
print "\n%s: %s" % (x, data[x])
print "\n-----------------------------\n"
if __name__ == "__main__":
try:
email = sys.argv[1]
banner()
result = main(email)
output(result, email)
except Exception as e:
print e
print "Please provide an email as argument"