I wrote this quick&dirty Perl script to randomize MAC address. Tested on BT4R2, works fine.
The script automates ifconfig down and up process, but you can comment this lines if you want to do it manually.Code:#!/usr/bin/perl # MAC ADDRESS RANDOMIZER # by m0skit0 (acidkaos@hotmail.com) # 16/03/2011 use strict; # GLOBALS my $device; sub check_args() { if ($#ARGV != 0) { print "Usage: perl mac_addr_randomize <device>\n"; exit; } $device = $ARGV[0]; } sub generate_random_mac() { my $mac = ""; for(my $i = 0; $i < 6; $i++) { $mac = $mac.sprintf("%02x", int(rand(256))).":"; } chop($mac); return $mac; } sub main() { check_args(); my $new_mac = generate_random_mac(); print $new_mac."\n"; system("ifconfig", $device, "down"); system("macchanger", "-m", $new_mac, $device); system("ifconfig", $device, "up"); return; } main();
PS: if you're on a DHCP network, you'll need to send a new DHCPREQUEST to fill the kernel routing table.
PS: I'm still learning Perl, so be kind xD
PS: please if this does not fit here, my apologies!![]()



