0xc0da / cymru-asnmap Goto Github PK
View Code? Open in Web Editor NEWBulk IP to ASN submission to the Team Cymru Whois server. More info: http://www.team-cymru.org/IP-ASN-mapping.html
License: BSD 3-Clause "New" or "Revised" License
Bulk IP to ASN submission to the Team Cymru Whois server. More info: http://www.team-cymru.org/IP-ASN-mapping.html
License: BSD 3-Clause "New" or "Revised" License
Since Python 2.7 and 3.5 are deprecated, the wrapper script breaks in some obvious and some less obvious places. If nothing else I wanted to share this in the hopes of saving you (or others who use this wrapper) some debugging time:
The obvious:
print statements print x
statements need to be replaced with print(x)
The not so obvious:
The actual cymru WHOIS query requires that the data passed in be a bytearray, and returns the bulk query results as a bytearray.
In current versions of Python this means the code breaks when passing in a .txt file (using the -f option).
However, the csv.writer module (used in the to_csv() function) is no longer compatible with bytes arrays; csv.writer() now only supports iterables of strings or numbers. (See https://docs.python.org/3/library/csv.html#writer-objects)
These both result in TypeErrors:
Unable to proceed Error: a bytes-like object is required, not 'str'
Queries take an averange of 1m30 to complete. With netcat, the average time is less than 1s.
Example:
$ time python cymru-asnmap.py <redacted>
real 1m21.474s
user 0m0.040s
sys 0m0.012s
$ time netcat whois.cymru.com 43 < ips.txt | sort -n > list02
real 0m0.299s
user 0m0.000s
sys 0m0.008s
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.