All pastes #175882 Raw Edit

Stuff

public text v1 · immutable
·published 2006-09-19 06:13 UTC
rendered paste body
#! /usr/bin/perl
############################################################
# 04/12/2004                                               #
# SirMACsAlot automated MAC address                        #
# changer for Linux, FreeBSD, and OpenBSD                  #
# SirMACsAlot.pl written and maintained by                 #
# roamer@worldwidewardrive.org                             #
# can be downloaded from                                   #
# http://www.michiganwireless.org/tools/sirmacsalot/       #
###########################################################


print "\n\n";
print "SirMACsAlot v2.1 \n";
print "by Roamer \n";
print "Report Bugs to roamer\@worldwidewardrive.org \n";
print "\n\n";


startme();


sub startme
{
print "Choose your OS by number: \n";
print "1. Linux: \n";
print "2. FreeBSD (should work for Mac OSX but is untested): \n";
print "3. OpenBSD: \n";
$os=<STDIN>;
chomp $os;

if ($os == 1)
{
linux_mac();
}

elsif ($os == 2)
{
freebsd_mac();
}

elsif ($os == 3)
{
openbsd_mac();
}

else 
{
print "Please choose the number 1, 2, or 3. \n";
startme();
}

}

sub linux_mac
{
print "Enter the interface to change the MAC of (ex eth1): ";
$interface=<STDIN>;
chomp $interface;

$down1="ifconfig $interface down";
system($down1);

print "Enter the MAC address to use: ";
$mac=<STDIN>;
chomp $mac;

$machak="ifconfig $interface hw ether $mac";
system($machak);

$up1="ifconfig $interface up";
system($up1);
}

sub freebsd_mac
{
print "Enter the interface to change the MAC of (ex fxp1): ";
$interface=<STDIN>;
chomp $interface;

$down1="ifconfig $interface down";
system($down1);

print "Enter the MAC address to use: ";
$mac=<STDIN>;
chomp $mac;

$machak="ifconfig $interface ether $mac";
system($machak);

$up1="ifconfig $interface up";
system($up1);

}

sub openbsd_mac
{
print "OpenBSD Functionality Requires that you have compiled 'sea' on your 
system.\n";
print "sea.c has been included with this distribution of SirMACsAlot \n";
print "Enter the interface to change the MAC of (ex wi1): ";
$interface=<STDIN>;
chomp $interface;

$down1="ifconfig $interface down";
system($down1);

print "Enter the MAC address to use (Use the format 00:00:00:00:00:00)";
$mac=<STDIN>;
chomp $mac;

$machak="sea -v $interface $mac";
system($machak);

$up1="ifconfig $interface up";
system($up1);

}