Pholus cleanup + conversion v0.4

This commit is contained in:
Jokob-sk
2023-08-25 07:07:18 +10:00
parent 9edbe8affc
commit 57aefdf332
6 changed files with 8 additions and 148 deletions

View File

@@ -50,8 +50,7 @@
case 'getOwners': getOwners(); break;
case 'getDeviceTypes': getDeviceTypes(); break;
case 'getGroups': getGroups(); break;
case 'getLocations': getLocations(); break;
case 'getPholus': getPholus(); break;
case 'getLocations': getLocations(); break;
case 'getNmap': getNmap(); break;
case 'saveNmapPort': saveNmapPort(); break;
case 'updateNetworkLeaf': updateNetworkLeaf(); break;
@@ -1010,53 +1009,6 @@ function getLocations() {
echo (json_encode ($tableData));
}
//------------------------------------------------------------------------------
// Query the List of Pholus entries
//------------------------------------------------------------------------------
function getPholus() {
global $db;
// SQL
$mac = $_REQUEST['mac'];
if ($mac == "Internet") // Not performing data lookup for router (improvement idea for later maybe)
{
echo "false";
return;
}
if (false === filter_var($mac , FILTER_VALIDATE_MAC)) {
throw new Exception('Invalid mac address');
}
else{
$sql = 'SELECT * from Pholus_Scan where MAC ="'.$mac.'" and Record_Type not in ("Question")';
// array
$tableData = array();
// execute query
$result = $db->query($sql);
while ($row = $result -> fetchArray (SQLITE3_ASSOC)){
// Push row data
$tableData[] = array( 'Index' => $row['Index'],
'Info' => $row['Info'],
'Time' => $row['Time'],
'MAC' => $row['MAC'],
'IP_v4_or_v6' => $row['IP_v4_or_v6'],
'Record_Type' => $row['Record_Type'],
'Value' => $row['Value'],
'Extra' => $row['Extra']);
}
if(count($tableData) == 0)
{
echo "false";
} else{
// Return json
echo (json_encode ($tableData));
}
}
}
//------------------------------------------------------------------------------
// Query the List of Nmap entries