ASNinformer -- a lightweight tool that takes IPs as input, looks up their ASN information, and groups results by ASN in a JSON file.
ASNinformer is a simple Python script that takes IP addresses as
input, queries their ASN (Autonomous System Number) information via
ip2asn.ipinfo.app, groups IPs by ASN, and saves the results as a JSON
file.
It is designed to work with stdin (piping) or direct command-line arguments.
- Accepts IPs from:
- Standard input (
stdin) - Command-line arguments\
- Standard input (
- Automatically groups IPs by ASN\
- Saves results in JSON format\
- Optional verbose output\
- Optional proxy support\
- Uses a simple regex-based IPv4 validator
Clone the repository:
git clone https://github.com/NakuTenshi/ASNinformer.git
cd ASNinformerMake the script executable:
chmod +x ASNinformer.pythen install the script:
sudo ./installecho 1.1.1.1 | ASNinformercat ips.txt | ASNinformerExample ips.txt:
1.1.1.1
8.8.8.8
9.9.9.9
ASNinformer 1.1.1.1ASNinformer 1.1.1.1 8.8.8.8| Flag | Description |
|---|---|
-p, --proxy |
Use an HTTP/HTTPS proxy |
-v |
Print detailed ASN results to the terminal |
-o |
Output file name (default: ./asn-result.txt) |
echo 8.8.8.8 | ASNinformer -o results.jsonecho 8.8.8.8 | ASNinformer -p http://127.0.0.1:8080echo 1.1.1.1 | ASNinformer -vThe script outputs a JSON file structured like this:
{
"AS15169": {
"ASN": "AS15169",
"ASN url": "https://bgp.he.net/AS15169",
"CIDR": "8.8.8.0/24",
"company's name": "Google LLC",
"IPs": [
"8.8.8.8"
]
}
}Each ASN entry contains: - ASN number\
- Link to BGP info (
bgp.he.net)\ - Announced CIDR\
- Company name\
- List of IPs belonging to that ASN (that given as input to code)
created by: NakuTenshi