forked from m4ll0k/BBTz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
whoxy.py
57 lines (46 loc) · 1.26 KB
/
whoxy.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
#!/usr/bin/python
# github.com/m4ll0k (@m4ll0k2)
# Bug Bounty Toolz - whoxy.py
# whoxy.py - Whoxy Reverse Whois
import sys
import requests
import json
API_KEY = ""
if API_KEY is "":
sys.exit(print('Please set whoxy api_key!!'))
def getWhoxyContent(keyword):
try:
req = requests.get(
'http://api.whoxy.com/?key={API_KEY}&reverse=whois&name={keyword}&mode=mini'.format(
keyword = keyword,API_KEY = API_KEY
)
)
return json.loads(req.content.decode('utf-8'))
except Exception as _except:
print('[ + ] %s'%str(_except))
def __usage__(_=True):
print('\nUsage:\n')
print('\tpython3 %s <keyword_1;keyword_2;..>'%(sys.argv[0]))
print('\tcat keywords.txt | python3 %s'%sys.argv[0])
if _:
sys.exit(0)
def __main__(keyword):
jsoned = getWhoxyContent(keyword)
if jsoned.get('search_result'):
for i in range(len(jsoned.get('search_result'))):
domain = jsoned.get('search_result')[i]['domain_name']
print(domain)
stdin = False
if __name__ == "__main__":
if len(sys.argv) > 1 and len(sys.argv) < 3:
for keyword in sys.argv[1].split(';'):
__main__(keyword)
else:
for line in sys.stdin.readlines():
stdin = True
line = line.strip()
if line == '\n':
__usage__()
__main__(line)
if len(sys.argv) == 1 and stdin is False:
__usage__()