Add a manual nmap scan

Because of my own network structure an automatic nmap scan is not useful. However, to be able to perform such a scan if necessary, I have added a tab with a manual nmap scan in the DeviceDetails.
This commit is contained in:
leiweibau
2022-06-28 20:52:34 +02:00
parent f5329ad495
commit 334eea8592
3 changed files with 51 additions and 5 deletions

View File

@@ -95,6 +95,7 @@
<div id="navDevice" class="nav-tabs-custom">
<ul class="nav nav-tabs" style="fon t-size:16px;">
<li> <a id="tabDetails" href="#panDetails" data-toggle="tab"> Details </a></li>
<li> <a id="tabNmap" href="#panNmap" data-toggle="tab"> nmap </a></li>
<li> <a id="tabSessions" href="#panSessions" data-toggle="tab"> Sessions </a></li>
<li> <a id="tabPresence" href="#panPresence" data-toggle="tab"> Presence </a></li>
<li> <a id="tabEvents" href="#panEvents" data-toggle="tab"> Events </a></li>
@@ -426,6 +427,42 @@
</table>
</div>
<!-- tab page 5 ------------------------------------------------------------ -->
<div class="tab-pane fade" id="panNmap">
<!-- Datatable Session -->
<div style="width:100%; text-align: center;">
<button type="button" class="btn btn-default pa-btn" style="margin: auto;" onclick="loadDoc()">execute quick scan on <?php echo $_REQUEST['lastip'];?></button>
</div>
<div id="scanoutput" style="margin-top: 30px;"></div>
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("scanoutput").innerHTML = this.responseText;
}
};
xhttp.open("POST", "./php/server/nmap_scan.php", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("scan=<?php echo $_REQUEST['lastip'];?>");
}
</script>
</div>
<!-- ----------------------------------------------------------------------- -->
<!-- tab page 3 ------------------------------------------------------------ -->
<div class="tab-pane fade table-responsive" id="panPresence">
@@ -477,7 +514,6 @@
</div>
<!-- /.row -->
<!-- ----------------------------------------------------------------------- -->
</section>
<!-- /.content -->
</div>

View File

@@ -120,9 +120,9 @@
<th>Last IP</th>
<th>MAC</th>
<th>Status</th>
<!-- <th>MAC</th> -->
<!-- <th>Last IP Order</th> -->
<!-- <th>Rowid</th> -->
<th>MAC</th>
<th>Last IP Order</th>
<th>Rowid</th>
</tr>
</thead>
</table>
@@ -222,7 +222,7 @@ function initializeDatatable () {
// Device Name
{targets: [0],
'createdCell': function (td, cellData, rowData, row, col) {
$(td).html ('<b><a href="deviceDetails.php?mac='+ rowData[10] +'" class="">'+ cellData +'</a></b>');
$(td).html ('<b><a href="deviceDetails.php?mac='+ rowData[10] +'&lastip='+ rowData[7] +'" class="">'+ cellData +'</a></b>');
} },
// Favorite

View File

@@ -0,0 +1,10 @@
<?php
$PIA_HOST_IP = $_REQUEST['scan'];
exec('nmap '.$PIA_HOST_IP, $output);
echo '<pre style="border: none;">';
foreach($output as $line){
echo $line . "\n";
}
echo '</pre>';
?>