mirror of
https://github.com/hak5/nano-tetra-modules.git
synced 2025-10-29 16:58:09 +00:00
Update Portal Auth and Cursed Screech (#30)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
45
PortalAuth/includes/scripts/skeleton/helper.php
Normal file
45
PortalAuth/includes/scripts/skeleton/helper.php
Normal 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}'"));
|
||||
}
|
||||
Reference in New Issue
Block a user