Last active
January 19, 2023 12:58
-
-
Save jonasjancarik/1646437e9e60c4ea01f0eb4247ea86e0 to your computer and use it in GitHub Desktop.
Bash script to set the exit node country for the Tor Browser
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
[Desktop Entry] | |
Type=Application | |
Name=Change Tor Country | |
Exec=sh -c "~/Desktop/Browser/change_tor_country.sh" | |
Icon=gnome-globe-net | |
Terminal=true |
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/bash | |
options=("us" "ru" "any") | |
PS3='Please type the number of the option you want to select: ' | |
select opt in "${options[@]}" | |
do | |
if [[ " ${options[*]} " == *"$opt"* ]]; then | |
if [ "$opt" == "any" ]; then | |
chosen_value="" | |
else | |
chosen_value="$opt" | |
fi | |
if grep -q "^ExitNodes" ~/Desktop/Browser/TorBrowser/Data/Tor/torrc; then | |
sed -i "s/^ExitNodes.*/ExitNodes {$chosen_value} StrictNodes 1/" ~/Desktop/Browser/TorBrowser/Data/Tor/torrc | |
else | |
echo "ExitNodes {$chosen_value} StrictNodes 1" >> ~/Desktop/Browser/TorBrowser/Data/Tor/torrc | |
fi | |
echo "Value chosen: $chosen_value. Stored in ~/Desktop/Browser/TorBrowser/Data/Tor/torrc" | |
break | |
else | |
echo "Invalid option, please try again." | |
fi | |
done | |
read -n1 -p "Press any key to exit." | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment