I have seen several of these around and I frankly don't understand WHY. What is their purpose other than perhaps to teach coding. I understand the need to spoof a MAC address. But why does it have to be random. That makes no sense to me.
Hi everyone. I am new in you community and I hope I can learn a lot here and share my knowledge with you.
I've created a tool for changing the MAC address of a linux box. I work as Pentester in Mexico City and sometimes during the pentest some sysadmin triest to block us creating ACLs for the IPs or Mac Address of our boxes, so I created this script that randomly generates a new Mac and assign it to the device you input.
I hope you find it useful.
Here is the code.
You can visit the source post in my blog:Code:#!/bin/bash # Script by Adrian Puente Z. apuente _AT_ hackarandas _dot_ com # Powered by Hackarandas www.hackarandas.com # Licensed by GNU GPLv3 # http://www.gnu.org/licenses/gpl-3.0.txt [ $# -eq 0 ] && echo "Sintax: `basename $0` <interface>" && exit 0 [ `id -u` -ne 0 ] && echo "Only root can do that! sudoing…" if [ "$EUID" != 0 ]; then sudo `which $0` $1; exit; fi INT=$1 function gennewmac { hexdump /dev/urandom | head -3 |\ cut -d‘ ‘ -f2 | while read -n 2 i do echo -n $i: done | sed ’s/::/:/g;s/:$//g’ } if ifconfig ${INT} 2> /dev/null 2>&1 | head -1 then NEWMAC=`gennewmac` sleep 3 if ifconfig ${INT} down hw ether ${NEWMAC} 2>/dev/null then echo Interface ${INT} has new mac: ifconfig ${INT} 2> /dev/null 2>&1 | head -1 ifconfig ${INT} up echo Restart dhcp client to get a new IP. else echo "Error changing MAC to ${NEWMAC}!" echo "Try again with the same command." exit 1 fi else echo "Interface ${INT} doesn’t exists!" exit 1 fi exit 0
Hackarandas
If you have any doubt or comment plz tel me.
Greets,
..:: ch0ks ::..
I have seen several of these around and I frankly don't understand WHY. What is their purpose other than perhaps to teach coding. I understand the need to spoof a MAC address. But why does it have to be random. That makes no sense to me.
That's one of the ways in which skiddies and their ilk can try to do bad things to (and with) other peoples networks and kittens.
I'm not trying to be sarcastic---but why not just use:
macchanger ethx -r
Last edited by prelate; 04-10-2010 at 01:31 AM.
I agree...macchanger far faster....