Skip to content

KALI – Start Kali with a new hostname on every boot

13/11/2016

If you’re downloading a lot, you may find that the name of your device will be blocked.  There is a way to change your host name every time you reboot.  This is naughty but nice.  My cautions have been added to the end of the article.

Step 1 – Create a new file called changehost.sh

Use Gedit to create a new file.

Type this code into the file changehost.sh.

#!/bin/bash

cp -n /etc/hosts{,.old}

newhn=$(cat /dev/urandom | tr -dc 'A-Za-z' | head -c8)
hostnamectl set-hostname $newhn

echo "127.0.0.1    localhost" > /etc/hosts
echo "127.0.0.1    $newhn" >> /etc/hosts

exit

Step 2 – Gedit a second file

The code is:

/etc/systemd/system/changehost.service
[Unit]
Description=Hostname Randomizer

[Service]
ExecStart=/usr/bin/changehost.sh


[Install]
WantedBy=multi-user.target

Enable the service
systemctl enable changehost.service

*****

Or run it at any time manually

service changehost start

****

I have seen companies and universities block the hostname rather than block an IP – so this should keep your laptop from being detected.

CAUTION

  1. If you are using OpenVAS, don’t do this.  OpenVAS uses an SSL certificate.  Any software that partially autheticates using the hostname will fail.
  2. Only use if you want to download a lot, and you’re being blocked.

Reference:

https://forums.kali.org/showthread.php?33179-UPDATED-HOWTO-Start-Kali-with-a-new-hostname-on-every-boot

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: