1747350365

This commit is contained in:
2025-05-15 17:06:05 -06:00
parent c5f0d6e9f4
commit 41e19fa12f
10 changed files with 57 additions and 35 deletions
+1
View File
@@ -1,4 +1,5 @@
scans/* scans/*
logs/*
scratch* scratch*
*.bak* *.bak*
*.old* *.old*
+4 -1
View File
@@ -15,6 +15,9 @@
<input type="text" id="nmapcmd" name="nmapcmd"> <input type="text" id="nmapcmd" name="nmapcmd">
<input type="button" onclick="runNmapScan()" value="Go, Baby, Go!"> <input type="button" onclick="runNmapScan()" value="Go, Baby, Go!">
<br> <br>
<span class="hidden" id="out"></span> <span class="hidden" id="link"></span>
<br>
<pre class="hidden" id="progress">
</pre>
</body> </body>
</html> </html>
+36 -12
View File
@@ -14,8 +14,8 @@ function copyToClipboard(ID) {
function xhrSuccess(xhrRet) { function xhrSuccess(xhrRet) {
let xhrResponseText = xhrRet.target.responseText; let xhrResponseText = xhrRet.target.responseText;
getID('out').innerHTML = '<a href="'+xhrResponseText+'">Scan Report Here ('+xhrResponseText+')</a>'; getID('link').innerHTML = '<a href="'+xhrResponseText+'">Scan Report Here ('+xhrResponseText+')</a>';
getID('out').style.display = "inline"; getID('link').style.display = "inline";
} }
function xhr404(xhrRet) { function xhr404(xhrRet) {
@@ -41,9 +41,9 @@ function xhrLoadend(xhrRet) {
} }
} }
function doXhr(xhrFilePath, xhrMethod='GET', xhrPostData=null) { function doXhr(xhrFilePath, xhrLoadEndFun=xhrLoadEnd, xhrMethod='GET', xhrPostData=null) {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
xhr.addEventListener("loadend", xhrLoadend); xhr.addEventListener("loadend", xhrLoadEndFun);
xhr.open(xhrMethod, xhrFilePath); xhr.open(xhrMethod, xhrFilePath);
if(xhrMethod == 'POST') { if(xhrMethod == 'POST') {
@@ -68,15 +68,39 @@ function changeFavIcon(icoFile) {
icoLink.href = icoFile; icoLink.href = icoFile;
} }
function runNmapScan() { function xhrRunNmapScan(xhrRet) {
let nmapcmd = getID('nmapcmd').value; // let xhrResponseText = xhrRet.target.responseText;
console.log(nmapcmd); xhrJson = JSON.parse(xhrRet.target.responseText);
let postData = 'nmapcmd='+encodeURIComponent(nmapcmd);
doXhr('run_scan.php', 'POST', postData); getID('link').innerHTML = '<a href="'+xhrJson.webName+'">Scan Report Here ('+xhrJson.webName+')</a>';
getID('link').style.display = "inline";
if(typeof pollInterval !== 'undefined') {
clearInterval(pollInterval);
}
getID('progress').innerHTML = '';
getID('progress').style.display = 'none';
pollFile(xhrJson.runningLog);
} }
function pollFile(filePath) { function xhrPollFile(xhrRet) {
var poll = setInterval(function() { let xhrResponseText = xhrRet.target.responseText;
doXhr(filePath); getID('progress').innerHTML = xhrResponseText;
getID('progress').style.display = "block";
}
function pollFile(runningLog) {
var pollInterval = setInterval(function() {
doXhr(runningLog, xhrPollFile);
}, 1000); }, 1000);
}
function runNmapScan() {
let nmapcmd = getID('nmapcmd').value;
let postData = 'nmapcmd='+encodeURIComponent(nmapcmd);
doXhr('run_scan.php', xhrRunNmapScan, 'POST', postData);
} }
+2 -4
View File
@@ -11,8 +11,6 @@
$run_cmd = "bash ./scripts/run_scan.sh nmap -oX ./scans/$file_name --stylesheet /nmaprincesspi/xsl/princesspi-nmap.xsl $post_cmd"; $run_cmd = "bash ./scripts/run_scan.sh nmap -oX ./scans/$file_name --stylesheet /nmaprincesspi/xsl/princesspi-nmap.xsl $post_cmd";
$web_name = "/nmaprincesspi/scans/$file_name"; $web_name = "/nmaprincesspi/scans/$file_name";
echo $web_name; $exec = trim(shell_exec($run_cmd));
echo "{\"runningLog\":\"$exec\",\"webName\":\"$web_name\"}";
$exec = shell_exec($run_cmd);
echo $exec;
?> ?>
-12
View File
@@ -1,12 +0,0 @@
Starting Nmap 7.95 ( https://nmap.org ) at 2025-05-15 16:07 MDT
Nmap scan report for kasm.h.acker.is (64.20.45.110)
Host is up (0.070s latency).
Not shown: 995 filtered tcp ports (no-response)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp open https
3389/tcp open ms-wbt-server
8888/tcp open sun-answerbook
Nmap done: 1 IP address (1 host up) scanned in 7.70 seconds
+2 -1
View File
@@ -1,2 +1,3 @@
#!/bin/bash #!/bin/bash
sudo chown -R www-data:www-data .. 2>>../error.log sudo chown -R www-data:www-data .. 2>>../logs/error.log
sudo chmod +x ../logs/*
+2 -3
View File
@@ -1,4 +1,3 @@
#!/bin/bash #!/bin/bash
rm -f ../error.log 2>>./error.log rm -f ../log/* 2>>../logs/error.log
rm -f ../running.log 2>>./error.log rm -f ../scans/* 2>>../logs/error.log
rm -f ../scans/* 2>>./error.log
+3 -1
View File
@@ -1,2 +1,4 @@
#!/bin/bash #!/bin/bash
eval "$* 2>error.log 1>running.log&" runningLog="$(date +%Y%m%d%H%M%S)-$RANDOM.log"
eval "$* 2>>logs/error.log 1>logs/$runningLog&"
echo "/nmaprincesspi/logs/$runningLog"
+7 -1
View File
@@ -12,4 +12,10 @@ scans listing
c work on scans filename? c work on scans filename?
fix perms fix perms
auth system auth system
input/output validation input/output validation
work on princesspi-nmap.xsl
clean up
minimize stuff
remove rundundant code
make prettier
green class