Update Portal Auth and Cursed Screech (#30)

This commit is contained in:
Nick
2018-07-16 22:21:02 -04:00
committed by Sebastian Kinne
parent a517d2e4d4
commit ac9df1c5bb
76 changed files with 2585 additions and 5974 deletions

View File

@@ -2,25 +2,33 @@
class MyPortal extends Portal
{
public function handleAuthorization()
{
// handle form input or other extra things there
public function handleAuthorization()
{
// Call parent to handle basic authorization first
parent::handleAuthorization();
// Call parent to handle basic authorization first
parent::handleAuthorization();
// Check for other form data here
}
}
public function showSuccess()
{
// Calls default success message
//parent::showSuccess();
parent::redirect();
}
/**
* Override this to do something when the client is successfully authorized.
* By default it just notifies the Web UI.
*/
public function onSuccess()
{
// Calls default success message
parent::onSuccess();
}
public function showError()
{
// Calls default error message
parent::showError();
}
/**
* If an error occurs then do something here.
* Override to provide your own functionality.
*/
public function showError()
{
// Calls default error message
parent::showError();
}
}

View File

@@ -0,0 +1,45 @@
<?php
/**
* getClientMac
* Gets the mac address of a client by the IP address
* Returns the mac address as a string
* @param $clientIP : The clients IP address
* @return string
*/
function getClientMac($clientIP)
{
return trim(exec("grep " . escapeshellarg($clientIP) . " /tmp/dhcp.leases | awk '{print $2}'"));
}
/**
* getClientSSID
* Gets the SSID a client is associated by the IP address
* Returns the SSID as a string
* @param $clientIP : The clients IP address
* @return string
*/
function getClientSSID($clientIP)
{
// Get the clients mac address. We need this to get the SSID
$mac = getClientMac($clientIP);
// get the path to the log file
$pineAPLogPath = trim(file_get_contents('/etc/pineapple/pineap_log_location'));
// get the ssid
return trim(exec("grep " . $mac . " " . $pineAPLogPath . "pineap.log | grep 'Association' | awk -F ',' '{print $4}'"));
}
/**
* getClientHostName
* Gets the host name of the connected client by the IP address
* Returns the host name as a string
* @param $clientIP : The clients IP address
* @return string
*/
function getClientHostName($clientIP)
{
return trim(exec("grep " . escapeshellarg($clientIP) . " /tmp/dhcp.leases | awk '{print $4}'"));
}