Sinisterly
Tutorial Linux Automated Hostname and MAC Address Randomization - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Hacking (https://sinister.li/Forum-Hacking)
+--- Forum: Tutorials (https://sinister.li/Forum-Tutorials)
+--- Thread: Tutorial Linux Automated Hostname and MAC Address Randomization (/Thread-Tutorial-Linux-Automated-Hostname-and-MAC-Address-Randomization)



Linux Automated Hostname and MAC Address Randomization - EliteWizard42 - 11-27-2023

I am using this code successfully on Ubuntu 22.04 LTS.

First, we set automatic mac randomization, then Hostname randomization. With both randomizations enabled, each time we boot up the system, we get a new hostname and WIFI mac address, appearing as a new computer to any WIFI networks we connect to.


mac randomization:

1. first, Create the file /etc/NetworkManager/conf.d/00-macrandomize.conf and edit it with sudo. Append the following into the file:



2. copy paste this code into your text editor for the macrandomize.conf file:

[device]
wifi.scan-rand-mac-address=yes

[connection]
wifi.cloned-mac-address=random
ethernet.cloned-mac-address=random
connection.stable-id=${CONNECTION}/${BOOT}


3. run this terminal command to restart network manager:

systemctl restart NetworkManager



hostname randomization:


macrandomization.sh :

#!/bin/bash

hostnamectl hostname "$(shuf -n 1 /home/USER/Desktop/Texts/hostnames1.txt)"



macrandomize.service :

[Unit]
Description=Randomize Hostname upon device bootup, before network interface starts.
Before=network-pre.target

[Service]
Type=oneshot
ExecStart=/bin/bash /usr/bin/macrandomize.sh

[Install]
WantedBy=network-pre.target



Thank you and enjoy Smile


RE: Linux Automated Hostname and MAC Address Randomization - JuanRaul123 - 12-03-2023

Yo man thanks for this appreciate it.