23 April 2011

Querying ASNs with Netcat

You can query for the ASNs of thousands of IP addresses at once
using netcat. Netcat is available for Linux and Windows systems.
You can install it on your Ubuntu system by running apt-get install
netcat or you can download the Windows version. To use this method,
create a text file containing the IPs you want to query in the following
format:

begin origin
a.b.c.d
a.b.b.c
d.e.f.g
d.b.a.d
b.e.e.f
end

If you saved this file as ip.txt, you can now run the following:

$ nc asn.shadowserver.org 43 < ip.txt > asn.txt

This will save all of the output for each of the IP addresses to the
file asn.txt. You can visit the Shadowserver IP/BGP Whois Service
page or the Team Cymru IP to ASN Mapping page for additional
information on the services.


See Also:


Malware Analyst's Cookbook and DVD: Tools and Techniques for Fighting Malicious Code



(0) http://joncraton.org/files/nc111nt.zip
(1) http://www.team-cymru.org/Services/ip-to-asn.html
(2) http://www.shadowserver.org/wiki/pmwiki.php/Services/IP-BGP


biOos

No comments: