nitefood / asn

ASN / RPKI validity / BGP stats / IPv4v6 / Prefix / URL / ASPath / Organization / IP reputation / IP geolocation / IP fingerprinting / Network recon / lookup API server / Web traceroute server
MIT License
1.31k stars 159 forks source link

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

Closed OrEg0n closed 1 year ago

OrEg0n commented 1 year ago

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 ──> abuse@contabo.de 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 ⨯

(I removed the long list of ports)

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

╭────────────────────────────────────────────╮ │ 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!

nitefood commented 1 year ago

Hey @OrEg0n,

it's been a while since I've switched to persistent whois connection (9 months according to Git blame), so if the script ever worked in the last 9 months and only recently stopped working, I would assume that something odd is going on with your MacOS/homebrew/shell installation or configuration. I've found this thread where somebody reports a similar behavior, do you mind trying to reinstall hombrew (or bash at least, since exec is an integrated command) or trying the "safe mode" proposed solution?

Sorry but I don't have a MacOS machine handy, maybe @Antonio-Prado has seen / knows about this issue and could share some insight or suggestion on how to proceed?

As a last resort, I may supply you with a test version of asn that reverts to the old (non-persistent whois connection) behavior, in order to confirm it is indeed what's breaking it.

Let me know

OrEg0n commented 1 year ago

Hello @nitefood,

I very much appreciate your response! I strongly believe the issue is indeed with my MacOS/homebrew/shell installation or configuration. Perhaps a recent Homebrew update/upgrade caused it, but I will have more time over the weekend to try it all out, and I will update you on my findings. Hopefully, what I find can help others too.

Nonetheless, if you would not mind supplying a test version of asn that reverts to the older and non-persistent Whois connection, I would very much appreciate it. I would love to confirm if that is indeed what is breaking it, and I will share the results with you as soon as I run it.

Again, thank you so much! You did an outstanding job with this script, and it helps a lot.

nitefood commented 1 year ago

Please find it attached, bear in mind it will probably give bogus output on some lookups (didn't have enough time to fully clean up the code, sorry) - but the purpose here is only to confirm the issue is gone. Let me know asn_nopersist.txt

OrEg0n commented 1 year ago

Hi @nitefood,

Thank you for the test script, it worked perfectly, and that confirms the issue with the persistent connection indeed.

I will see if I can sort out, and I will paste my finding here soon ;).

Again, I very much appreciate it. Cheers!

OrEg0n commented 1 year ago

Hello @nitefood! I hope all is well with you.

It is my understanding that the most recent update of Homebrew Core resolved the issue reported above. I can run the script again without issues, just as I did before I reported the issue above. It is possible that it may break again with future Homebrew Core updates, but I no longer have the issue at this time.

I very much appreciate your support and assistance. You have done brilliant work here, cheers!

nitefood commented 1 year ago

Awesome, glad you got it sorted out :-)