#!/usr/bin/perl -w # # $Id: ranmac.pl,v 0.1 2003/12/26 21:34:05 goony Exp $ # # ranmac.pl v0.1 - random spoofs MAC generator # Copyright (c) 2003 Matteo Cantoni aka goony # # Spoofs MAC with random address, sets up a wireless # interface in monitor mode. # # Usage: ranmac.pl -i interface [-m] # # Based on macninja.pl, by dual . # # Notes: - tested on OpenBSD 3.4 with Dlink 650 and Cisco Aironet 352 lcm # - you can install 'prism2ctl' via security/bsd-airtools port; # use Getopt::Std; my $author = "goony "; my $version = "v0.1"; my $usage=" ranmac $version by $author\n\n Usage: ranmac.pl -i interface [-m]\n interface : interface to manipulate, ; -m : to enable monitor mode with \'prism2ctl\';\n "; #system 'clear'; our($opt_m,$opt_i); getopts('mi:'); die $usage if (!($opt_i) || !($opt_i =~ /(an\d)|(wi\d)/)); my $cnt = 0; my $int = $opt_i; while ($cnt < 6) { $rand = rand(255); if ($rand < 16) { $rand += 16; $hex = sprintf("%X", $rand); } else { $hex = sprintf("%X", $rand); } $mac[$cnt] = $hex; $cnt++; } $address = "$mac[0]:$mac[1]:$mac[2]:$mac[3]:$mac[4]:$mac[5]"; system("/sbin/ifconfig $int down"); system("sleep 1"); if ($opt_i =~ /an\d/){ system("/sbin/ancontrol $int -m $address"); } elsif ($opt_i =~ /wi\d/){ system("/sbin/wicontrol $int -m $address"); } system("sleep 1"); system("/sbin/ifconfig $int up"); if ($opt_m){ if ($opt_i =~ /an\d/){ print "\n dho...\n\n"; exit(0); } else { system("/usr/local/sbin/prism2ctl $int -m"); } } print "\n ranmac $version by $author\n"; print "\n + Now $int have this MAC address: $address"; print ("\n + Enable monitor mode!") if ($opt_m); print "\n + Ready to wardrive...\n\n"; exit(0);