-
Notifications
You must be signed in to change notification settings - Fork 9
/
search-shodan
executable file
·49 lines (36 loc) · 1.16 KB
/
search-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
#!/usr/bin/python3
import shodan
import argparse
__authors__ = [ "Brian Laskowski" ]
__date__ = "11-8-18"
__description__ = "Script to check against Shodan"
SHODAN_API_KEY = "Put your api key here"
parser = argparse.ArgumentParser(
description=__description__,
epilog="Developed by {} on {}".format(", ".join(__authors__), __date__)
)
api = shodan.Shodan(SHODAN_API_KEY)
header = "================================================================================"
#Arguments
parser.add_argument("-i","--ip",help="IP to check in Shodan")
args = parser.parse_args()
# Lookup the host
if args.ip:
try:
host = api.host(args.ip)
# Print general info
print(header)
print("""
IP: {}
Organization: {}
Operating System: {}
""".format(host['ip_str'], host.get('org', 'n/a'), host.get('os', 'n/a')))
# Print all banners
for item in host['data']:
print("""
Port: {}
Banner: {}
""".format(item['port'], item['data']))
print(header)
except:
print("\nNo information available for that IP\n")