#!/bin/bash
#author: Jorge L. Vazquez
#purpose: this script will change the mac address to random
#========== NOTES ==================================
#and will pick a random word from password.lst in jtr for hostname
#change variables "interface" and "file" to your settings
#also macchanger needs to be installed

INTERFACE=eth0
FILE=/pentest/passwords/jtr/password.lst
WORD=$(sort -R $FILE | head -1)

#changing mac address to random
ifconfig $INTERFACE down > /dev/null
if [ $? == 0 ]; then
	printf "%s\nChanging mac address...\n"
	macchanger -r $INTERFACE 
else
	printf "%sScript encounter an error, sorry...\n"
	exit 1
fi

#changing hostname to random word from bt4-password.txt
printf "%s\nChanging Hostname...\n"
OLDHOST=$(hostname)
hostname $WORD
if [ $? == 0 ]; then
	printf "%sPrevius Hostname: $OLDHOST \n"
	printf "%sRandom Hostname: $WORD \n"
else
	printf "%sScript encounter an error, sorry...\n"
	exit 1
fi

#putting interface up
ifconfig $INTERFACE up > /dev/null
printf "\n"

#END

