MAC Randomizer(perl)
From Hak5
Contents |
[edit] Credit
The idea for this was taken from a5an0 (MAC Randomizer) and rewritten by me because well, i like perl. You can refer to the article about a5an0's python version for information about a tool to use on windows
[edit] Requirements
- Linux, BSD or another form of UNIX
- Perl
[edit] The Program
#!/usr/bin/perl
# macrand.pl
# Writen by Xidus (aka roland[xidus]) after reading a5an0's python code
use strict;
my @hex = qw/0 1 2 3 4 5 6 7 8 9 A B C D E F/; # Yay for hex :D
my $mac = "00"; # Because the guy before me did it!
my $inter = "eth0"; # Whatever youre interface is
for (1..5) {
$mac = $mac . ":" . @hex[rand(16)] . @hex[rand(16)]; # Means for shorter code :)
}
print "mac address: " . $mac . "\n"; # Incase the user wants to know the new mac
system("ifconfig " . $inter . " down"); # Stop the interface :o
system("ifconfig " . $inter . " hw ether " . $mac); # Change youre mac address to the new one
system("ifconfig " . $inter . " up "); # Start up the interface :)
[edit] Notes
- The script depends on the user having a operating system that supports the ifconfig command, Although most linux systems do support this a few dont
- This script can be placed in a startup script or ran whenever it is needed
[edit] Afterthought
Please edit this to your delight, add features and have fun :)


