Created
February 10, 2020 02:39
-
-
Save macostag/686fbd09d1283b81071a5bf6625574d4 to your computer and use it in GitHub Desktop.
Shodan network block enumeration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from shodan import Shodan | |
import ipaddress | |
import pprint | |
import json | |
pp = pprint.PrettyPrinter(indent=2) | |
api = Shodan('') | |
net = ipaddress.ip_network('') | |
for xIp in net.hosts(): | |
try: | |
print(xIp) | |
ipinfo = api.host(str(xIp)) | |
pp.pprint(ipinfo) | |
with open('ip_network.json', 'a') as fp: | |
json.dump(ipinfo, fp) | |
except: | |
pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment