EvilZone
Programming and Scripting => Projects and Discussion => : CompulsiveCoding July 28, 2015, 05:04:26 AM
-
That was a very brief description of what I have in mind.
My goal is to create a command-line application -- written in C or something -- that sets the computer's MAC address to one that is randomly generated. I'm thinking about adding an option that would save the machine's original MAC address to a *.txt file so that the user can switch back if they want to, later.
I realize this is a fairly simple application. However I think that this will be good practice for learning about MAC addresses (and how to spoof them!), as well as give me the opportunity to do something with the C language, which I had begun learning a few days ago.
If any of you have advice or input -- that is if you think I should make a change to my idea, use a different language, or simply criticize the mere notion of something so daft -- by all means DM me or click reply! :-)
-
Well if you want to do this for learning purposes sure why not, even tho making it in C sounds bit odd choice when this is so easily done in short shell script and ofc. there's GNU macchanger , which already does what you descriped and much more.
edit: Just quick example why I said this can be easily done in short shell script; in bash it could be something like this:
#generate random macaddress
macdres=$(dd if=/dev/urandom bs=1024 count=1 2> /dev/null|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/00:\2:\3:\4:\5:\6/')
#backup real macaddress, wlan0 works as example
if [ ! -f ~/mac_backup.txt ]; then
ifconfig wlan0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' > ~/mac_backup.txt
fi
#restore backup
if [ $1 = "--restore" ]; then
macdres=$(cat ~/mac_backup.txt)
fi
#randomize (or restore) macaddress
ifconfig wlan0 down
ifconfig wlan0 hw ether $macdres
ifconfig wlan0 up