41 lines
1.3 KiB
Bash
41 lines
1.3 KiB
Bash
#!/bin/bash
|
|
# Usage:
|
|
## Install Tor
|
|
### sudo apt update; sudo apt install tor -y
|
|
## Edit /etc/tor/torrc
|
|
### sudo nano /etc/tor/torrc
|
|
#### Uncomment or add
|
|
##### ControlPort 9051
|
|
#### Ucomment and change to (default value is 1, change to 0)
|
|
##### CookieAuthentication 0
|
|
## Enable, Start, and Restart Tor
|
|
### sudo systemctl enable tor; sudo systemctl start tor; sleep 20; sudo systemctl restart tor
|
|
|
|
# Configuration
|
|
TARGET_URL="https://canhazip.com"
|
|
TOR_PROXY="socks5h://127.0.0.1:9050"
|
|
TOR_CONTROL_PORT=9051
|
|
DELAY=2 # Delay in seconds between requests
|
|
|
|
# Ensure you respect HIBP's API rate limits and terms of service
|
|
while true; do
|
|
echo "[+] Requesting new Tor identity..."
|
|
|
|
# Send NEWNYM signal to Tor Control Port to switch IP
|
|
echo -e 'AUTHENTICATE ""\r\nsignal NEWNYM\r\nQUIT' | nc 127.0.0.1 9051 > /dev/null
|
|
|
|
# Give Tor a brief moment to establish the new circuit
|
|
sleep "$DELAY"
|
|
|
|
echo "[+] Verifying current IP..."
|
|
CURRENT_IP=$(curl -s --proxy "$TOR_PROXY" https://canhazip.com)
|
|
echo "[+] Current Tor IP: $CURRENT_IP"
|
|
|
|
echo "[+] Sending request to Have I Been Pwned..."
|
|
# 'socks5h://' ensures DNS resolution happens through Tor, preventing leaks
|
|
curl -s --proxy "$TOR_PROXY" -H "hibp-api-key: YOUR_API_KEY" "$TARGET_URL"
|
|
|
|
echo -e "\n[+] Waiting for next iteration...\n"
|
|
sleep "$DELAY"
|
|
done
|