This commit is contained in:
2025-05-15 18:05:07 -06:00
parent d01393b477
commit 0edd257a16
6 changed files with 65 additions and 11 deletions
+4
View File
@@ -5,3 +5,7 @@ v0.2-dev
added polling system to monitor output
added logs dir
refactored js
v0.3-dev
added toggleable list of previous scans
added link to clear all old scans
+1 -1
View File
@@ -1 +1 @@
v0.2-dev
v0.3-dev
+18 -5
View File
@@ -1,4 +1,10 @@
<!DOCTYPE html>
<?php
$dir = './scans';
$scans = array_diff(scandir($dir), array('..', '.')); # silly method to remove the . and ..
foreach($scans as $scan) {
$scanList .= "<a href='/nmaprincesspi/scans/$scan'>$scan<a><br>\n";
}
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
@@ -14,10 +20,17 @@
<br>
<input type="text" id="nmapcmd" name="nmapcmd">
<input type="button" onclick="runNmapScan()" value="Go, Baby, Go!">
<br><br>
<span class="hidden" id="link"></span>
<br>
<pre class="hidden" id="progress">
</pre>
<br>
<span class="fakelink" id="showlist" onclick="toggleShow('scanlist', 'showlist', 'Hide Previous Scans', 'Show Previous Scans')">Show Previous Scans</span>
<br>
<p class="hidden" id="link"></p>
<div id="scanlist" class="hidden">
<p><a href="run_clear_scans.php">Delete All Old Scans</a></p>
<p><?php echo $scanList; ?></p>
</div>
<br>
<br>
<pre class="hidden" id="progress"></pre>
</body>
</html>
+20 -1
View File
@@ -6,6 +6,24 @@ function getID(ID) {
return document.getElementById(ID);
}
function toggleShow(ID, htmlUpdateID=false, htmlUpdateShowing=false, htmlUpdateHidden=false) {
let elemClasses = getID(ID).classList;
if(elemClasses.contains('hidden')) {
elemClasses.remove('hidden');
if(htmlUpdateID !== false && htmlUpdateShowing !== false && htmlUpdateHidden !== false) {
getID(htmlUpdateID).innerHTML = htmlUpdateShowing;
}
} else {
elemClasses.add('hidden');
if(htmlUpdateID !== false && htmlUpdateShowing !== false && htmlUpdateHidden !== false) {
getID(htmlUpdateID).innerHTML = htmlUpdateHidden;
}
}
}
function copyToClipboard(ID) {
let copyText = getID(ID);
copyText.select();
@@ -72,7 +90,7 @@ function xhrRunNmapScan(xhrRet) {
// let xhrResponseText = xhrRet.target.responseText;
xhrJson = JSON.parse(xhrRet.target.responseText);
getID('link').innerHTML = '<a href="'+xhrJson.webName+'">Scan Report Here ('+xhrJson.webName+')</a>';
getID('link').innerHTML = '<a href="'+xhrJson.webName+'">Scan Report ('+xhrJson.webName+')</a>';
getID('link').style.display = "inline";
if(typeof pollInterval !== 'undefined') {
@@ -104,3 +122,4 @@ function runNmapScan() {
doXhr('run_scan.php', xhrRunNmapScan, 'POST', postData);
}
+17
View File
@@ -0,0 +1,17 @@
<?php
$scansDir = './scans';
$logsDir = './logs';
$scans = array_diff(scandir($scansDir), array('..', '.')); # silly method to remove the . and ..
$logs = array_diff(scandir($logsDir), array('..', '.'));
foreach($scans as $scan) {
unlink("$scansDir/$scan");
}
foreach($logs as $log) {
unlink("$logsDir/$log");
}
header("Location: /nmaprincesspi/");
?>
+3 -2
View File
@@ -8,8 +8,9 @@ error handling
php script fail
input validation fail
containerize
scans listing
c work on scans filename?
x scans listing
clear scans buttons
x work on scans filename?
fix perms
auth system
input/output validation