Hostroller 0.1 release | github.com/cyberandspace

Hey there,

back again with yet another little tool that makes it easier for you to spoof the trace you leave behind on a public wifi. Enter the Hostroller!

It is an easy shellscript that interactively changes the hostname of your Ubuntu 12.04 LTS to look something more like a generic Windows or random Macbook’s name. Just run it before you run macboot and voila your connection won’t look the same. Do it everytime you connect to a public wifi and you will smear the footprint your computer leaves behind.

Yet, beware that this is the very first release and it isn’t fully tested. So if you find some bugs please let me know. Also if you have suggestions how to improve the code in someway I’m all ears.

Thanks goes to http://www.blackmoreops.com, who inspired some lines of code:

http://www.blackmoreops.com/2013/12/12/change-hostname-kali-linux/#Change_hostname_randomly_in_each_boot_time

You can find the code now under my newly installed github repo at:
https://github.com/cyberandspace/hostroller

But I also include it here of course:

#!/bin/bash

# Alright now, introducing The Hostname Roller v 0.1 !
# A script to make your hostname look like a generic Windows or MacBook machine.
# In combination with the Macbot v 0.3 script it provides the ability to spoof
# the trace you leave on a (public) network.
#
#
# NEEDED PREREQUISITES:
# 
# - A wordlist from http://www.outpost9.com/files/wordlists/Given-Names.zip
#   that you need to copy to your /usr/share/dict/ directory for the script 
#   work. 
#
# - The file /usr/share/dict/american-english need to be present, too.
#
# - Also to start system services etc. you need to be root, or sudo the script
#
#
#

### Function that applies the changes provided by the main code block



rollit () {
  ### This part is taken from: 
  ### http://www.blackmoreops.com/2013/12/12/change-hostname-kali-linux/#Change_hostname_randomly_in_each_boot_time
  ##  Thanks for the good work mate.
  ##  I also modified the part about the fully qualified domainname, since it is not necessary if you don't want to run a server.

  cp -n /etc/hosts{,.old}
  idomainname=$(domainname -i)
  fdomainname=$(domainname -f)

  echo $new_hostname > /etc/hostname
  mv /etc/hosts /etc/hosts.old
  echo "127.0.0.1 localhost" > /etc/hosts
  echo "127.0.1.1 $new_hostname" >> /etc/hosts
  echo "$idomainname  $fdomainname    $new_hostname" >> /etc/hosts 
  echo "$idomainname   		       $new_hostname" >> /etc/hosts

  echo "# The following lines are desirable for IPv6 capable hosts" >> /etc/hosts
  echo "::1     localhost ip6-localhost ip6-loopback" >> /etc/hosts
  echo "ff02::1 ip6-allnodes" >> /etc/hosts
  echo "ff02::2 ip6-allrouters" >> /etc/hosts

  ## I'm not to sure about this part on Ubuntu, since the Author wrote this script for Kali.
  ## So to use this script on Kali, or other Linux distros, you might have to work on that part.


  ## Cleaning up the /etc/NetworkManager/NetworkManager.conf
  service network manager stop
  sed -i  "/^[keyfile]/d" /etc/NetworkManager/NetworkManager.conf
  sed -i  "/^hostname = .*/d" /etc/NetworkManager/NetworkManager.conf
  echo "[keyfile]" >> /etc/NetworkManager/NetworkManager.conf
  echo "hostname = $new_hostname" >> /etc/NetworkManager/NetworkManager.conf
  service network-manager start

  echo "Rolled hostname to: $new_hostname"
  echo
  echo
  exit
}



###
###	Main function
###

clear
echo '******* The Hostname Roller v 0.1 *******'
echo
echo
echo 'Select hostname pattern from following options: '
echo

PS3='Please enter your choice: '
options=("Option 1: Windows" "Option 2: Mac OSX" "Quit")

select opt in "${options[@]}"
do
    case $opt in
        "Option 1: Windows")
	    echo
            echo "Creating Windows hostname ..."
	    echo

            FILE=/usr/share/dict/american-english
	    WORD=$(sort -R $FILE | head -1)
            SEED=$RANDOM
	    PARTB=$(echo $SEED$WORD | md5sum | cut -c1,2,3,4,5,6,7,8,9,10,11 | tr '[:lower:]' '[:upper:]')
	    new_hostname=$(echo WIN-$PARTB)
	    rollit
	    break
	    ;;


   

        "Option 2: Mac OSX")
            echo
	    echo "Creating MacBook hostname ..."
	    echo

	    FILE=/usr/share/dict/Given-Names
	    NAME=$(sort -R $FILE | head -1)
	    new_hostname=$(echo "$NAME's MacBook")
            rollit
            break
	    ;;



        "Quit")
            break
            ;;
        *) echo invalid option;;
    esac
done



Advertisements

Macbot 0.2 – An interactive commandline script for macchanger *** Major Bugfix ***

*** MAJOR BUGFIX, Version 0.2 release ***

Ever got angry when Network Manager didn’t use the new MAC address you just assigned to interface wlan0? Macbot 0.2 is the solution to your problems.

Just finished this little script that makes changing your MAC address easier. It runs under root in any Debian environment and needs macchanger and bash installed.

1. It will just query you for the interface you want to change.

2. It will shut down network-manager

3. It will change your maccaddres via (macchanger -A option).

4. It will rename your WLAN networks in /etc/NetworkManager/system-connections/ , changing ‘space’ to ‘_’

5. It will let you select the WLAN with which you want to use the spoofed MAC address

6. It will change the file accodingly and display back what your new MAC address is, then quits.

If you got improvements, corrections or any other comments, let me know.

Changelog 0.2:
—————

Major fixes:

– Fixed the part that places the cloned-mac-address=XX:XX:XX:XX:XX:XX into the corresponding
/etc/NetworkManager/system-connections/file. Now, it doesn’t put it fixed into line 12 of the
the WLAN file, but actively looks for any ‘cloned-mac-address=XX:XX:XX:XX:XX:XX’, deletes
it and writes it anew, just below the ‘mac-address=XX:XX:XX:XX:XX:XX’ string, where it does
belong!

Minor fixes:

– Modified output string, so it repeats the chosen interface.

—————

Code:

#!/bin/bash

# This is the macbot.sh script. An easy script to interactively run macchanger on debian distributions employing network-manager.
# Needs to be run as root.
# Thanks to Hai @ http://wuhrr.wordpress.com for the bit with select, and http://chris.com/ascii/index.php?art=television/futurama
# for the ascii_art.
# GNU General Public License applies.
# Author: Manuel Weber (mmweber@gmx.net)


#	This is the main screen.
#	It includes user input for network interface that mac has to be changed.
#	Sanitizing input has yet to be implemented.
#
#  Changelog 0.2
#--------------------
#
#  - Fixed the part that places the cloned-mac-address=XX:XX:XX:XX:XX:XX into 
#    doesn't put it fixed into line 12 of the the WLAN file, but actively looks
#    for any 'cloned-mac-address=XX:XX:XX:XX:XX:XX', deletes it and writes it 
#    anew, just below the 'mac-address=XX:XX:XX:XX:XX:XX' string, where it does
#    belong!
#  
#  - Modified output string, so it repeats the chosen interface.	
#
#--------------------


echo
echo
echo "		###	The MAC Bot 0.2		###"
echo
echo
echo
echo "			   T		"
echo '			 .-"-.		'
echo "			|  ___|		"
echo "			| (.\/.)	"
echo "			|  ,,,' 	"
echo "			| '###		"
echo "			 '----'		"


-

echo
echo
echo 'Enter the WLAN interface you want to change (eg. wlan0, wlan1,...) : '
echo


read int 
echo

ifconfig $int down
service network-manager stop
macchanger -A $int
echo
echo

mac=`ip link show $int | awk '/ether/ {print $2}'`


# This part asks the user which Network has to be configured.
# 
#

echo 'List of available, already used WLANs: '
echo
echo




# Changes to network directory
cd /etc/NetworkManager/system-connections/



# Change network names to be withouth space characters
rename "s/ /_/g" *



# Set the prompt for the select command
PS3="Type a number or 'q' to quit: "



# Create a list of files to display
fileList=$(find . -maxdepth 1 -type f)




# Show a menu and ask for input, then remove any old cloned MAC addresses
# and replace them with a fresh one.

select fileName in $fileList; do
	if [ -n "$fileName" ]; then
		sed -i  "/^cloned-mac-address=.*/d" ${fileName}
		sed -i  "/^mac-address=.*/a\cloned-mac-address=$mac" ${fileName}

	fi
	break
done



ifconfig wlan0 up
service network-manager start

echo
echo
echo
echo "Changed MAC address of interface $int to: $mac"
echo
echo
echo

# Functionality to add to script:
# 1. Display network interfaces to choose from
# 2. Display macchangermodes, a)Custom b) Another c)random
# 3.