Git Product home page Git Product logo

nitefood / asn Goto Github PK

View Code? Open in Web Editor NEW
1.2K 33.0 151.0 512 KB

ASN / RPKI validity / BGP stats / IPv4v6 / Prefix / URL / ASPath / Organization / IP reputation / IP geolocation / IP fingerprinting / Network recon / lookup API server / Web traceroute server

License: MIT License

Shell 99.58% Dockerfile 0.42%
asn asn-lookup autonomous-systems ip-lookup team-cymru as-path mtr traceroute osint incident-response

asn's People

Contributors

33fraise33 avatar agru avatar aorith avatar arthur4ires avatar filippovitale avatar nitefood avatar odaydebian avatar robert-scheck avatar worty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asn's Issues

AS 45609 - parse error: Invalid numeric literal at line 1, column 7

This ASN has a large number of prefixes and I'm trying to get a list of just the IPv6's.
When I add an IP Reputation token, it's still running for over 30 mins on a 50 Mbit FTTH uplink.

$ asn 45609

────────────────────────────────────────────────────────────
			WARNING 

No IPQualityScore token found, so disabling in-depth threat 
analysis and IP reputation lookups. Please visit 
https://github.com/nitefood/asn#ip-reputation-api-token 
for instructions on how to enable it. 
────────────────────────────────────────────────────────────

╭──────────────────────╮
│ ASN lookup for 45609 │
╰──────────────────────╯

 AS Number     ──> 45609
 AS Name       ──> BHARTI-MOBILITY-AS-AP Bharti Airtel Ltd. AS for GPRS Service, IN
 Organization  ──> Bharti Airtel Limited
 AS Reg. date  ──> 2017-08-10 02:29:43
 Peering @IXPs ──>  NONE 


╭─────────────────────────────────────────────────────────────────────────────────────────────────╮
│ BGP informations for AS45609 (BHARTI-MOBILITY-AS-AP Bharti Airtel Ltd. AS for GPRS Service, IN) │
╰─────────────────────────────────────────────────────────────────────────────────────────────────╯

Retrieving BGP data for AS45609 (BHARTI-MOBILITY-AS-AP Bharti Airtel Ltd. AS for GPRS Service, IN) (press CTRL-C to cancel)...parse error: Invalid numeric literal at line 1, column 7
parse error: Invalid numeric literal at line 1, column 7
parse error: Invalid numeric literal at line 1, column 7
Retrieving prefix allocations and announcements for AS45609 (BHARTI-MOBILITY-AS-AP Bharti Airtel Ltd. AS for GPRS Service, IN) (press CTRL-C to cancel)...^CInterrupted by signal 2...

CSV format

It's possible to get output as CSV/Xls ?

IPv4 address retrieval for a specific AS does not work anymore

Launching ./asn 15169 :

...

╭───────────────────────────────────────────╮
│ BGP informations for AS15169 (GOOGLE, US) │
╰───────────────────────────────────────────╯

Retrieving information for IPv4 prefix 0/805 (press CTRL-C to cancel)...host: '....origin.asn.cymru.com' is not a legal name (empty label)
Retrieving information for IPv4 prefix 1/805 (press CTRL-C to cancel)...host: '....origin.asn.cymru.com' is not a legal name (empty label)
Retrieving information for IPv4 prefix 2/805 (press CTRL-C to cancel)...host: '....origin.asn.cymru.com' is not a legal name (empty label)
Retrieving information for IPv4 prefix 3/805 (press CTRL-C to cancel)...host: '....origin.asn.cymru.com' is not a legal name (empty label)
Retrieving information for IPv4 prefix 4/805 (press CTRL-C to cancel)...host: '....origin.asn.cymru.com' is not a legal name (empty label)
Retrieving information for IPv4 prefix 5/805 (press CTRL-C to cancel)...host: '....origin.asn.cymru.com' is not a legal name (empty label)
Retrieving information for IPv4 prefix 6/805 (press CTRL-C to cancel)...host: '....origin.asn.cymru.com' is not a legal name (empty label)
Retrieving information for IPv4 prefix 7/805 (press CTRL-C to cancel)...host: '....origin.asn.cymru.com' is not a legal name (empty label)
...

Final print : 

...
───── IPv4 ─────

NONE

───── IPv6 ─────

2001:4860::/32
2404:6800::/32
2404:f340::/32
2606:73c0::/32
2607:f8b0::/32
2620:120:e000::/40
2800:3f0::/32
2a00:1450::/29
2a00:79e0::/31
2c0f:fb50::/32


Some flags aren't being pulled in from cdnjs

This ASN lookup string broke the pulling of a flag.

LINODE-AP Linode, LLC, US

I'm guessing the code grabs the second field in a comma separated list, as it attempted to grab llc.svg

We should probably grab the last item in the list.

I'll take a closer look when I have some time.

Hangs at `Analyzing collected trace output to …`

Today, asn hung at analyzing collected trace output.

$ git log --oneline --no-decorate -1
23b2d39 Minor tweaks
────────────────────────────────────────────────────────────
			WARNING 

No IPQualityScore token found, so disabling in-depth threat 
analysis and IP reputation lookups. Please visit 
https://github.com/nitefood/asn#ip-reputation-api-token 
for instructions on how to enable it. 
────────────────────────────────────────────────────────────

╭─────────────────────────────────╮
│ ASN lookup for www.tu-berlin.de │
╰─────────────────────────────────╯

- Resolving "www.tu-berlin.de"... 1 IP address found:

                                                                                                                                                      
 130.149.7.201 ┌PTR www.tu-berlin.de
               ├ASN 680 (DFN Verein zur Foerderung eines Deutschen Forschungsnetzes e.V., DE)
               ├ORG DFN
               ├NET 130.149.0.0/16 (TUB)
               ├ABU [email protected]
               ├ROA ✓ UNKNOWN (no ROAs found)
               ├GEO Berlin, Berlin (DE)
               └REP ✓ NONE


╭───────────────────────────╮
│ Trace to www.tu-berlin.de │
╰───────────────────────────╯

 Hop IP Address                                                                               Loss%      Ping avg     AS Information                  
  1. 10.31.96.1                                                                                  0%        2.7 ms    BOGON  rfc1918 (Private Space)   
  2. 10.31.251.254                                                                               0%        2.5 ms    BOGON  rfc1918 (Private Space)   
  3. 141.42.5.254                                                                                0%        2.7 ms   [AS680] DFN Verein zur Foerderung eines Deutschen Forschungsnetzes e.V., DE
  4. rouxwin-tg-3.charite.de (193.175.73.2)                                                      0%       15.2 ms   [AS680] DFN Verein zur Foerderung eines Deutschen Forschungsnetzes e.V., DE
  5. roubrain-tg-3.charite.de (193.175.73.3)                                                     0%        3.4 ms   [AS680] DFN Verein zur Foerderung eines Deutschen Forschungsnetzes e.V., DE
Analyzing collected trace output to 130.149.7.201 (press CTRL-C to cancel)...^C                                                                       
Interrupted

I had to cancel it with Ctrl + c.

$ mtr -s 10 -r -c 10 www.tu-berlin.de
Start: 2022-03-29T09:29:06+0200
HOST: ersatz                      Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- _gateway                   0.0%    10   62.4   8.3   1.8  62.4  19.0
  2.|-- 10.31.251.254              0.0%    10    2.0   2.0   1.8   3.2   0.4
  3.|-- 141.42.5.254               0.0%    10    2.6   2.5   2.1   3.5   0.4
  4.|-- rouxwin-tg-3.charite.de    0.0%    10    2.6   3.0   2.6   3.5   0.3
  5.|-- roubrain-tg-3.charite.de   0.0%    10    3.3   3.1   2.6   3.6   0.3
  6.|-- 192.86.163.97              0.0%    10    3.2   3.1   2.5   3.5   0.3
  7.|-- ???                       100.0    10    0.0   0.0   0.0   0.0   0.0
  8.|-- ???                       100.0    10    0.0   0.0   0.0   0.0   0.0
  9.|-- 130.149.126.189            0.0%    10    3.5   3.7   3.0   6.2   0.9
 10.|-- e-ns-e-n.gate.tu-berlin.d  0.0%    10    4.1   7.2   3.5  33.2   9.2
 11.|-- www.tu-berlin.de           0.0%    10    2.8   3.3   2.8   3.9   0.3
$ traceroute www.tu-berlin.de
traceroute to www.tu-berlin.de (130.149.7.201), 30 hops max, 60 byte packets
 1  _gateway (10.31.96.1)  1.886 ms  2.162 ms  2.556 ms
 2  10.31.251.254 (10.31.251.254)  2.802 ms  3.195 ms  3.180 ms
 3  rouxwin-tg-3.charite.de (193.175.73.2)  5.365 ms  4.705 ms  4.262 ms
 4  roubrain-tg-3.charite.de (193.175.73.3)  5.319 ms  5.305 ms  4.924 ms
 5  192.86.163.97 (192.86.163.97)  5.276 ms  5.669 ms  5.655 ms
 6  * * *
 7  * * *
 8  130.149.126.189 (130.149.126.189)  5.170 ms  5.466 ms  6.123 ms
 9  e-ns-e-n.gate.tu-berlin.de (130.149.126.78)  6.109 ms  6.094 ms  6.080 ms
10  www.tu-berlin.de (130.149.7.201)  6.395 ms  7.051 ms  6.366 ms

Disable Color Output

Please give us an option to disable color output and to get output as JSON. nobody wants those pesky colors in their terminal, those are for kiddos ;)

thanks for the awesome tool!

Installed ipcalc not detected

$ git log --oneline --no-decorate -1
741a5d5 reduced default shodan scanning threads - threads reduced from 20 to 10, Shodan introduced stricter rate limits (and longer cooldown timers)
$ dpkg -l ipcalc
Gewünscht=Unbekannt/Installieren/R=Entfernen/P=Vollständig Löschen/Halten
| Status=Nicht/Installiert/Config/U=Entpackt/halb konFiguriert/
         Halb installiert/Trigger erWartet/Trigger anhängig
|/ Fehler?=(kein)/R=Neuinstallation notwendig (Status, Fehler: GROSS=schlecht)
||/ Name           Version      Architektur  Beschreibung
+++-==============-============-============-=======================================
ii  ipcalc         0.42-2       all          parameter calculator for IPv4 addresses

$ ipcalc --version
0.5
$ ./asn github.com

╭─────────────╮
│ ! WARNING ! │
╰─────────────╯

The following tools were not found on this system:  
 - ipcalc

The following features will be disabled: 
 - CIDR deaggregation (due to incompatible ipcalc version - v0.41+ for Debian-based or v1.0.0+ for RHEL-based required, but you have v0.5)

Please install the necessary prerequisite packages
for your system by following these instructions: 

>> https://github.com/nitefood/asn#prerequisite-packages <<

Press ENTER to continue...
Interrupted

Bulk geolocation incorrect results

Bulk geolocation feature may need some more testing.

It defaults every IP to : Ranong, Ranong, TH (Thailand) here:

$ echo "169.150.243.18 143.244.33.95 143.244.33.79 143.244.33.78 143.244.33.56 169.150.243.20 169.150.243.17" | asn -g

────────────────────────────────────────────────────────────
			WARNING 

No IPQualityScore token found, so disabling in-depth threat 
analysis and IP reputation lookups. Please visit 
https://github.com/nitefood/asn#ip-reputation-api-token 
for instructions on how to enable it. 
────────────────────────────────────────────────────────────

╭─────────────────────────────────────────╮
│ Geolocation lookup for multiple targets │
╰─────────────────────────────────────────╯
143.244.33.56   : Ranong, Ranong, TH (Thailand)                                                                                                                                                                                         
143.244.33.78   : Ranong, Ranong, TH (Thailand) 
143.244.33.79   : Ranong, Ranong, TH (Thailand) 
143.244.33.95   : Ranong, Ranong, TH (Thailand) 
169.150.243.17  : Ranong, Ranong, TH (Thailand) 
169.150.243.18  : Ranong, Ranong, TH (Thailand) 
169.150.243.20  : Ranong, Ranong, TH (Thailand) 

Adding an IPQuality API improves it a bit, but it still mention Ranong:

$ echo "169.150.243.18 143.244.33.95 143.244.33.79 143.244.33.78 143.244.33.56 169.150.243.20 169.150.243.17" | asn -g

╭─────────────────────────────────────────╮
│ Geolocation lookup for multiple targets │
╰─────────────────────────────────────────╯
143.244.33.56   : Singapore, Central Singapore, SG (Singapore)                                                                                                                                                                          
143.244.33.78   : Ranong, Ranong, TH (Thailand) 
143.244.33.79   : Singapore, Central Singapore, SG (Singapore) 
143.244.33.95   : Singapore, Central Singapore, SG (Singapore) 
169.150.243.17  : Singapore, Central Singapore, SG (Singapore) 
169.150.243.18  : Singapore, Central Singapore, SG (Singapore) 
169.150.243.20  : Singapore, Central Singapore, SG (Singapore) 

Similar issue trying with a known list from the UK:

$ echo "84.17.50.99 185.59.221.179 84.17.50.98 89.187.88.237" | asn -g

╭─────────────────────────────────────────╮
│ Geolocation lookup for multiple targets │
╰─────────────────────────────────────────╯
185.59.221.179  : Ranong, Ranong, TH (Thailand)                                                                                                                                                                                         
84.17.50.98     : Ranong, Ranong, TH (Thailand) 
84.17.50.99     : Ranong, Ranong, TH (Thailand) 
89.187.88.237   : London, England, GB (United Kingdom) 

[Feature Request] IPInfo.io for core IP based operation

I work for IPinfo and I appreciate the project featuring IPinfo. I saw that in a ticket you mentioned that you favored no-key access to API. IPinfo does provide no-key access to the API service and a generous limit for that as well. Over your current setup, we have the following to offer:

  • HTTPS/SSL encryption
  • More accurate geolocation data backed by our probe network
  • 1,000 requests per day without a token

Users can also sign up for a free account and get a limit of 50,000 requests per month. If you are looking to add more functionality, you can also check out our free IP to ASN database. Please let me know what you think. Thanks!

Add option to search by (company) name

One option I'm missing is to get results by providing the (company) name. Sometimes you don't even know the full name so you would provide a substring and get all results which contain the substring.

This option is e.g. available here: https://bgpview.io

btw. Thanks for the great tool :)

Cannot iterate over null

When you use it with the -g parameter, it prints the following error, do you know the reason?

jq: error (at :1): Cannot iterate over null (null)

Feature Request: Multi source lookups

I've been using this a bit and I really like it in server mode. Excellent as a looking glass. Nice crisp, colourful output.
And I've discovered aha, which is now my new favourite toy.

I can't help wondering if we could get this to execute on a bunch of remove machines (via ssh and keys) and output the results to the same page, one after the other. A bit like mtr.sh

What are you thoughts?

TERM value is set in headless mode when run with ./asn -l

When listening in server mode, I don't get any output from asn.

[2021-04-11 18:15:45] INFO ASN Lookup Server listening on 192.168.3.21:49200
[2021-04-11 18:15:47] INFO Incoming connection by client 172.18.0.7
[2021-04-11 18:15:47] STARTED Lookup request by client 172.18.0.7 for target github.com (Request ID: 817759845)

────────────────────────────────────────────────────────────
WARNING

No IPQualityScore token found, so disabling in-depth threat
analysis and IP reputation lookups. Please visit
https://github.com/nitefood/asn#ip-reputation-api-token
for instructions on how to enable it.
────────────────────────────────────────────────────────────
./asn: line 1389: $max_msg_size: substring expression < 0
[2021-04-11 18:15:48] COMPLETED Lookup request by client 172.18.0.7 for target github.com (Request ID: 817759845)

Screenshot 2021-04-11 at 18 19 26

./asn: line 1389: $max_msg_size: substring expression < 0

asn/asn

Line 1387 in d280c0a

max_msg_size=$((terminal_width-23))

It looks like terminal_width is 0 at this point and thus max_msg_size = -23

Last AS missing in AS path information

I am using

$ git log --oneline --no-decorate -1
1f794b9 Add installation instructions for RHEL 7 and 8 (#38)

Then:

$ ./asn charite.de

────────────────────────────────────────────────────────────
			WARNING 

No IPQualityScore token found, so disabling in-depth threat 
analysis and IP reputation lookups. Please visit 
https://github.com/nitefood/asn#ip-reputation-api-token 
for instructions on how to enable it. 
────────────────────────────────────────────────────────────

╭───────────────────────────╮
│ ASN lookup for charite.de │
╰───────────────────────────╯

- Resolving "charite.de"... 1 IP address found:

                                                                                
 141.42.206.113 ┌PTR charite.de
                ├ASN 680 (DFN Verein zur Foerderung eines Deutschen Forschungsnetzes e.V., DE)
                ├ORG DFN
                ├NET 141.42.0.0/16 (CHARITE-NET)
                ├ABU [email protected] / [email protected]
                ├ROA ✓ VALID (1 ROA found)
                ├GEO Berlin, Land Berlin (DE)
                ├CPE [APP: php:php] [APP: apache:http_server] [APP: typo3:typo3]
                ├POR Open ports: 80, 443
                └REP ✓ NONE


╭─────────────────────╮
│ Trace to charite.de │
╰─────────────────────╯

 Hop IP Address         Loss%      Ping avg     AS Information                  
  1. o2.box (192.168.1.1)    80%        0.7 ms    BOGON  rfc1918 (Private Space)
  2. loopback1.0002.acln.01.ber.de.net.telefonica.de (62.52.201.185)    80%        6.9 ms   [AS6805] TDDE-ASN1, DE
  3. bundle-ether16.0003.dbrx.01.ber.de.net.telefonica.de (62.53.2.84)    80%        7.0 ms   [AS6805] TDDE-ASN1, DE
  4. ae1-0.0001.prrx.01.ber.de.net.telefonica.de (62.53.11.125)    80%        9.2 ms   [AS6805] TDDE-ASN1, DE
  5. dfn.bcix.de (193.178.185.42)    20%       17.1 ms    IXP  BCIX (Berlin Commercial Internet Exchange)
  6. kr-charit1.x-win.dfn.de (188.1.235.78)    80%       17.2 ms   (WIN-IP / IP networking on DFN's Wissenschaftsnetz "X-WiN")
  7. ???                 100%             *   (No reply)                        
  8. ???                 100%             *   (No reply)                        
  9. ???                 100%             *   (No reply)                        
 10. charite.de (141.42.206.113)    20%       19.3 ms   (CHARITE-NET / Charite - Universitaetsmedizin Berlin)
                                                                                
Trace completed in 37 seconds on 2023-02-20 14:22:40 CET


╭───────────────────────╮
│ AS path to charite.de │
╰───────────────────────╯

  6805   TDDE-ASN1 (Local AS)
 ╭╯
 ╰ IXP   BCIX (Berlin Commercial Internet Exchange)


The AS path information is missing the last AS680. It’s present in the mtr output:

$ mtr -z -s 10 -r -c 10 charite.de
Start: 2023-02-20T14:43:23+0100
HOST: ersatz                      Loss%   Snt   Last   Avg  Best  Wrst StDev
  1. AS???    o2.box              90.0%    10    2.5   2.5   2.5   2.5   0.0
  2. AS???    loopback1.0002.acln 90.0%    10    7.0   7.0   7.0   7.0   0.0
  3. AS???    bundle-ether16.0003 90.0%    10    7.3   7.3   7.3   7.3   0.0
  4. AS6805   ae1-0.0001.prrx.01. 90.0%    10    6.4   6.4   6.4   6.4   0.0
  5. AS???    dfn.bcix.de         10.0%    10   16.7  17.0  16.7  17.7   0.4
  6. AS???    kr-charit1.x-win.df 90.0%    10   17.2  17.2  17.2  17.2   0.0
  7. AS???    ???                 100.0    10    0.0   0.0   0.0   0.0   0.0
  8. AS???    ???                 100.0    10    0.0   0.0   0.0   0.0   0.0
  9. AS???    ???                 100.0    10    0.0   0.0   0.0   0.0   0.0
 10. AS680    charite.de          10.0%    10   19.1  19.0  18.6  19.2   0.2

Not every ipcalc(1) supports '-r'

Not every ipcalc supports -r as it seems, thus I see the following in the output somewhere in the middle while using asn from commit 64e9253:

ipcalc: bad argument -r: unknown option                                                        
Usage: ipcalc [OPTION...]
  -c, --check         Validate IP address for specified address family
  -4, --ipv4          IPv4 address family (default)
  -6, --ipv6          IPv6 address family
  -b, --broadcast     Display calculated broadcast address
  -h, --hostname      Show hostname determined via DNS
  -m, --netmask       Display default netmask for IP (class A, B, or C)
  -n, --network       Display network address
  -p, --prefix        Display network prefix
  -s, --silent        Don't ever display error messages

Help options:
  -?, --help          Show this help message
  --usage             Display brief usage message
$ rpm -qf `which ipcalc`
initscripts-9.49.53-1.el7_9.1.x86_64
$ 

Feature request: Add asn_lookup hyperlink for "Remaining IPs" and formatting changes

Love the new updates. Great idea having added the ability to just click on a hop for a new asn_lookup.

Can we do the same for the remaining IPs that get "ignored"? To avoid ambiguity, in this screenshot 172.217.1.174

asn

While I love this new feature, it does make the hop output a bit busy.
Can we remove the unscores from the hyperlinks and open the links in a new window (style="text-decoration: none;" and target="_blank" or something)?
I'm not sure aha supports that out of the box, so maybe a stylesheet?

My OCD is kicking in now, and the links to APIs seem inconsistent. Currently in the detailed ASN lookup top section we have

WHOIS, host.io and ipinfo.io

Can we change that to

whois, host and ipinfo (and without the chain link icon thing)

I don't mind doing this but as it's really esthetics and not functional, do feel free to tell me to naff off and get a life.

ASN number lookup output hurts my brain at the moment, but it's super rich.
Not sure how much sense it makes to do traceroutes to subnets, but maybe I'm missing something. I will spend more time playing with it soon.

Thanks again for this great tool

[Feature Request] Support IP2Location.io API to Query ASN

I would like to introduce the IP2Location.io IP geolocation API. It has the following advantages compare to other API providers.

  • Fast - one of the fastest API in the market using multi-location servers and Anycast routing
  • Accurate - based on IP2Location and IP2Proxy database which is available since 2002
  • Free - free tier with 30,000 queries monthly available to all users who sign-up online

Please consider IP2Location.io as one of the database source to get ASN. Feel free to ping me if you have any questions. Thank you.

upstream/transit

Each lookup is acknowledged with the error "/usr/bin/asn: line 2770: printf: 32.98889175923534: invalid number"

`asn -u 1.1.1.1

╭────────────────────────╮
│ ASN lookup for 1.1.1.1 │
╰────────────────────────╯

╭───────────────────────────────────────────────────╮
│ Recently observed upstream/transit AS for 1.1.1.1 │
╰───────────────────────────────────────────────────╯

Legend:
██ most likely transit ( very large / Tier 1 upstream AS )
██ very likely transit ( >= 85% BGP updates from this AS )
██ likely transit ( >= 75% BGP updates from this AS )
██ potentially transit ( >= 65% BGP updates from this AS )
██ unlikely transit ( < 65% BGP updates from this AS )

Target : 1.1.1.1 (matching prefix: 1.1.1.0/24)
Origin AS : [AS13335] CLOUDFLARENET, US
CAIDA AS rank: #78 TOP 100 AS

/usr/bin/asn: line 2770: printf: 32.98889175923534: invalid number
██ AS2914 ( 32,00%) - NTT-LTD-2914, US
/usr/bin/asn: line 2770: printf: 31.95556703694136: invalid number
██ AS24482 ( 31,00%) - SGGS-AS-AP SG.GS, SG
/usr/bin/asn: line 2770: printf: 31.077241022991476: invalid number
██ AS1031 ( 31,00%) - PEER-1-INTERNET, US
/usr/bin/asn: line 2770: printf: 0.7491604236631362: invalid number
██ AS7195 ( 0,00%) - EDGEUNO SAS, CO
/usr/bin/asn: line 2770: printf: 0.41332988891759237: invalid number
██ AS37468 ( 0,00%) - ANGOLA-CABLES, AO
/usr/bin/asn: line 2770: printf: 0.3874967708602428: invalid number
██ AS12779 ( 0,00%) - ITGATE, IT
/usr/bin/asn: line 2770: printf: 0.3358305347455438: invalid number
██ AS3257 ( 0,00%) - GTT-BACKBONE GTT, US`

`jq: error (at <stdin>:1): Cannot iterate over null (null)`

From a Hotel Wifi I get:

$ git log --oneline --no-decorate -1
6cb4456 improved subnet detection, introduced ROU element in report. - many ISPs allocate small blocks for PtP networks (or customers allocations), and take the time to define them in RIPE. But Cymru/Pwhois don't index these blocks (since they're not routed directly but aggregated in larger routes). Now `asn` will try to identify these subnets even if they're routed within larger prefixes. - NET element refers now to the smaller inetnum, while ROU reports the target IP's route. - Examples:   - asn -n 188.152.136.18   - asn -n 195.103.16.76   - asn -n 217.212.125.124   - asn -n 2.228.17.105
$ ./asn -v www.molgen.mpg.de

────────────────────────────────────────────────────────────
			WARNING 

No IPQualityScore token found, so disabling in-depth threat 
analysis and IP reputation lookups. Please visit 
https://github.com/nitefood/asn#ip-reputation-api-token 
for instructions on how to enable it. 
────────────────────────────────────────────────────────────

╭──────────────────────────────────╮
│ ASN lookup for www.molgen.mpg.de │
╰──────────────────────────────────╯

- Resolving "www.molgen.mpg.de"... 1 IP address found:

[2022-11-10 19:58:14]   DEBUG   curl -s api64.ipify.org
[2022-11-10 19:58:16]   DEBUG   curl -m5 -s https://stat.ripe.net/data/abuse-contact-finder/data.json?resource=134.76.31.205&sourceapp=nitefood-asn
[2022-11-10 19:58:17]   DEBUG   curl -m4 -s https://ipmap.ripe.net/api/v1/locate/134.76.31.205/best
[2022-11-10 19:58:18]   DEBUG   curl -m4 -s http://ip-api.com/json/134.76.31.205?fields=status,message,country,countryCode,regionName,city,mobile,proxy,hosting
[2022-11-10 19:58:18]   DEBUG   curl -m2 -s https://api.incolumitas.com/datacenter?ip=134.76.31.205
[2022-11-10 19:58:18]   DEBUG   curl -m4 -s http://api.stopforumspam.org/api?json&ip=134.76.31.205
[2022-11-10 19:58:19]   DEBUG   curl -m5 -s https://api.greynoise.io/v3/community/134.76.31.205
[2022-11-10 19:58:20]   DEBUG   curl -m5 -s https://internetdb.shodan.io/134.76.31.205
[2022-11-10 19:58:21]   DEBUG   curl -s https://stat.ripe.net/data/rpki-validation/data.json?resource=680&prefix=134.76.0.0/16&sourceapp=nitefood-asn

 134.76.31.205 ┌PTR npsw-www.mpg.de
               ├ASN 680 (DFN Verein zur Foerderung eines Deutschen Forschungsnetzes e.V., DE)
               ├ORG GWD Goettingen
               ├NET 134.76.0.0/16 (GWDG)
               ├ABU [email protected] / [email protected]
               ├ROA ✓ VALID (2 ROAs found)
               ├TYP  Mobile network IP 
               ├GEO Göttingen, Lower Saxony (DE)
               ├CPE [APP: apache:http_server] [APP: rubyonrails:rails] [APP: ruby-lang:ruby]
               ├POR Open ports: 80, 443
               └REP ✓ NONE


╭────────────────────────────╮
│ Trace to www.molgen.mpg.de │
╰────────────────────────────╯

[2022-11-10 19:58:22]   DEBUG   mtr -> 134.76.31.205 (5 rounds)
 Hop IP Address                                                                               Loss%      Ping avg     AS Information                
  1. _gateway (172.16.3.254)                                                                     0%        1.5 ms    BOGON  rfc1918 (Private Space)
  2. host18523696-201.telnaptelecom.pl (185.236.96.201)                                          0%        1.4 ms   [AS43372] TELNAP, PL
  3. ???                                                                                       100%             *   (No reply)
  4. host185186152-40.telnaptelecom.pl (185.186.152.40)                                          0%        7.9 ms   [AS43372] TELNAP, PL
  5. 82.177.247.209                                                                              0%        2.1 ms   [AS20804] ASN-TELENERGO ul. PERKUNA 47, WARSZAWA, PL
[2022-11-10 19:58:36]   DEBUG   curl -s https://www.peeringdb.com/api/ixpfx?prefix__startswith=88.220&protocol__in=IPv4
  6. 88.220.206.191                                                                              0%       21.5 ms   (EXATEL-NET)
[2022-11-10 19:58:38]   DEBUG   curl -s https://www.peeringdb.com/api/ixpfx?prefix__startswith=88.220&protocol__in=IPv4
  7. 88.220.204.181                                                                              0%       18.0 ms   (EXATEL-NET)
[2022-11-10 19:58:39]   DEBUG   curl -s https://www.peeringdb.com/api/ixpfx?prefix__startswith=88.220&protocol__in=IPv4
  8. 88.220.195.38                                                                               0%       18.1 ms   (EXATEL-NET / Connected by EXATEL S.A.)
[2022-11-10 19:58:41]   DEBUG   curl -s https://www.peeringdb.com/api/ixpfx?prefix__startswith=88.220&protocol__in=IPv4
jq: error (at <stdin>:1): Cannot iterate over null (null)
  9. 88.220.196.43                                                                               0%       16.3 ms   (EXATEL-NET / Connected by EXATEL S.A.)
 10. ???                                                                                       100%             *   (No reply)
 11. cr-han2-be6.x-win.dfn.de (188.1.144.134)                                                    0%       25.1 ms   [AS680] DFN Verein zur Foerderung eines Deutschen Forschungsnetzes e.V., DE
 12. kr-goe12-13.x-win.dfn.de (188.1.231.126)                                                    0%       27.9 ms   [AS680] DFN Verein zur Foerderung eines Deutschen Forschungsnetzes e.V., DE
C 13. gv-GWDGIR-gwdg.net.gwdg.de (134.76.147.181)                                                 0%       27.8 ms   [AS680] DFN Verein zur Foerderung eines Deutschen Forschungsnetzes e.V., DE
 14. npsw-www.mpg.de (134.76.31.205)                                                             0%       26.2 ms   [AS680] DFN Verein zur Foerderung eines Deutschen Forschungsnetzes e.V., DE

Trace completed in 22 seconds on 2022-11-10 19:58:44 CET


╭──────────────────────────────╮
│ AS path to www.molgen.mpg.de │
╰──────────────────────────────╯

  43372  TELNAP (Local AS)
 ╭╯
 ╰20804  ASN-TELENERGO ul. PERKUNA 47
 ╭╯
 ╰680    DFN Verein zur Foerderung eines Deutschen Forschungsnetzes e.V.

Git tags?

Do you have any plans for Git tags? Based on the source code there seems to be some versioning (0.71.6 as of writing). Thus, do you see any chance to create a Git tag when bumping the version in the source code? This would ease packaging for Linux distributions.

Windows 10 Installation

I am totally newbie in python.
I look for a bgp asn traceroute program for my lab and find this program, which is very good for my objectives.
Unfortunately, I am not able to understand that how can I use it in Windows 10.
I will be very grateful, if you guide me.
I am extremely sorry if I make any inconvenience to you.

Permission denied for install

Hi, congrats on what looks like a great ASN lookup. I'd like to install this software but permission is denied @nitefood .

This is the error
image

Please can I access the file - can you share this? Thank you

Exciting News: 'asn' Tool Soon to be Included in Debian!

Hello everyone,

I'm stopping by to express my gratitude for the incredible work done on the "asn" tool. It is with immense joy that I share the news that soon this tool will be available in Debian.

The effort and dedication of the developers behind this project are truly remarkable, and this milestone is a testament to the excellent work done by all.

Please find more details about the inclusion of "asn" in Debian at:
Link to Debian page

Once again, congratulations to all involved for this great achievement!

Best regards,

Marcos Rodrigues de Carvalho (aka oday) [email protected]

Feature request: add option to always query IPQualityScore and pass settings

IPQualityScore provides a lot of useful information on abuse IP. Please, add option to always query it. Also add an option to pass settings string, like strictness=1&allow_public_access_points=false

For example, abuser IP 77.83.36.16 currently displays REP ✓ NONE, but with enabled IPQualityScore it will display REP ❌ BAD (Threat Score 87%) RECENT ABUSER PROXY. Passing strictness=1 will give even better results: REP ❌ BAD (Threat Score 100%) RECENT ABUSER BOT PROXY .

IPv4 blocks

when i search for the ASNs using orgname for ext asn google.com, i get about 5 to 10 results matching the name and i need to key in the number i want to and the tools gives me a CIDR if present, is it possible that I can get all the CIDRS of the listed names at once with key in the required org name number

thanks

Json output breaks for AS1547

Probably some quoting issues:

$ bash -x ./asn -J 1547

[ ... ]

+ json_to_print+='"results":[{"asn":"1547","asname":"IDK-NETWORK, MD","org":"N/A","holder":"Societatea mixta pe actiuni de tip inchis "Interdnestrcom"","abuse_contacts":

[ ... ]

+ [[ true = true ]]
++ jq -M .
parse error: Invalid numeric literal at line 1, column 297
+ json_to_print=
+ echo -e ''

+ exit 0

IPv6 traceroute refusing to start on my host

Hi,
First of all, thank you for this amazing script.

I'm opening this issue as IPv6 traceroute doesn't work for me for some reason. When I try to traceroute to e.g. google.com'v IPv6 address, I get:

user@host:~$ ./asn 2a00:1450:4002:402::200e
[... a bunch of correct information ...]
Error: cannot trace an IPv6 from this IPv4-only host!

Similarly, when I run ./asn google.com it performs an IPv4 traceroute, even though the docs say it should perform an IPv6 traceroute when possible.

However, the host is definitely IPv6-enabled: I can successfully ping6 and traceroute6 to the very same address.

I'm gonna take a look myself and see if I can figure out the issue, and then update this issue.

Some IPv6 ranges not picked up

I love asn, but it misses some IPv6 networks.

As an example, 'asn 5089' displays the network information for Virgin Media (UK), with many IPv4 subnets but no IPv6 subnets.

However a search for 'asn 2a02:8801::1' shows it is part of AS5089 (2a02:8801::/32). Virgin Media also have 2a02:8880::/25, and a search for an address in that subnet also works.

Is there a way to get these IPv6 subnets to show up?

Use HTTPS when it's available

Firstly, thanks for the handy tool!

When the script checks the StopForumSpam API, it uses HTTP instead of HTTPS.

asn/asn

Line 2295 in 3097a10

is_blacklisted=$(docurl -m4 -s "http://api.stopforumspam.org/api?json&ip=$1" | jq -r '.ip.appears')

The API docs mention that the client must support SNI for HTTPS to work.
curl has supported this since version 7.18.1 (released in March 2008) so I think it's safe to assume it'll be fine.

As for ip-api.com, it looks like it needs a license to use HTTPS. It would be nice to have an option to provide an API key, similar to what you've done with ipqualityscore.

But even just a comment in the script to mention this is the reason it's using the insecure protocol would be good.

IP version assumptions and conflict in server mode

When running in server mode, compare if you will

/asn_lookup&bbc.co.uk

and

/asn_lookup&www.bbc.co.uk

The error is:

host: '....origin.asn.cymru.com' is not a legal name (empty label)
host: '' is not in legal name syntax (unexpected end of input)

Looks like $rev doesn't get a value. I'll take a closer when i get some time

./asn www.bbc.co.uk works fine on the command line.

MacOS Compatibility

This looks great!

Trying to run on a Mac however and getting a coproc: command not found error in the script:

➜  ~ ./asn 8.8.8.8

╭────────────────────────╮
│ ASN lookup for 8.8.8.8 │
╰────────────────────────╯

 8.8.8.8 ┌PTR dns.google
         ├ASN 15169 (GOOGLE, US)
         ├ORG Google LLC
         ├NET 8.8.8.0/24 (LVLT-GOGL-8-8-8)
         ├ABU [email protected]
         ├GEO Mountain View, California (US)
         └REP ✓ GOOD


Tracing path to 8.8.8.8 (press CTRL-C to cancel)..../asn: line 234: coproc: command not found

╭──────────────────╮
│ Trace to 8.8.8.8 │
╰──────────────────╯

 Hop IP Address                                                                        Ping avg     AS Information
  1. ???                                                                                        *   (No reply)

Trace complete in 1 seconds.

Any ideas?

zsh: killed bash (exec 3<>/dev/tcp/whois.ripe.net/43)

Hello there!

I am not an expert, and it might not be an issue with the code, but something changed because your amazing script stopped working for me since yesterday. I am running it on MacOS Ventura 13.1 with Homebrew.

Below is what happens:

sudo ./asn -n 40021

╭──────────────────────╮
│ ASN lookup for 40021 │
╰──────────────────────╯

AS Number ──> 40021
AS Name ──> CONTABO, US
Organization ──> CONTABO (Contabo Inc.)
Abuse contact ──> [email protected]
AS Reg. date ──> 2019-12-25 01:26:48
Peering @ixps ──> NONE

╭────────────────────────────────────────────╮
│ BGP informations for AS40021 (CONTABO, US) │
╰────────────────────────────────────────────╯

Retrieving prefix allocations and announcements for AS40021 (CONTABO, US) (press CTRL-C to cancel)...zsh: killed sudo ./asn -n 40021

In an effort to pinpoint the issue, I also got the following:

bash -x asn -v 40021 137 ⨯

  • ASN_VERSION=0.72.9
  • IFS='
    '
  • green=''
  • magenta=''
  • yellow=''
  • white=''
  • blue=''
  • red=''
  • black=''
  • lightyellow=''
  • lightred=''
  • lightblue=''
  • lightgreybg=''
  • bluebg=''
  • redbg=''
  • greenbg=''
  • yellowbg=''
  • default=''
  • htmlwhite='#cccccc'
  • htmlblack='#1e1e1e'
  • htmllightgray='#d5d5d5'
  • htmlred='#ff5f5f'
  • htmlblue='#00afd7'
  • htmlyellow='#afaf00'
  • htmlgreen='#00af5f'
  • htmlmagenta='#ff5fff'
  • [[ xterm-256color = \d\u\m\b ]]
  • IS_HEADLESS=false
  • ipv4v6regex='[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}|(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))'
  • '[' false = true ']'
    ++ tput cols
  • terminal_width=158
  • trap 'terminal_width=$(tput cols)' SIGWINCH
  • '[' '' = true ']'
  • IS_ASN_CHILD=false
  • '[' '' = true ']'
  • IS_ASN_CONNHANDLER=false
  • IQS_TOKEN_FILES=/Users/jmpere6/.asn/iqs_token:/etc/asn/iqs_token
  • NO_ERROR_ON_INTERRUPT=false
  • trap Ctrl_C INT
  • peeringdb_dataset=
  • peeringdb_ipv6_dataset=
  • [[ -r /etc/services ]]
    ++ cat /etc/services
  • WELL_KNOWN_PORTS='#

(I removed the long list of ports)

  • MTR_TRACING=true
  • DETAILED_TRACE=false
  • MTR_ROUNDS=5
  • MAX_CONCURRENT_SHODAN_REQUESTS=10
  • SHODAN_SHOW_TOP_N=5
  • MONOCHROME_MODE=false
  • ASN_DEBUG=false
  • JSON_OUTPUT=false
  • JSON_PRETTY=false
  • DEFAULT_SERVER_BINDADDR=127.0.0.1
  • DEFAULT_SERVER_BINDPORT=49200
  • [[ 2 -lt 1 ]]
  • '[' false = false ']'
  • rcfile=//Users/jmpere6/.asnrc
  • '[' -r //Users/jmpere6/.asnrc ']'
  • status_json_output=ok
  • reason_json_output=success
    ++ date +%Y-%m-%dT%H:%M:%S
  • json_request_time=2023-01-12T16:45:17
    ++ date +%s
  • starttime=1673559917
  • final_json_output=
  • json_target_type=unknown
  • json_resultcount=0
  • optspec=:hvmljJsgn:t:d:o:a:c:
  • FORCE_ORGSEARCH=false
  • SUGGEST_SEARCH=false
  • SERVER_MODE=false
  • RECON_MODE=false
  • COUNTRY_BLOCK_MODE=false
  • GEOLOCATE_ONLY_MODE=false
  • OPTIONS_PRESENT=false
  • getopts :hvmljJsgn:t:d⭕a:c: optchar
  • userinput=
  • OPTIONS_PRESENT=true
  • case "${optchar}" in
  • ASN_DEBUG=true
  • getopts :hvmljJsgn:t:d⭕a:c: optchar
  • '[' -t 0 ']'
  • '[' true = false ']'
  • '[' -z '' ']'
  • '[' false = false ']'
  • GetFullParamsFromCurrentPosition -v 40021
  • userinput=
  • for option in "${@:$OPTIND}"
  • userinput+=' 40021'
    ++ awk '{ sub(/^[ \t]+/, ""); print }'
  • userinput=40021
    ++ echo -en 40021
  • userinput=40021
  • '[' -z 40021 ']'
  • [[ false = true ]]
  • [[ false = true ]]
  • [[ false = true ]]
  • CheckPrerequisites
  • saveIFS='
    '
  • IFS=' '
  • prerequisite_tools='jq whois host curl'
  • optional_tools='nmap mtr ipcalc grepcidr ncat aha'
  • missing_tools=
  • disabled_features=
  • HARD_FAIL=false
  • HAVE_IPCALC=true
  • HAVE_NMAP=true
  • IXP_DETECTION=true
  • UNABLE_TO_SERVE=false
    ++ echo '5.2.15(1)-release'
    ++ cut -d . -f 1
  • bash_major=5
    ++ echo '5.2.15(1)-release'
    ++ cut -d . -f 2
  • bash_minor=2
  • bash_version_too_low=false
  • '[' 5 -lt 4 ']'
  • '[' 5 -eq 4 ']'
  • [[ false = true ]]
  • for tool in $prerequisite_tools
    ++ command -v jq
  • '[' -z /opt/homebrew/bin/jq ']'
  • for tool in $prerequisite_tools
    ++ command -v whois
  • '[' -z /usr/bin/whois ']'
  • for tool in $prerequisite_tools
    ++ command -v host
  • '[' -z /usr/bin/host ']'
  • for tool in $prerequisite_tools
    ++ command -v curl
  • '[' -z /usr/bin/curl ']'
  • for tool in $optional_tools
    ++ command -v nmap
  • '[' -z /opt/homebrew/bin/nmap ']'
  • for tool in $optional_tools
    ++ command -v mtr
  • '[' -z /opt/homebrew/sbin/mtr ']'
  • for tool in $optional_tools
    ++ command -v ipcalc
  • '[' -z /opt/homebrew/bin/ipcalc ']'
  • for tool in $optional_tools
    ++ command -v grepcidr
  • '[' -z /opt/homebrew/bin/grepcidr ']'
  • for tool in $optional_tools
    ++ command -v ncat
  • '[' -z /opt/homebrew/bin/ncat ']'
  • for tool in $optional_tools
    ++ command -v aha
  • '[' -z /opt/homebrew/bin/aha ']'
  • IpcalcVersionCheck
  • IPCALC_FLAG=
  • '[' true = true ']'
    ++ ipcalc -v
    ++ sed 's/ipcalc //'
  • ipcalc_version=0.51
    ++ echo 0.51
    ++ cut -d . -f 1
  • ipcalc_major=0
  • case "${ipcalc_major}" in
    ++ echo 0.51
    ++ cut -d . -f 2
  • ipcalc_minor=51
  • '[' 51 -ge 5 ']'
  • IPCALC_FLAG=-r
  • '[' -n '' ']'
  • IQS_TOKEN=
  • IFS='
    '
    ++ tr : '\n'
  • for asn_config_file in $(tr ':' '\n' <<< "$IQS_TOKEN_FILES")
  • '[' -r /Users/jmpere6/.asn/iqs_token ']'
    ++ tr -d ' \n\r\t'
  • IQS_TOKEN=25Txj4VImrUYxXUSVOa3LIhP0S58RvTo
  • break
  • '[' -z 25Txj4VImrUYxXUSVOa3LIhP0S58RvTo ']'
  • CoreutilsFixup
    ++ command -v gdate
  • '[' -x /opt/homebrew/bin/gdate ']'
  • export -f date
    ++ command -v gsed
  • '[' -x '' ']'
    ++ command -v gawk
  • '[' -x '' ']'
    ++ command -v gbase64
  • '[' -x /opt/homebrew/bin/gbase64 ']'
  • export -f base64
    ++ command -v gwc
  • '[' -x /opt/homebrew/bin/gwc ']'
  • export -f wc
  • '[' false = true ']'
  • '[' false = true ']'
  • IFS='
    '
  • local_wanip=
  • HAVE_IPV6=false
  • '[' false = true ']'
  • '[' -n '' ']'
  • '[' false = true ']'
  • '[' false = true ']'
  • '[' false = true ']'
  • BoxHeader 'ASN lookup for 40021'
  • [[ false = true ]]
  • local 'message=ASN lookup for 40021'
  • '[' false = true ']'
  • '[' false = true ']'
  • echo -e '\n╭──────────────────────╮\n│ ASN lookup for 40021 │\n╰──────────────────────╯'

╭──────────────────────╮
│ ASN lookup for 40021 │
╰──────────────────────╯

AS Number ──> 40021+ '[' false = true ']'

╭────────────────────────────────────────────╮
│ BGP informations for AS40021 (CONTABO, US) │
╰────────────────────────────────────────────╯

Sorry for the long output, I hope it helps. Looking at the script, I have the impression the problem is when it tries to open a persistent connection to RIPE Whois.

Thank you for the amazing script!

No date/time logged in output

Currently, it looks like there is no date/time, from when the command was executed, in the output. I know, everyone could append date; asn …, but often it’s forgotten, and the date/time might be useful to correctly interpret the data (later).

ipcalc bad argument

Possibly related to issue 34 - #34

asn dns.inxfiber.com

ipcalc: bad argument -v: unknown option
Usage: ipcalc [OPTION...]
-c, --check Validate IP address for specified address family
-4, --ipv4 IPv4 address family (default)
-6, --ipv6 IPv6 address family
-b, --broadcast Display calculated broadcast address
-h, --hostname Show hostname determined via DNS
-m, --netmask Display default netmask for IP (class A, B, or C)
-n, --network Display network address
-p, --prefix Display network prefix
-s, --silent Don't ever display error messages

Help options:
-?, --help Show this help message
--usage Display brief usage message

yum whatprovides ipcalc

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: ohioix.mm.fcix.net
  • epel: mirrors.wcupa.edu
  • extras: mirrors.sonic.net
  • updates: repos.lax.layerhost.com
    initscripts-9.49.53-1.el7.x86_64 : The inittab file and the /etc/init.d scripts

Repo : base
Matched from:
Filename : /usr/bin/ipcalc

Some IP addresses missing in trace

Using traceroute shows cloudflare.bcix.de, but ASN’s trace does not.

$ git log --oneline -1 --no-decorate 
23b2d39 Minor tweaks
$ ./asn 1.1.1.1

────────────────────────────────────────────────────────────
			WARNING 

No IPQualityScore token found, so disabling in-depth threat 
analysis and IP reputation lookups. Please visit 
https://github.com/nitefood/asn#ip-reputation-api-token 
for instructions on how to enable it. 
────────────────────────────────────────────────────────────

╭────────────────────────╮
│ ASN lookup for 1.1.1.1 │
╰────────────────────────╯
                                                                                                                                                      
 1.1.1.1 ┌PTR one.one.one.one
         ├ASN 13335 (CLOUDFLARENET, US)
         ├ORG APNIC and Cloudflare DNS Resolver project
         ├NET 1.1.1.0/24 (APNIC-LABS)
         ├ABU [email protected]
         ├ROA ✓ VALID (1 ROA found)
         ├TYP  Anycast IP   Hosting/DC 
         ├GEO Magomeni, Dar es Salaam (TZ)
         └REP ✓  KNOWN GOOD as "Cloudflare Public DNS" 


╭──────────────────╮
│ Trace to 1.1.1.1 │
╰──────────────────╯

 Hop IP Address                                                                               Loss%      Ping avg     AS Information                  
  1. ???                                                                                       100%             *   (No reply)                        
  2. ???                                                                                       100%             *   (No reply)                        
  3. ae14-0.0002.dbrx.02.ber.de.net.telefonica.de (62.53.11.222)                                 0%        9.2 ms   [AS6805] TDDE-ASN1, DE            
  4. ae1-0.0002.prrx.02.ber.de.net.telefonica.de (62.53.12.61)                                  80%        7.5 ms   [AS6805] TDDE-ASN1, DE            
  5. ???                                                                                       100%             *   (No reply)                        
  6. one.one.one.one (1.1.1.1)                                                                  80%        9.1 ms   [AS13335] CLOUDFLARENET, US       
                                                                                                                                                      
Trace complete in 11 seconds.


╭────────────────────╮
│ AS path to 1.1.1.1 │
╰────────────────────╯

  6805   TDDE-ASN1 (Local AS)
 ╭╯
 ╰13335  CLOUDFLARENET


$ traceroute 1.1.1.1
traceroute to 1.1.1.1 (1.1.1.1), 30 hops max, 60 byte packets
 1  * * *
 2  * * *
 3  ae14-0.0001.dbrx.02.ber.de.net.telefonica.de (62.53.11.220)  12.626 ms  12.610 ms  12.587 ms
 4  ae0-0.0002.prrx.02.ber.de.net.telefonica.de (62.53.12.59)  11.638 ms ae0-0.0001.prrx.02.ber.de.net.telefonica.de (62.53.4.153)  12.564 ms ae1-0.0001.prrx.02.ber.de.net.telefonica.de (62.53.4.155)  17.601 ms
 5  cloudflare.bcix.de (193.178.185.17)  17.145 ms as13335.berlin.megaport.com (194.9.117.74)  14.391 ms  14.379 ms
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

Two routers with same IP address are treated as "routing loop"

Two routers with same IP address are treated as "routing loop", even there is no real routing loop. From asn output while using commit 64e9253:

 Hop IP Address                                                                                  Loss%      Ping avg     AS Information                                                                                         
  1. fritz.box (192.168.0.1)                                                                        0%        1.2 ms    BOGON  rfc1918 (Private Space)                                                                          
  2. dslb-084-059-211-001.084.059.pools.vodafone-ip.de (84.59.211.1)                                0%        5.5 ms   [AS3209] VODANET International IP-Backbone of Vodafone, DE                                               
  3. 88.79.14.158                                                                                   0%        5.2 ms   [AS3209] VODANET International IP-Backbone of Vodafone, DE                                               
  4. 88.79.15.124                                                                                   0%        5.5 ms   [AS3209] VODANET International IP-Backbone of Vodafone, DE                                               
  5. 188.111.129.42                                                                                 0%        6.6 ms   [AS3209] VODANET International IP-Backbone of Vodafone, DE                                               
  6. 145.254.2.209                                                                                  0%       10.2 ms   [AS3209] VODANET International IP-Backbone of Vodafone, DE                                               
  7.  no route to host (routing loop detected)                                                    100%             *   (No reply)                                                                    

However, in mtr it looks like this:

$ mtr -w -z <…>
Start: 2021-10-14T01:31:28+0200
HOST: tux.example.net                                               Loss%   Snt   Last   Avg  Best  Wrst StDev
  1. AS???    fritz.box                                              0.0%    10    1.1   1.1   1.0   1.1   0.0
  2. AS3209   dslb-084-059-211-001.084.059.pools.vodafone-ip.de      0.0%    10    5.5   5.4   5.0   6.6   0.5
  3. AS3209   88.79.14.158                                           0.0%    10    5.0   5.2   4.8   5.8   0.3
  4. AS3209   88.79.15.124                                           0.0%    10    5.7   5.9   5.1   6.5   0.4
  5. AS3209   188.111.129.42                                         0.0%    10    7.0   6.8   6.2   8.1   0.5
  6. AS3209   145.254.2.209                                          0.0%    10   10.6  10.5  10.1  11.4   0.4
  7. AS3209   145.254.2.209                                          0.0%    10    9.7  10.1   9.6  11.2   0.4
  8. AS6830   de-str01c-rb01-be-1050.aorta.net                       0.0%    10   12.5  12.7  12.3  13.8   0.5
  9. AS3209   <…>                                                    0.0%    10   12.2  12.2  11.9  12.7   0.2
 10. AS<…>    <…>                                                    0.0%    10   12.0  18.7  11.7  78.2  20.9
$ 

So yes, the same IP address appears twice in the trace, but there is still no routing loop, the target can be properly reached.

Issue with obtaining v4 and v6 prefixes on MACOS

Hi nitefood,

Mac seems to have an issue grabbing prefixes both IPv4 and v6:

:~/repo/asn [master]% sw_vers
ProductName:		macOS
ProductVersion:		13.2.1
BuildVersion:		22D68
~/repo/asn [master]% git --no-pager log --oneline --no-decorate -1
f53ff33 IPv6 improvements (fixes #43) - improved host IPv6 detection reliability using ifconfig.co - improved host AS detection using RIPEStat for IPv6 and dual stack hosts - [server mode] switched default binding address to ::1 instead of 127.0.0.1 for IPv6 and dual stack hosts
~/repo/asn [master]% ./asn 5505

╭─────────────────────╮
│ ASN lookup for 5505 │
╰─────────────────────╯

 AS Number     ──> 5505
 AS Name       ──> VADAVO, ES
 Organization  ──>  (VDV-VLC-RED06 VDV-VLC-RED06 - CLIENTES TELECOM)
 Abuse contact ──> [email protected]
 AS Reg. date  ──> 2016-12-13 08:28:07
 Peering @IXPs ──> DE-CIX Madrid: DE-CIX Madrid Peering LAN • ESPANIX Madrid Lower LAN


╭──────────────────────────────────────────╮
│ BGP informations for AS5505 (VADAVO, ES) │
╰──────────────────────────────────────────╯

Retrieving prefix allocations and announcements for AS5505 (VADAVO, ES) (press CTRL-C to cancel)...zsh: killed     ./asn 5505

Seems to be an issue with how the connection to ripe is made, maybe?

~/repo/asn [master]% exec 85<>/dev/tcp/whois.ripe.net/43
zsh: no such file or directory: /dev/tcp/whois.ripe.net/43

~/repo/asn [master]% exec 3<>/dev/tcp/whois.ripe.net/43
zsh: no such file or directory: /dev/tcp/whois.ripe.net/43

screenshots

Just a placeholder issue to permalink screenshots from the repo README.

BGP informations not retrieved

Hi,

When I use the script to get informations of ASN, it appears that I don't received BGP Informations and Announced prefixes.

./asn 206610

────────────────────────────────────────────────────────────
WARNING

No IPQualityScore token found, so disabling in-depth threat
analysis and IP reputation lookups. Please visit
https://github.com/nitefood/asn#ip-reputation-api-token
for instructions on how to enable it.
────────────────────────────────────────────────────────────

╭───────────────────────╮
│ ASN lookup for 206610 │
╰───────────────────────╯

AS Number ──────> 206610
AS Name ────────> MIXVOIP, LU
Organization ───> Mixvoip S.A.
AS Reg. date ───> 2016-12-13 08:28:07
Peering @ixps ──> DE-CIX Dusseldorf: DE-CIX Dusseldorf Peering LAN | DE-CIX Frankfurt: DE-CIX Frankfurt Peering LAN | ECIX-DUS | ECIX-FRA | France-IX Paris | LU-CIX

╭─────────────────────────────────────────────╮
│ BGP informations for AS206610 (MIXVOIP, LU) │
╰─────────────────────────────────────────────╯

Retrieving prefix allocations and announcements for AS206610 (MIXVOIP, LU) (press CTRL-C to cancel)...

╭────────────────────────────────────────────────────────────╮
│ Announced prefixes (aggregated) for AS206610 (MIXVOIP, LU) │
╰────────────────────────────────────────────────────────────╯

───── IPv4 ─────

NONE

───── IPv6 ─────

NONE

I've tested with many ASN and the result is the same.

I did not have this result few days ago...

Could you help me to solve this occur ?

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.