-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extension of the NMAP functionality 07
- Remove/streamline old code - Prepare csv download for nmap scan per device - Replace "static strings" with multi-language strings - update language files Regarding to #271
- Loading branch information
Showing
8 changed files
with
181 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
foreach (glob("../db/setting_language*") as $filename) { | ||
$pia_lang_selected = str_replace('setting_language_', '', basename($filename)); | ||
} | ||
if (strlen($pia_lang_selected) == 0) {$pia_lang_selected = 'en_us';} | ||
|
||
require '../php/server/db.php'; | ||
require '../php/server/journal.php'; | ||
require '../php/templates/language/' . $pia_lang_selected . '.php'; | ||
|
||
$DBFILE = '../../db/pialert.db'; | ||
$PIA_HOST_IP = $_REQUEST['host']; | ||
$PIA_SCAN_TIME = date('Y-m-d H:i:s'); | ||
|
||
OpenDB(); | ||
|
||
function crosscheckIP($query_ip) { | ||
global $db; | ||
|
||
$sql = 'SELECT dev_LastIP FROM Devices WHERE dev_LastIP="' . $query_ip . '" UNION | ||
SELECT icmp_ip AS dev_LastIP FROM ICMP_Mon WHERE icmp_ip="' . $query_ip . '"'; | ||
$result = $db->query($sql); | ||
$row = $result->fetchArray(SQLITE3_ASSOC); | ||
$neededIP = $row['dev_LastIP']; | ||
return $neededIP; | ||
} | ||
|
||
if (filter_var($PIA_HOST_IP, FILTER_VALIDATE_IP)) { | ||
|
||
// Check if IP is already known and in DB | ||
$db_crosscheck = crosscheckIP($PIA_HOST_IP); | ||
if (isset($db_crosscheck)) { | ||
|
||
$CSVFILE = '"test","Test2","Test3"'; | ||
|
||
header('Content-Description: File Transfer'); | ||
header("Content-Type: text/csv"); | ||
header('Content-Disposition: attachment; filename=Host_'.str_replace(".", "-", $PIA_HOST_IP).'.csv'); | ||
header('Expires: 0'); | ||
header('Cache-Control: must-revalidate'); | ||
header('Pragma: public'); | ||
header('Content-Length: ' . strlen($CSVFILE)); | ||
echo $CSVFILE; | ||
|
||
// Logging | ||
//pialert_logging('a_002', $_SERVER['REMOTE_ADDR'], 'LogStr_0210', '', $PIA_SCAN_MODE . ' Scan: ' . $PIA_HOST_IP); | ||
} else { | ||
echo "Unknown IP"; | ||
// Logging | ||
//pialert_logging('a_002', $_SERVER['REMOTE_ADDR'], 'LogStr_0210', '', $PIA_SCAN_MODE . ' Scan: ' . $PIA_HOST_IP); | ||
exit;} | ||
} else { | ||
echo "Wrong parameter"; | ||
exit; | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.