diff --git a/js/nmaprincesspi.js b/js/nmaprincesspi.js index f5abe69..e459adb 100644 --- a/js/nmaprincesspi.js +++ b/js/nmaprincesspi.js @@ -2,6 +2,9 @@ Princess Pi's Magical Standard Code! */ +// globals +var pollInterval = null; + function getID(ID) { return document.getElementById(ID); } @@ -90,18 +93,17 @@ function xhrRunNmapScan(xhrRet) { // let xhrResponseText = xhrRet.target.responseText; xhrJson = JSON.parse(xhrRet.target.responseText); - getID('link').innerHTML = 'Scan Report ('+xhrJson.webName+')'; - getID('link').style.display = "inline"; - - if(typeof pollInterval !== 'undefined') { + if(pollInterval !== null && typeof pollInterval !== 'undefined') { clearInterval(pollInterval); } + getID('link').innerHTML = 'Scan Report ('+xhrJson.webName+')'; + getID('link').style.display = "inline"; + getID('progress').innerHTML = ''; getID('progress').style.display = 'none'; pollFile(xhrJson.runningLog); - } function xhrPollFile(xhrRet) { @@ -111,7 +113,7 @@ function xhrPollFile(xhrRet) { } function pollFile(runningLog) { - var pollInterval = setInterval(function() { + pollInterval = setInterval(function() { doXhr(runningLog, xhrPollFile); }, 1000); } diff --git a/todo.txt b/todo.txt index a4479c5..e1c8df5 100644 --- a/todo.txt +++ b/todo.txt @@ -3,6 +3,7 @@ x add random number to file to prevent enumeration x move and edit scripts x status/notify when done x polling xml file? +x bug on second scan in progress pre error handling nmap fail php script fail