Generate a vanity hostname for v3 onion link for tor on linux
Page 1 of 1
Generate a vanity hostname for v3 onion link for tor on linux
- Code:
sudo apt install -y openssl libssl-dev
- Code:
#!/bin/bash
# (c) J~Net 2024
#
# Usage: sudo ./generate.sh
DEFAULT_PREFIX="jnet"
# Prompt user for the desired prefix, defaulting to "jnet" if none provided
read -p "Enter Desired Short Prefix (max 6 chars, default is '$DEFAULT_PREFIX'): " PREFIX
# Use default if no prefix is entered
if [ -z "$PREFIX" ]; then
PREFIX="$DEFAULT_PREFIX"
echo "No Prefix Entered. Using Default Prefix: '$PREFIX'"
fi
# Ensure prefix does not exceed 6 characters
if [ "${#PREFIX}" -gt 6 ]; then
echo "Error: Prefix too long. Use a prefix of up to 6 characters."
exit 1
fi
while true; do
# Stop Tor to safely regenerate hidden service keys
sudo systemctl stop tor
sleep 5 # Allow time for Tor to fully stop
# Remove the hidden service directory completely to avoid caching issues
sudo rm -rf /var/lib/tor/hidden_service
sleep 2 # Small delay to ensure the directory is fully removed
# Recreate the hidden service directory with proper permissions
sudo mkdir -p /var/lib/tor/hidden_service
sudo chown -R debian-tor:debian-tor /var/lib/tor/hidden_service
sudo chmod 700 /var/lib/tor/hidden_service
# Start Tor to regenerate the hidden service keys
sudo systemctl start tor
sleep 20 # Wait for Tor to generate the keys
# Retrieve and display the generated hostname
HOSTNAME=$(sudo cat /var/lib/tor/hidden_service/hostname 2>/dev/null)
if [ -z "$HOSTNAME" ]; then
echo "Hostname not generated yet. Retrying..."
sleep 5
continue
fi
echo "Generated Address: $HOSTNAME"
# Check if the hostname begins with the desired prefix
if [[ "$HOSTNAME" == "$PREFIX"* ]]; then
echo "Successfully Generated a V3 Onion Address Starting with '$PREFIX': $HOSTNAME"
# Set permissions for security
sudo chown -R debian-tor:debian-tor /var/lib/tor/hidden_service
sudo chmod 700 /var/lib/tor/hidden_service
sudo chmod 600 /var/lib/tor/hidden_service/*
echo "Permissions set to secure defaults."
break
else
echo "Generated Address Does Not Start With '$PREFIX'. Retrying..."
fi
done
Similar topics
» Generate a vanity hostname for v3 onion link for tor on linux
» JNET Onion V3 Link Web Server Setup Example With Working Link
» The Pirate Bay Onion V3 Link
» Free Security Onion
» Using Sed bash Script On Linux To Generate Morse Code Without Sound
» JNET Onion V3 Link Web Server Setup Example With Working Link
» The Pirate Bay Onion V3 Link
» Free Security Onion
» Using Sed bash Script On Linux To Generate Morse Code Without Sound
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum