« Backtrack CD and KVPN | Home | Cisco and Syslogd »
Backtrack CD and Random Wireless Mac Addresses
By klard | July 15, 2006
So….when I boot the Backtrack CD I often want to connect with a random mac address for reasons many will understand. That being the case I did a little looking around and was able to come up with a perl script to run when I boot the CD. I have read extensively that the use of system calls is probably not the proper way yo accomplish this but hey, it works.
#!/usr/bin/perl
#
# A quick script that generates a random varible
# It looks suprisingly like a MAC address
# Something like: 23:00:C0:FF:EE:00
# However it will take the first set of octets and set a vendor code
# Vendor codes are in /usr/share/ethereal/manuf
#
system("xconf");
chdir ("/root/.mozilla/plugins");
system("ln -s /usr/lib/jre1.5.0_03/plugin/i386/ns7/libjavaplugin_oji.so .");
#
for (`cat /usr/share/ethereal/manuf`){
push (@vendorcode, $1) if ($_ =~ /(^[^#]\S+)\s/);
}
srand(time() % 345);
$mac =sprintf("%s:%X%X:%X%X:%X%X",$vendorcode[rand(1) * $#vendorcode],rand(16),rand(16),rand(16),rand(16),rand(16),rand(16));
$setmac = "ifconfig ath0 hw ether $mac";
system("$setmac");
system("ifconfig ath0 up");
system("dhcpcd ath0");
system("startx");
This little perl script actually combines several of the things I have already written about. It adds the java link as well as changing the mac address, starting dhcp for the wireless card and starting x. Have fun.
Topics: Backtrack CD |

