#!/usr/bin/perl use strict; # name: change-mac # author: ap0calypse (ap0calypse@agitatio.org) # purpose: helper script for bringing an interface down # and up again with a random MAC-address # date: 2009-04-15 # replace this with your wlan-interface my $interface = "wlan0"; my @val_mac = (0 .. 9, "A" .. "F"); my $rand_mac; for (1 .. 12) { $rand_mac .= $val_mac[rand(@val_mac)]; if ( ($_ % 2 == 0) && $_ != 12) { $rand_mac .= ":"; } } system("ifconfig $interface down"); system("ifconfig $interface hw ether $rand_mac"); system("ifconfig $interface up");