Skip to content

Commit

Permalink
update remote reverse (fixes #2137)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLKwong committed Mar 26, 2021
1 parent 75818c8 commit a0d96ca
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions modules/internet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function internet {
if ! nc -w 10 -z 8.8.8.8 53 >/dev/null 1>&2; then
log_and_exit1 "Error: no internet found"
fi
# I can't even.
info="$(curl -s ipinfo.io | grep -o '"[^"]*"\s*:\s*"[^"]*"')"
ip=$(echo "$info" | grep -e '"ip": "')
org=$(echo "$info" | grep -e '"org": "')
Expand All @@ -21,18 +22,14 @@ function internet {
postal=$(echo $info | grep -o '"postal": "[^;]*' | cut -d '"' -f 4)
timezone=$(echo $info | grep -o '"timezone": "[^;]*' | cut -d '"' -f 4)

# echo " INFO: $info"
echo " CITY: $city"
echo " POSTAL: $postal"
echo " TIMEZONE: $timezone"
echo "$ip"
echo "$org"
if [ -z "$postal" ]; then
echo "$country, $city, \"postal\": \"n/a\""
echo "$country, \"city\": \"$city\", \"postal\": \"n/a\""
else
echo "$country, $city, $postal"
echo "$country, \"city\": \"$city\", \"postal\": \"$postal\""
fi
echo "$timezone"
echo "\"timezone\": \"$timezone\""
;;
*)
log_help_and_exit1 "ERROR: incorrect command" internet
Expand Down

0 comments on commit a0d96ca

Please sign in to comment.