Created
June 8, 2024 20:23
-
-
Save paulscode/edf83354ba6da722ffa33b48685731fa to your computer and use it in GitHub Desktop.
Changes the Tor identity
This file contains hidden or 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 | |
# Check for the --help flag | |
if [[ "$1" == "--help" ]]; then | |
echo "Creates a new Tor identity. Usage:" | |
echo "sudo ./tor_new_identity.sh" | |
exit 0 | |
fi | |
# Check if the script is run as root | |
if [ "$EUID" -ne 0 ]; then | |
echo "Please run as root" | |
exit 1 | |
fi | |
# Path to the control port cookie file | |
COOKIE_FILE="/var/run/tor/control.authcookie" | |
# Read the authentication cookie | |
AUTH_COOKIE=$(cat $COOKIE_FILE | xxd -p) | |
# Send NEWNYM signal to the Tor control port | |
echo -e "authenticate \"${AUTH_COOKIE}\"\nsignal newnym\nquit" | nc localhost 9051 | |
echo "Tor identity updated." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment