fetch-uri: Use tor whitelist, disable curl globbing. - annna - Annna the nice friendly bot.
HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
---
DIR commit f4e2b6a01fa82272722c9d243087545af94ca961
DIR parent b4fac2254b27c24c21d6c57103f7e1918e6f24c1
HTML Author: eidolon <?>
Date: Fri, 18 Oct 2024 13:41:31 -0400
fetch-uri: Use tor whitelist, disable curl globbing.
Signed-off-by: Annna Robert-Houdin <annna@bitreich.org>
Diffstat:
M fetch-uri | 21 +++++++++++----------
A modules/tor/whitelist-from-tor | 2 ++
2 files changed, 13 insertions(+), 10 deletions(-)
---
DIR diff --git a/fetch-uri b/fetch-uri
@@ -19,13 +19,14 @@ then
shift
fi
-
-
-curl \
- --preproxy socks5h://127.0.0.1:9050 \
- -s \
- -L --max-redirs 3 \
- -m 5 \
- -H "User-Agent: $(http-user-agent)" \
- $opth \
- "$1" 2>/dev/null
+uri="$1"
+usetor=""
+ua="$(http-user-agent)"
+beg="${uri#*://}"
+beg="${beg:?}"
+case "$beg" in
+ */*) host="${beg%%/*}" ;;
+ *) host="$beg"
+esac
+grep -qx "$host" "/home/annna/bin/modules/tor/whitelist-from-tor" || usetor=1
+curl -qgsm 5 -L --max-redirs 3 -A "$ua" $opth ${usetor:+--preproxy socks5h://127.0.0.1:9050 }"$uri"
DIR diff --git a/modules/tor/whitelist-from-tor b/modules/tor/whitelist-from-tor
@@ -0,0 +1,2 @@
+www.forgottenweapons.com
+forgottenweapons.com