Skip to content

Instantly share code, notes, and snippets.

@jlp78
Last active February 14, 2024 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlp78/f103beb941842ee1c59fa8b24640684a to your computer and use it in GitHub Desktop.
Save jlp78/f103beb941842ee1c59fa8b24640684a to your computer and use it in GitHub Desktop.
# from Aaron Toppence (eightyeight) https://ae7.st/p/734
# updated to detect if TOR is not running
expandurl () {
(torsocks wget --spider -O - -S $1 2>&1 |
awk '/^Location/ {gsub("\\?utm_.*$",""); print $2; exit 0}
/socks5 libc connect: Connection refused/ {exit 1}') ||
(echo "warning, TOR not enabled"
wget --spider -O - -S $1 2>&1 |
awk '/^Location/ {gsub("\\?utm_.*$",""); print $2; exit 0}')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment