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

Declare editorconfig #5

Closed szepeviktor closed 3 years ago

szepeviktor commented 3 years ago

Now GitHub displays short tabs! :)

szepeviktor commented 3 years ago

Oh noooo! You use 8 spaces :(

unexpand asn >asn.tab
expand -t 4 asn.tab >asn.space
szepeviktor commented 3 years ago

BTW Please consider using shellcheck

nitefood commented 3 years ago

Hi!

I've been using shellcheck for this script since commit d974bff969503be6e5faa3c39da7c132bc10c2c2. Any ideas on how to improve the code? I'll gladly hear them.

Thanks for the feedback!

szepeviktor commented 3 years ago
szepeviktor commented 3 years ago

+1 encourage users to install to ~/bin or /usr/local/bin

nitefood commented 3 years ago
* add CI https://github.com/koalaman/shellcheck/wiki/TravisCI

* write a handful of unit tests https://github.com/pgrange/bash_unit#test-functions

While I agree both CI and unit tests would add value to the project, they sadly require more time than I have available to currently commit to it, will try to improve these aspects in the future, though.

* use 4 space :)

* decrease if-depth, currently we have four or more conditions inside each other - see lines starting at the middle of the screen

Cleaner code is definitely something I appreciate. Will look into both as soon as I get some time, cheers.

* no sarcasm: after a certain amount of complexity Python gives you much greater joy

Thanks for the good laugh :-) I know, and I've been repeatedly pondering the switch as the code grew in size, but I'm more proficient in BASH than in Python. It'd be a good exercise to improve my skills, but I'm a network engineer more than I am a coder, and would honestly rather improve the feature set than restart from scratch in a different language. That said, I'd still gladly support/acknowledge anybody willing to do that in their spare time!

encourage users to install to ~/bin or /usr/local/bin

Why? I kinda took for granted that if you have a frequent usage scenario for this script (like I do) you'd also know your way around your $PATH :-)

Thanks for your feedback!

szepeviktor commented 3 years ago

encourage users to install to ~/bin or /usr/local/bin

Let me reverse this: do not encourage users to put stray files everywhere.

install --mode=0755 ./asn ~/bin/

szepeviktor commented 3 years ago

if you have a frequent usage scenario for this script (like I do)

I'm also friend of my terminal but this shovel digs deeper: https://bgp.he.net/ip/8.8.8.8

kép

nitefood commented 3 years ago

if you have a frequent usage scenario for this script (like I do)

I'm also friend of my terminal but this shovel digs deeper: https://bgp.he.net/ip/8.8.8.8

kép

I doubt I stated anywhere that this script is a catch-all for every use case. That'd be silly, and untrue - there are just different usage scenarios, and in mine I need quick lookups without having to open the browser, it's really as simple as that. It's nothing you couldn't do with just whois, for that matter - but that doesn't put whois and asn in competition.

Don't get me wrong, HE's BGP toolkit is in my favorites (along, for that matter, with the IMHO way more useful RIPEStat and many more, including LG servers from most tier 1 networks), but nonetheless I use them only a third of the time, because they contain more (or different) informations than what I really need when performing a lookup. I intentionally chose to leave target's BGP upstreams/peers out of the report, but chose to add path trace (from my network, not some random tier 1's looking glass) and search-by-org because I felt they are more useful additions, which you rarely find in browser-based tools.

Thanks for your feedback!