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.33k stars 161 forks source link

MacOS Compatibility #6

Closed antonio061 closed 3 years ago

antonio061 commented 3 years ago

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 ipaddressing@level3.com
         ├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?

antonio061 commented 3 years ago

Ok, it looks like it has something to do with the bash version in MacOS not being up to date (as MacOS has moved to zsh as the main shell).

➜  ~ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.

Installing an updated version via brew install bash seems to have resolved it.

➜  ~ /usr/local/bin/bash --version
GNU bash, version 5.0.18(1)-release (x86_64-apple-darwin19.5.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
nitefood commented 3 years ago

Yeah, I heard Apple did something crazy with licensing that forced MacOS' official Bash version to 3. Although I wrote it in the README that Bash v4+ is required (precisely beacuse of asynchronous path tracing using coproc), I may indeed just add a warning during prerequisite checks that helps the user to figure out the problem right away. Will keep this open until I do.

Thanks for your feedback!