#!/usr/bin/perl use strict; my $iw = "/usr/sbin/iw"; my $ip = "/sbin/ip"; my $wpa_s = "/usr/local/sbin/wpa_supplicant"; my $ssid = "tesla-2g-bcm"; my $key = "hipicayemotherfucker"; my $phy = "phy0"; my $max = 32; my $i; my $bmac = "00:01:02:03:04:"; my $cmd; # Create stations for ($i = 0; $i<$max; $i++) { runCmd("$iw phy $phy interface add sta$i type station"); my $mc5 = "$i"; if (length($mc5) == 1) { $mc5 = "0$mc5"; # pad mac octet } my $mac = "$bmac$mc5"; runCmd("$ip link set sta$i address $mac"); runCmd("$iw dev sta$i set power_save off"); } # Bring them up with WPA for ($i = 0; $i<$max; $i++) { open(FD, ">sta$i" . "_wpa.conf") || die("Couldn't open file: $!\n"); print FD " ctrl_interface=/var/run/wpa_supplicant fast_reauth=1 #can_scan_one=1 network={ ssid=\"$ssid\" proto=RSN key_mgmt=WPA-PSK psk=\"$key\" pairwise=CCMP group=CCMP } "; #runCmd("$wpa_s -B -i sta$i -c sta$i" . "_wpa.conf -P sta$i" . "_wpa.pid -t -f sta$i" . "_wpa.log"); runCmd("$wpa_s -B -i sta$i -c sta$i" . "_wpa.conf -P sta$i" . "_wpa.pid -t "); } sub runCmd { my $cmd = shift; print "$cmd\n"; `$cmd`; }