ASN Tool

Lookup the AS (autonomous system) name, number and netblocks associated with an IP address or ASN, and generate blocklists by ASN.


You can jump directly to the data with:<ip|asn>


Why do I need to update the blocklist periodically?

Netblocks can be added or removed from autonomous systems at any time.

How do I rollback the iptables blocks?

Something like this (use at your own risk): iptables-save | grep -v "ASNTool" | iptables-restore

Where does this ASN data come from?

I would tell you my source (which I came across by pure luck), but I'm afraid the more people who know about it, the more likely it is to dry up. I do not know why AS data is such a closely guarded secret. I hate how it only seems to be accessible through middlemen (at a price). That's why I created this.

The netblocks sometimes don't match up with other sources.

That's because I combine adjacent netblocks where possible.

Give me the raw data!

I'm not sure how long I can offer it before the bandwidth is cost prohibitive, but here it is: data.tsv.gz.

Format is: subnet low address (as an integer), subnet high address (as an integer), netblock string, ASN, AS name.

To find the ASN given a source IP, convert the IP to an integer, and find the rightmost (largest) low address (i.e. the first column) less than or equal to the source IP. Then ensure the source IP is between (inclusive) of the low/high address. The Python bisect module and find_le function is useful for this.

Is there an API?

I won't stop you from making automated HTTP requests (if you keep it to a reasonable level). Put your email address in the HTTP user agent so I can contact you.

What are the rate limits?

1 request per second. Exceeding the limit is undefined behavior.

Where does the list of common DDoS hosts come from?

I generated it from an attack on my own website in December of 2022. If you know of a better source, email me.

What about IPv6?

I'm holding out for IPv7.

How do you make money on this?

I don't. It is provided to you out of the goodness of my heart.

Can I contact you?

I'll allow it. rumpelstiltskin at this domain.

Last AS data update: Mon, 15 Apr 2024 03:33:34 GMT

No shoes, no shirt, no script? No problem!