-
Notifications
You must be signed in to change notification settings - Fork 1
/
hunter-shodan
76 lines (65 loc) · 2.02 KB
/
hunter-shodan
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import shodan
import sys
import os
def logo():
os.system("clear")
print("""
__ __ __
/ / / /_ ______ / /____ _____
/ /_/ / / / / __ \/ __/ _ \/ ___/
/ __ / /_/ / / / / /_/ __/ /
/_/ /_/\__,_/_/ /_/\__/\___/_/
_____ __ __
/ ___// /_ ____ ____/ /___ _____
\__ \/ __ \/ __ \/ __ / __ `/ __ \
___/ / / / / /_/ / /_/ / /_/ / / / /
/____/_/ /_/\____/\__,_/\__,_/_/ /_/
""")
def usage():
logo()
print("""
-----------------
:::::::TYPE::::::
-----------------
hunter-shodan full_addr -->> Get Information with IP Address
hunter-shodan half_addr -->> Get Information of IP Address only
""")
def ip_search():
Api_Key=str(input("Enter Your Own Shodan API Key: "))
List_Search=str(input("Enter What You Want To Search On Shodan: "))
api = shodan.Shodan(Api_Key)
try:
results = api.search(List_Search)
print ("Found Your Search: %s" %results['total'])
for result in results['matches']:
print ("IP Found: %s" %result['ip_str'])
print (result['data'])
print ("")
except shodan.APIERROR as e:
print ("Error Occured :: %s" %e)
def api_search():
Api_Key=str(input("Enter Your Own Shodan API Key: "))
List_Search=str(input("Enter What You Want To Search On Shodan: "))
api = shodan.Shodan(Api_Key)
try:
results = api.search(List_Search)
for result in results['matches']:
print ("%s" %result['ip_str'])
except:
print ("Occured Error :: %s" % e)
def main() :
arg = sys.argv[1:]
if len(arg)!=1:
usage()
elif sys.argv[1] == "full_addr":
logo()
api_search()
elif sys.argv[1] == "half_addr":
logo()
ip_search()
else:
usage()
if __name__ == '__main__' :
main()