SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Bunch of new scan management capabilities.
smicalleffe6e5a75f305
diff --git a/dyn/newscan.tmpl b/dyn/newscan.tmplindex 2c904db4..37f71e55 100644--- a/dyn/newscan.tmpl+++ b/dyn/newscan.tmpl@@ -35,24 +35,17 @@</script><h2>New Scan</h2>-% if alreadyRunning == True:-<div class="alert alert-error">-<button type="button" class="close" data-dismiss="alert">×</button>-<h4>Error Encountered</h4>-Another scan is currently running (${runningScan}). Please either wait for that scan to complete, or abort it before running this one.-</div>-% endif<form class="form" action='${docroot}/startscan' method='POST'><div class="control-group"><label class="control-label" for="scanname">Scan Name</label><div class="controls">- <input type="text" id="scanname" name="scanname" placeholder="Descriptive name for this scan.">+ <input type="text" id="scanname" name="scanname" value="${scanname}" placeholder="Descriptive name for this scan."></div></div><div class="control-group"><label class="control-label" for="scantarget">Seed Target</label><div class="controls">- <input type="text" data-toggle='popover' data-html=true data-animation=true data-title='Usage' data-content='The <i>Seed Target</i> can be one of the following. SpiderFoot will automatically detect the target type based on the format of your input.<br><br><b>Domain Name</b>: e.g. <i>example.com</i><br><br><b>IP Address</b>: e.g. <i>1.2.3.4</i><br><br><b>Hostname/Sub-domain</b>: e.g. <i>abc.example.com</i><br><br><b>Subnet</b>: e.g. <i>1.2.3.0/24</i>' data-placement='right' id="scantarget" name="scantarget" placeholder="Starting point for the scan.">+ <input type="text" value="${scantarget}" data-toggle='popover' data-html=true data-animation=true data-title='Usage' data-content='The <i>Seed Target</i> can be one of the following. SpiderFoot will automatically detect the target type based on the format of your input.<br><br><b>Domain Name</b>: e.g. <i>example.com</i><br><br><b>IP Address</b>: e.g. <i>1.2.3.4</i><br><br><b>Hostname/Sub-domain</b>: e.g. <i>abc.example.com</i><br><br><b>Subnet</b>: e.g. <i>1.2.3.0/24</i>' data-placement='right' id="scantarget" name="scantarget" placeholder="Starting point for the scan."></div></div>@@ -97,5 +90,21 @@ Another scan is currently running (${runningScan}). Please either wait for that</form><script type='text/javascript'>$('#scantarget').popover({ 'html': true, 'animation': true, 'trigger': 'focus'});+if ("${selectedmods}" != "") {+ $("#moduletable").show();+ $("#moduletab").addClass("active");+ $("#typetable").hide();+ $("#typetab").removeClass("active");+ activeTab = "module";+ alternateTab = "type";++ $("input[id^=module_]").each(function(id, obj) {+ if ("${selectedmods}".indexOf(obj.id.replace("module_", "")) >= 0) {+ $("#" + obj.id).attr("checked", true);+ } else {+ $("#" + obj.id).attr("checked", false);+ }+ });+}</script><%include file="FOOTER.tmpl"/>diff --git a/dyn/scandelete.tmpl b/dyn/scandelete.tmplindex 73bdcddc..e5be417d 100644--- a/dyn/scandelete.tmpl+++ b/dyn/scandelete.tmpl@@ -1,8 +1,20 @@<%include file="HEADER.tmpl"/><div class="alert alert-error"><h4>Confirm Deletion</h4>-<br><br>+<br>+% if id != None:Please confirm you wish to delete the scan '${name}'<br><br><a class='btn btn-danger' href='${docroot}/scandelete?id=${id}&confirm=1'>Confirm Deletion</a>+% endif+% if ids != None:+Please confirm you wish to delete the scans:<br>+<ul>+% for name in names:+ <li>${name}</li>+% endfor+<% idlist = ','.join(ids) %>+</ul>+<a class='btn btn-danger' href='${docroot}/scandeletemulti?ids=${idlist}&confirm=1'>Confirm Deletion</a>+% endif</div><%include file="FOOTER.tmpl"/>diff --git a/dyn/scanlist.tmpl b/dyn/scanlist.tmplindex fb2eae3e..5dc589a8 100644--- a/dyn/scanlist.tmpl+++ b/dyn/scanlist.tmpl@@ -1,5 +1,6 @@<%include file="HEADER.tmpl"/><h2>Scans <img id=loader src=${docroot}/static/img/loader.gif></h2>+<div id="scancontent">% if newscan:<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button>@@ -7,34 +8,185 @@Scan '${newscan}' has successfully been initiated. Reload this page for up-to-date status on the scan.</div>% endif-% if stoppedscan:+% if rerunscans:+<div class="alert alert-success">+ <button type="button" class="close" data-dismiss="alert">×</button>+ <h4>Success!</h4>+ Scans have successfully been re-initiated as separate instances. Reload this page for up-to-date status on the scans.+</div>+% endif+% if stoppedscan and len(errors) == 0:<div class="alert alert-warning"><button type="button" class="close" data-dismiss="alert">×</button><h4>Scan aborted.</h4>Please allow a minute or two for the scan to cleanly shut itself down.</div>% endif++% if stoppedscan and len(errors) > 0:+<div class="alert alert-warning">+ <button type="button" class="close" data-dismiss="alert">×</button>+ <h4>Error</h4>+ Some or all of the scans could not be aborted:<br>+<ul>+ % for err in errors:+ <li>${err}</li>+ % endfor+</ul>+</div>++% endif+<script type='text/javascript'>- sf.fetchData('${docroot}/scanlist', null, function(data) {+ globalTypes = null;+ globalFilter = null;++ function switchSelectAll() {+ if (!$("#checkall")[0].checked) {+ $("input[id*=cb_]").prop('checked', false);+ } else {+ $("input[id*=cb_]").prop('checked', true);+ }+ }++ function filter(type) {+ if (type == "all") {+ showlist();+ return;+ }+ if (type == "running") {+ showlist(["RUNNING", "STARTING", "STARTED"], "Running");+ return;+ }+ if (type == "finished") {+ showlist(["FINISHED"], "Finished");+ return;+ }+ if (type == "failed") {+ showlist(["ABORTED", "FAILED"], "Failed/Aborted");+ return;+ }+ }++ function getSelected() {+ ids = [];+ $("input[id*=cb_]").each(function(i, obj) {+ if (obj.checked) {+ ids[ids.length] = obj.id.replace("cb_", "");+ }+ });++ if (ids.length == 0) {+ alert("You need to select at least one scan.");+ return false;+ }++ return ids;+ }++ function stopSelected() {+ ids = getSelected();++ if (ids != false) {+ window.location.href = '${docroot}/stopscanmulti?ids=' + ids.join(',');+ }+ }++ function deleteSelected() {+ ids = getSelected();++ if (ids != false) {+ window.location.href = '${docroot}/scandeletemulti?ids=' + ids.join(',');+ }+ }++ function rerunSelected() {+ ids = getSelected();++ if (ids != false) {+ window.location.href = '${docroot}/rerunscanmulti?ids=' + ids.join(',');+ }+ }++ function exportSelected(type) {+ ids = getSelected();++ if (ids != false) {+ $("#loader").show();+ var efr = document.getElementById('exportframe');+ if (type == "gexf") {+ efr.src = '${docroot}/scanvizmulti?ids=' + ids.join(',');+ } else {+ efr.src = '${docroot}/scaneventresultexportmulti?ids=' + ids.join(',');+ }+ $("#loader").fadeOut(500);+ }+ }++ function reload() {+ showlist(globalTypes, globalFilter);+ return;+ }++ function showlist(types, filter) {+ globalTypes = types;+ globalFilter = filter;+ sf.fetchData('${docroot}/scanlist', null, function(data) {if (data.length == 0) {$("#loader").fadeOut(500);welcome = "<div class='alert alert-info'>";welcome += "<h4>No scan history</h4><br>";welcome += "There is currently no history of previously run scans. Please click 'New Scan' to initiate a new scan."welcome += "</div>";- $("#mainbody").append(welcome);+ $("#scancontent").append(welcome);return;}- var buttons = "<div class='btn-toolbar'><div class='btn-group'><a id='btn-status' class='btn' onClick='scanStatusView(\"${id}\")'>";- buttons += "<i class='icon-eye-open'></i> Status</a>";- buttons += "<a id='btn-browse' class='btn' onClick='browseEventList(\"${id}\")'><i class='icon-th-list'></i> Browse</a>";- buttons += "<a id='btn-info' class='btn' onClick='viewScanConfig(\"${id}\")'><i class='icon-cog'></i> Scan Settings</a>";- buttons += "<a id='btn-log' class='btn' onClick='viewScanLog(\"${id}\")'><i class='icon-book'></i> Log</a></div></div>";++ if (filter == null) {+ filter = "None";+ }+ var buttons = "<div class='btn-toolbar'>";+ buttons += "<div class='btn-group'>";+ buttons += "<button id='btn-filter' class='btn'><i class='icon-filter'></i> Filter: " + filter + "</button>";+ buttons += "<button class='btn dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button>";+ buttons += "<ul class='dropdown-menu'>";+ buttons += "<li><a href='javascript:filter(\"all\")'>None</a></li>";+ buttons += "<li><a href='javascript:filter(\"running\")'>Running</a></li>";+ buttons += "<li><a href='javascript:filter(\"finished\")'>Finished</a></li>";+ buttons += "<li><a href='javascript:filter(\"failed\")'>Failed/Aborted</a></li></ul>";+ buttons += "</div>";++ buttons += "<div class='btn-group pull-right'>";+ buttons += "<button rel='tooltip' data-title='Delete Selected' id='btn-delete' class='btn btn-inverse' onClick='deleteSelected()'><i class='icon-trash icon-white'></i></button>";+ buttons += "</div>";++ buttons += "<div class='btn-group pull-right'>";+ buttons += "<button rel='tooltip' data-title='Stop Selected' id='btn-stop' class='btn btn-inverse' onClick='stopSelected()'>";+ buttons += "<i class='icon-stop icon-white'></i></button>";+ buttons += "<button rel='tooltip' data-title='Re-run Selected' id='btn-rerun' class='btn btn-inverse' onClick='rerunSelected()'><i class='icon-repeat icon-white'></i></button>";+ buttons += "</div>";++ buttons += "<div class='btn-group pull-right'>";+ buttons += "<button rel='tooltip' data-title='Refresh' id='btn-refresh' class='btn btn-success' onClick='reload()'><i class='icon-refresh icon-white'></i></a>";+ buttons += "<button rel='tooltip' data-title='Export Selected' id='btn-export' class='btn btn-success'><i class='icon-download-alt icon-white'></i></button>";+ buttons += "<button class='btn dropdown-toggle btn-success' data-toggle='dropdown'><span class='caret'></span></button>";+ buttons += "<ul class='dropdown-menu'>";+ buttons += "<li><a onClick='exportSelected(\"csv\")'>CSV</a></li>";+ buttons += "<li><a onClick='exportSelected(\"gexf\")'>GEXF</a></li></ul>";+ buttons += "</div>";++ buttons += "</div>";var table = "<table id='scanlist' class='table table-bordered table-striped tablesorter'>";- table += "<thead><tr> <th>Name</th> <th>Target</th> <th>Started</th> <th >Finished</th> <th style='text-align: center'>Status</th> <th style='text-align: center'>Elements</th><th style='text-align: center'>Action</th> </tr></thead><tbody>";+ table += "<thead><tr><th style='text-align: center'><input id='checkall' type='checkbox' onClick='switchSelectAll()'></th> <th>Name</th> <th>Target</th> <th>Started</th> <th >Finished</th> <th style='text-align: center'>Status</th> <th style='text-align: center'>Elements</th><th style='text-align: center'>Action</th> </tr></thead><tbody>";+ filtered = 0;for (var i = 0; i < data.length; i++) {- table += "<tr><td><a href=${docroot}/scaninfo?id=" + data[i][0] + ">" + data[i][1] + "</a></td>";- table += "<td>" + data[i][2] + " <a rel='tooltip' title='Visit target' target='_new' href='http://" + data[i][2] + "'><i class='icon-share icon-gray' /></a></td>";+ if (types != null && $.inArray(data[i][6], types)) {+ filtered++;+ continue;+ }+ table += "<tr><td style='text-align: center'><input type='checkbox' onClick='checkboxValidate()' id='cb_" + data[i][0] + "'></td>"+ table += "<td><a href=${docroot}/scaninfo?id=" + data[i][0] + ">" + data[i][1] + "</a></td>";+ table += "<td>" + data[i][2] + "</td>";table += "<td>" + data[i][3] + "</td>";table += "<td>" + data[i][5] + "</td>";if (data[i][6] == "FINISHED") {@@ -55,15 +207,30 @@if (data[i][6] == "RUNNING" || data[i][6] == "STARTING" || data[i][6] == "STARTED") {table += "<a rel='tooltip' title='Stop Scan' href=${docroot}/stopscan?id=" + data[i][0] +"><i class='icon-stop icon-gray' /></a></td>";} else {- table += "<a rel='tooltip' title='Delete Scan' href=${docroot}/scandelete?id=" + data[i][0] + "><i class='icon-trash icon-gray' /></a></td>";+ table += "<a rel='tooltip' title='Delete Scan' href=${docroot}/scandelete?id=" + data[i][0] + "><i class='icon-trash icon-gray' /></a>";+ table += " <a rel='tooltip' title='Clone Scan' href=${docroot}/clonescan?id=" + data[i][0] + "><i class='icon-plus-sign icon-gray' /></a>";+ table += " <a rel='tooltip' title='Re-run Scan' href=${docroot}/rerunscan?id=" + data[i][0] + "><i class='icon-repeat icon-gray' /></a></td>";}table += "</tr>";}- table += "</tbody></table>";+ footer = "<div>Total Scans: <b>" + i + "</b>";+ if (filtered > 0) {+ footer += " (" + filtered + " filtered out)";+ }+ footer += "</div>";+ table += "</tbody></table>" + footer;$("#loader").fadeOut(500);- $("#mainbody").append(table);+ $("#scancontent-wrapper").remove();+ $("#scancontent").append("<div id='scancontent-wrapper'> " + buttons + table + "</div>");sf.updateTooltips();- $("#scanlist").tablesorter( { headers: { 6: { sorter: false } } });- });+ $("#scanlist").tablesorter( { headers: { 7: { sorter: false }, 0: { sorter: false } } } );+ $("[class^=tooltip]").remove();+ });+ }++ showlist();+</script>+</div>+<iframe style='display: none' id='exportframe'><%include file="FOOTER.tmpl"/>diff --git a/sflib.py b/sflib.pyindex c30b44de..2fc3cc03 100644--- a/sflib.py+++ b/sflib.py@@ -468,6 +468,23 @@ class SpiderFoot:return returnOpts+ # Return the type for a scan+ def targetType(self, target):+ targetType = None++ regexToType = {+ "^\d+\.\d+\.\d+\.\d+$": "IP_ADDRESS",+ "^\d+\.\d+\.\d+\.\d+/\d+$": "NETBLOCK_OWNER",+ "^.[a-zA-Z\-0-9\.]+$": "INTERNET_NAME"+ }++ # Parse the target and set the targetType+ for rx in regexToType.keys():+ if re.match(rx, target, re.IGNORECASE):+ targetType = regexToType[rx]+ break+ return targetType+# Return an array of module names for returning the# types specified.def modulesProducing(self, events):diff --git a/sfwebui.py b/sfwebui.pyindex 1fd2f0d2..6bac71eb 100644--- a/sfwebui.py+++ b/sfwebui.py@@ -126,6 +126,29 @@ class SpiderFootWebUi:scaneventresultexport.exposed = True+ # Get result data in CSV format for multiple scans+ def scaneventresultexportmulti(self, ids, dialect="excel"):+ dbh = SpiderFootDb(self.config)+ scaninfo = dict()+ data = list()+ for id in ids.split(','):+ scaninfo[id] = dbh.scanInstanceGet(id)+ data = data + dbh.scanResultEvent(id)++ fileobj = StringIO()+ parser = csv.writer(fileobj, dialect=dialect)+ parser.writerow(["Scan Name", "Updated", "Type", "Module", "Source", "Data"])+ for row in data:+ lastseen = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]))+ datafield = str(row[1]).replace("<SFURL>", "").replace("</SFURL>", "")+ parser.writerow([scaninfo[row[12]][0], lastseen, str(row[4]), str(row[3]), str(row[2]), datafield])+ cherrypy.response.headers['Content-Disposition'] = "attachment; filename=SpiderFoot.csv"+ cherrypy.response.headers['Content-Type'] = "application/csv"+ cherrypy.response.headers['Pragma'] = "no-cache"+ return fileobj.getvalue()++ scaneventresultexportmulti.exposed = True+# Get search result data in CSV formatdef scansearchresultexport(self, id, eventType=None, value=None, dialect="excel"):data = self.searchBase(id, eventType, value)@@ -159,10 +182,26 @@ class SpiderFootWebUi:scanviz.exposed = True# Export entities results from multiple scans in GEXF format- def scansgexf(self, idlist):- pass+ def scanvizmulti(self, ids, gexf="1"):+ types = list()+ dbh = SpiderFootDb(self.config)+ sf = SpiderFoot(self.config)+ data = list()+ for id in ids.split(','):+ data = data + dbh.scanResultEvent(id)++ if gexf != "0":+ cherrypy.response.headers['Content-Disposition'] = "attachment; filename=SpiderFoot.gexf"+ cherrypy.response.headers['Content-Type'] = "application/gexf"+ cherrypy.response.headers['Pragma'] = "no-cache"+ return sf.buildGraphGexf("SpiderFoot Export", data)+ else:+ # Not implemented yet+ return None+ #return sf.buildGraphJson(data)++ scanvizmulti.exposed = True- scansgexf.exposed = True# Configuration used for a scandef scanopts(self, id):@@ -200,16 +239,124 @@ class SpiderFootWebUi:scanopts.exposed = True+ def rerunscan(self, id):+ # Snapshot the current configuration to be used by the scan+ cfg = deepcopy(self.config)+ modopts = dict() # Not used yet as module options are set globally+ modlist = list()+ sf = SpiderFoot(cfg)+ dbh = SpiderFootDb(cfg)+ info = dbh.scanInstanceGet(id)+ scanconfig = dbh.scanConfigGet(id)+ scanname = info[0]+ scantarget = info[1]+ targetType = None++ if len(scanconfig) == 0:+ return self.error("Something went wrong internally.")++ modlist = scanconfig['_modulesenabled'].split(',')++ targetType = sf.targetType(scantarget)+ if targetType == None:+ # Should never be triggered for a re-run scan..+ return self.error("Invalid target type. Could not recognize it as " + \+ "an IP address, IP subnet, domain name or host name.")++ # Start running a new scan+ newId = sf.genScanInstanceGUID(scanname)+ t = SpiderFootScanner(scanname, scantarget.lower(), targetType, newId,+ modlist, cfg, modopts)+ t.start()++ # Wait until the scan has initialized+ while globalScanStatus.getStatus(newId) == None:+ print "[info] Waiting for the scan to initialize..."+ time.sleep(1)++ templ = Template(filename='dyn/scaninfo.tmpl', lookup=self.lookup)+ return templ.render(id=newId, name=scanname, docroot=self.docroot,+ status=globalScanStatus.getStatus(newId), pageid="SCANLIST")++ rerunscan.exposed = True++ def rerunscanmulti(self, ids):+ # Snapshot the current configuration to be used by the scan+ cfg = deepcopy(self.config)+ modopts = dict() # Not used yet as module options are set globally+ modlist = list()+ sf = SpiderFoot(cfg)+ dbh = SpiderFootDb(cfg)++ for id in ids.split(","):+ info = dbh.scanInstanceGet(id)+ scanconfig = dbh.scanConfigGet(id)+ scanname = info[0]+ scantarget = info[1]+ targetType = None++ if len(scanconfig) == 0:+ return self.error("Something went wrong internally.")++ modlist = scanconfig['_modulesenabled'].split(',')++ targetType = sf.targetType(scantarget)+ if targetType == None:+ # Should never be triggered for a re-run scan..+ return self.error("Invalid target type. Could not recognize it as " + \+ "an IP address, IP subnet, domain name or host name.")++ # Start running a new scan+ newId = sf.genScanInstanceGUID(scanname)+ t = SpiderFootScanner(scanname, scantarget.lower(), targetType, newId,+ modlist, cfg, modopts)+ t.start()++ # Wait until the scan has initialized+ while globalScanStatus.getStatus(newId) == None:+ print "[info] Waiting for the scan to initialize..."+ time.sleep(1)++ templ = Template(filename='dyn/scanlist.tmpl', lookup=self.lookup)+ return templ.render(rerunscans=True, docroot=self.docroot, pageid="SCANLIST")++ rerunscanmulti.exposed = True++# Configure a new scandef newscan(self):dbh = SpiderFootDb(self.config)types = dbh.eventTypes()templ = Template(filename='dyn/newscan.tmpl', lookup=self.lookup)return templ.render(pageid='NEWSCAN', types=types, docroot=self.docroot,- modules=self.config['__modules__'])+ modules=self.config['__modules__'], scanname="",+ selectedmods="", scantarget="")newscan.exposed = True++ # Clone an existing scan (pre-selected options in the newscan page)+ def clonescan(self, id):+ dbh = SpiderFootDb(self.config)+ types = dbh.eventTypes()+ info = dbh.scanInstanceGet(id)+ scanconfig = dbh.scanConfigGet(id)+ scanname = info[0]+ scantarget = info[1]+ targetType = None++ if scanname == "" or scantarget == "" or len(scanconfig) == 0:+ return self.error("Something went wrong internally.")++ modlist = scanconfig['_modulesenabled'].split(',')++ templ = Template(filename='dyn/newscan.tmpl', lookup=self.lookup)+ return templ.render(pageid='NEWSCAN', types=types, docroot=self.docroot,+ modules=self.config['__modules__'], selectedmods=modlist,+ scanname=scanname, scantarget=scantarget)++ clonescan.exposed = True+# Main page listing scans availabledef index(self):# Look for referenced templates in the current directory only@@ -260,6 +407,31 @@ class SpiderFootWebUi:scandelete.exposed = True+ # Delete a scan+ def scandeletemulti(self, ids, confirm=None):+ dbh = SpiderFootDb(self.config)+ names = list()++ for id in ids.split(','):+ res = dbh.scanInstanceGet(id)+ names.append(res[0])+ if res is None:+ return self.error("Scan ID not found (" + id + ").")++ if res[5] in [ "RUNNING", "STARTING", "STARTED" ]:+ return self.error("You cannot delete running scans.")++ if confirm is not None:+ for id in ids.split(','):+ dbh.scanInstanceDelete(id)+ raise cherrypy.HTTPRedirect("/")+ else:+ templ = Template(filename='dyn/scandelete.tmpl', lookup=self.lookup)+ return templ.render(id=None, name=None, ids=ids.split(','), names=names,+ pageid="SCANLIST", docroot=self.docroot)++ scandeletemulti.exposed = True+# Save settings, also used to completely reset them to defaultdef savesettings(self, allopts, token):if str(token) != str(self.token):@@ -338,18 +510,7 @@ class SpiderFootWebUi:modlist.append("sfp__stor_db")modlist.sort()- regexToType = {- "^\d+\.\d+\.\d+\.\d+$": "IP_ADDRESS",- "^\d+\.\d+\.\d+\.\d+/\d+$": "NETBLOCK_OWNER",- "^.[a-zA-Z\-0-9\.]+$": "INTERNET_NAME"- }-- # Parse the target and set the targetType- for rx in regexToType.keys():- if re.match(rx, scantarget, re.IGNORECASE):- targetType = regexToType[rx]- break-+ targetType = sf.targetType(scantarget)if targetType is None:return self.error("Invalid target type. Could not recognize it as " + \"an IP address, IP subnet, domain name or host name.")@@ -371,8 +532,44 @@ class SpiderFootWebUi:startscan.exposed = True+# Stop a scan (id variable is unnecessary for now given that only one simultaneous# scan is permitted.)+ def stopscanmulti(self, ids):+ global globalScanStatus # running scans+ dbh = SpiderFootDb(self.config)+ error = list()++ for id in ids.split(","):+ errState = False+ scaninfo = dbh.scanInstanceGet(id)++ if globalScanStatus.getStatus(id) == "FINISHED" or scaninfo[5] == "FINISHED":+ error.append("Scan '" + scaninfo[0] + "' is in a finished state. <a href='/scandelete?id=" + \+ id + "&confirm=1'>Maybe you want to delete it instead?</a>")+ errState = True++ if not errState and (globalScanStatus.getStatus(id) == "ABORTED" or scaninfo[5] == "ABORTED"):+ error.append("Scan '" + scaninfo[0] + "' is already aborted.")+ errState = True++ if not errState and globalScanStatus.getStatus(id) is None:+ error.append("Scan '" + scaninfo[0] + "' is not actually running. A data consistency " + \+ "error for this scan probably exists. <a href='/scandelete?id=" + \+ id + "&confirm=1'>Click here to delete it.</a>")+ errState = True++ if not errState:+ globalScanStatus.setStatus(id, "ABORT-REQUESTED")++ templ = Template(filename='dyn/scanlist.tmpl', lookup=self.lookup)+ return templ.render(pageid='SCANLIST', stoppedscan=True,+ errors=error, docroot=self.docroot)++ stopscanmulti.exposed = True+++ # Stop a scan.def stopscan(self, id):global globalScanStatus@@ -391,7 +588,7 @@ class SpiderFootWebUi:globalScanStatus.setStatus(id, "ABORT-REQUESTED")templ = Template(filename='dyn/scanlist.tmpl', lookup=self.lookup)- return templ.render(pageid='SCANLIST', stoppedscan=True, docroot=self.docroot)+ return templ.render(pageid='SCANLIST', stoppedscan=True, docroot=self.docroot, errors=list())stopscan.exposed = True