Created
November 8, 2022 07:28
-
-
Save sinsukehlab/88433b1315578c1912af3f9bcdcbcba6 to your computer and use it in GitHub Desktop.
Edit torrc with jq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
badexitpath='http://dud2sxm6feahhuwj4y4lzktduy7v3qpaqsfkggtj2ojmzathttkegoid.onion/summary?flag=badexit' | |
while IFS= read -r name && IFS= read -r finger; do | |
echo $name | |
echo $finger | |
if [[ $(grep -c $name /etc/tor/torrc) == 0 && $(grep -c $finger /etc/tor/torrc) == 0 ]]; then | |
echo "not found" | |
sed -i "/^ExcludeNodes/s/$/,$finger/" /etc/tor/torrc | |
fi | |
done < <(torsocks curl -s ${badexitpath} | jq -r '.relays | .[] | (.n, .f)') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment