Created
April 22, 2014 22:09
-
-
Save zakird/11196131 to your computer and use it in GitHub Desktop.
This file contains 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
import sys | |
from cymru import CymruIPtoASNService | |
a = CymruIPtoASNService() | |
queries = [] | |
with open(sys.argv[1]) as fd: | |
i = 0 | |
for l in fd: | |
ip = l.lstrip().rstrip() | |
queries.append(ip) | |
i += 1 | |
if i > 100: | |
for r in a.query(queries): | |
print r.as_number, r.country, r.as_name, r.bgp_prefix, r.ip_address | |
i = 0 | |
queries = [] | |
a = CymruIPtoASNService() | |
for r in a.query(queries): | |
print r.as_number, r.country, r.as_name, r.bgp_prefix, r.ip_address |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment