Created
May 18, 2017 17:12
-
-
Save SmugZombie/7d201bd193a6036ec4b0a987fd60e324 to your computer and use it in GitHub Desktop.
Set Random Hostname
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
# Hostname Randomizer | |
# Ron Egli | |
# Get Current Hostname | |
hostn=$(cat /etc/hostname) | |
# Generate new hostname | |
newhostpre="BreachCollector-" | |
newhostrand=$(strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 12 | tr -d '\n') | |
newhost=$newhostpre$newhostrand | |
# Change hostname in /etc/hosts & /etc/hostname | |
sudo sed -i "s/$hostn/$newhost/g" /etc/hosts | |
sudo sed -i "s/$hostn/$newhost/g" /etc/hostname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment