Skip to content

Commit

Permalink
improved AWS support and bookmarklet creation:
Browse files Browse the repository at this point in the history
- handled ifconfig.co redirecting to captcha when queried from flagged IP ranges (fallback to ipify)
- ASN server now uses WAN IP instead of lo address when building bookmarlet URL (if binding to 0.0.0.0 or ::)
  • Loading branch information
nitefood committed Feb 13, 2024
1 parent 4511522 commit be24872
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ The script uses the following services for data retrieval:
* [PeeringDB](https://www.peeringdb.com/)
* [CAIDA ASRank](https://asrank.caida.org/)
* [ifconfig.co](https://ifconfig.co/)
* [ipify](https://www.ipify.org/)
* [RIPEStat](https://stat.ripe.net/)
* [RIPE IPmap](https://ipmap.ripe.net/)
* [ip-api](https://ip-api.com/)
Expand Down
4 changes: 3 additions & 1 deletion asn
Original file line number Diff line number Diff line change
Expand Up @@ -2714,7 +2714,7 @@ AsnServerListener(){

# prepare the server URL (for the JS bookmarklet)
if [ "$ASN_SRV_BINDADDR" = "0.0.0.0" ] || [ "$ASN_SRV_BINDADDR" = "::" ]; then
INTERNAL_ASNSERVER_ADDRESS="127.0.0.1:$ASN_SRV_BINDPORT"
INTERNAL_ASNSERVER_ADDRESS="$local_wanip:$ASN_SRV_BINDPORT"
else
INTERNAL_ASNSERVER_ADDRESS="$ASN_SRV_BINDADDR:$ASN_SRV_BINDPORT"
fi
Expand Down Expand Up @@ -2844,6 +2844,8 @@ WhatIsMyIP() {
[[ -n "$local_wanip" ]] && return
# retrieve local WAN IP (v6 takes precedence) from ifconfig.co
local_wanip=$(docurl -s "https://ifconfig.co")
# handle ifconfig.co serving a captcha-type redirect page (e.g. when coming from some AWS networks)
grep -qE '^<!DOCTYPE html>' <<<"$local_wanip" && local_wanip=$(docurl -s "https://api64.ipify.org")
# check if we default to an IPv6 internet connection
if echo "$local_wanip" | grep -q ':'; then
HAVE_IPV6=true
Expand Down

0 comments on commit be24872

Please sign in to comment.