Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

Viewing unique results.

smicallefbb1b268c0f3d
diff --git a/dyn/scaninfo.tmpl b/dyn/scaninfo.tmpl
index 344140dc..53bd5cfd 100644
--- a/dyn/scaninfo.tmpl
+++ b/dyn/scaninfo.tmpl
@@ -10,6 +10,10 @@
<div class="btn-group pull-right">
<a id='btn-refresh' rel="tooltip" title="Refresh" class="btn-success btn" href="#" onClick='refresh()'><i class='icon-refresh icon-white'></i></a>
<a id='btn-export' rel="tooltip" title="Export Data to CSV" class="btn-info btn" href="#" onClick='exportEventData("${id}", currentType)'><i class='icon-download-alt icon-white'></i></a>
+ </div>
+ <div id='customview' class="btn-group pull-right">
+ <a id='btn-fullview' rel="tooltip" title="Full Data View" class="btn-inverse btn active" href="#" onClick='browseUpdate("full")'><i class='icon-th icon-white'></i></a>
+ <a id='btn-uniqueview' rel="tooltip" title="Unique Data View" class="btn-inverse btn" href="#" onClick='browseUpdate("unique")'><i class='icon-align-justify icon-white'></i></a>
</div>
</div>
@@ -28,6 +32,7 @@
}
$("#breadcrumbs").remove();
+ $("#customview").hide();
}
// Logs for the scan
@@ -72,7 +77,7 @@
table += "<thead><tr> <th>Type</th> <th>Data Elements</th><th>Last Data Element</th></tr></thead><tbody>";
for (var i = 0; i < data.length; i++) {
table += "<tr><td><a onClick='";
- table += "browseEventData(\"${id}\", \"" + data[i][1] + "\", \"" + data[i][0] + "\")' href='#'>";
+ table += "browseEventData(\"${id}\", \"" + data[i][1] + "\", \"" + data[i][0] + "\", \"full\");' href='#'>";
table += data[i][1] + "</a></td>";
table += "<td>" + data[i][3] + "</td>";
table += "<td>" + data[i][2] + "</td>";
@@ -85,33 +90,63 @@
}
// Detailed view of data for an event type for a scan
- function browseEventData(instanceId, eventTypeLabel, eventType) {
+ function browseEventData(instanceId, eventTypeLabel, eventType, format) {
$("#scansummary-content").remove();
$("#breadcrumbs").remove();
$("#loader").show();
navTo("btn-browse");
$("#btn-export").show();
+ $("#customview").show();
currentType = eventType;
- refresh = function() { browseEventData(instanceId, eventTypeLabel, eventType); }
- sf.fetchData('/scaneventresults', {'id': instanceId, 'eventType': eventType }, function(data) {
+ refresh = function() { browseEventData(instanceId, eventTypeLabel, eventType, format); }
+ browseUpdate = function(newformat) { browseEventData(instanceId, eventTypeLabel, eventType, newformat); }
+
+ if (format == 'full') {
+ $("#btn-fullview").addClass("active");
+ $("#btn-uniqueview").removeClass("active");
+ sf.fetchData('/scaneventresults', {'id': instanceId, 'eventType': eventType }, function(data) {
var crumbs = " <ul class='breadcrumb' id='breadcrumbs'> <li><a href='#' onClick='browseEventList(\"" + instanceId + "\");'>Browse</a>";
crumbs += " <span class='divider'>&gt;</span></li> <li><a href='#' onClick=";
- crumbs += "'browseEventData(\"" + instanceId + "\",\"" + eventTypeLabel + "\",\"" + eventType + "\");'>";
+ crumbs += "'browseEventData(\"" + instanceId + "\",\"" + eventTypeLabel + "\",\"" + eventType + "\",\"" + format + "\");'>";
crumbs += eventTypeLabel + "</a></li></ul>";
var table = "<table id='scansummary-content' class='table table-bordered table-striped small'>";
- table += "<thead><tr> <th>Data Element</th><th>Source Data Element</th><th>Source Module</th></tr></thead><tbody>";
+ table += "<thead><tr> <th>Data Element</th><th>Source Data Element</th><th>Source Module</th><th>Identified</th></tr></thead><tbody>";
for (var i = 0; i < data.length; i++) {
- table += "<tr><td width=50%><pre style='border: 0px; background-color: inherit'>" + data[i][1];
+ table += "<tr><td><pre style='border: 0px; background-color: inherit'>" + data[i][1];
table += "</pre></td><td><pre style='border: 0px; background-color: inherit'>" + data[i][2];
table += "</pre></td><td><pre style='border: 0px; background-color: inherit'>" + data[i][3];
+ table += "</pre></td><td><pre style='border: 0px; background-color: inherit'>" + data[i][0];
table += "</pre></td>";
table += "</tr>";
}
table += "</tbody></table>"
$("#loader").fadeOut(500);
$("#mainbody").append(crumbs + table);
- });
+ });
+ }
+
+ if (format == 'unique') {
+ $("#btn-uniqueview").addClass("active");
+ $("#btn-fullview").removeClass("active");
+ sf.fetchData('/scaneventresultsunique', {'id': instanceId, 'eventType': eventType }, function(data) {
+ var crumbs = " <ul class='breadcrumb' id='breadcrumbs'> <li><a href='#' onClick='browseEventList(\"" + instanceId + "\");'>Browse</a>";
+ crumbs += " <span class='divider'>&gt;</span></li> <li><a href='#' onClick=";
+ crumbs += "'browseEventData(\"" + instanceId + "\",\"" + eventTypeLabel + "\",\"" + eventType + "\",\"" + format + "\");'>";
+ crumbs += eventTypeLabel + "</a></li></ul>";
+
+ var table = "<table id='scansummary-content' class='table table-bordered table-striped small'>";
+ table += "<thead><tr> <th>Unique Data Element</th></tr></thead><tbody>";
+ for (var i = 0; i < data.length; i++) {
+ table += "<tr><td><pre style='border: 0px; background-color: inherit'>" + data[i][0];
+ table += "</pre></td>";
+ table += "</tr>";
+ }
+ table += "</tbody></table>"
+ $("#loader").fadeOut(500);
+ $("#mainbody").append(crumbs + table);
+ });
+ }
}
// Download the data currently being viewed
@@ -130,7 +165,7 @@
navTo("btn-info");
refresh = function() { viewScanConfig(instanceId); }
sf.fetchData('/scanopts', {'id': instanceId}, function(data) {
- table = "<div id='scansummary-content'><br>";
+ table = "<div id='scansummary-content'>";
table += "<h4>Meta Information</h4>";
table += "<table class='table table-bordered table-striped'>";
table += "<tr><td>Name:</td><td>" + data['meta'][0] + "</td></tr>";
diff --git a/sfwebui.py b/sfwebui.py
index 9c1fa107..47e7d5ee 100644
--- a/sfwebui.py
+++ b/sfwebui.py
@@ -48,7 +48,7 @@ class SpiderFootWebUi:
data = dbh.scanResultEvent(id, type)
blob = "\"Updated\",\"Type\",\"Source\",\"Module\",\"Data\"\n"
for row in data:
- lastseen = time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(row[0]))
+ lastseen = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]))
escaped = cgi.escape(row[1].replace("\n", "#LB#").replace("\r", "#LB#"))
blob = blob + "\"" + lastseen + "\",\"" + row[4] + "\",\""
blob = blob + row[2] + "\",\"" + row[3]
@@ -81,12 +81,12 @@ class SpiderFootWebUi:
sf = SpiderFoot(self.config)
meta = dbh.scanInstanceGet(id)
if meta[3] != 0:
- started = time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(meta[3]))
+ started = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(meta[3]))
else:
started = "Not yet"
if meta[4] != 0:
- finished = time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(meta[4]))
+ finished = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(meta[4]))
else:
finished = "Not yet"
ret['meta'] = [meta[0], meta[1], meta[2], started, finished, meta[5]]
@@ -226,7 +226,7 @@ class SpiderFootWebUi:
data = dbh.scanLogs(id)
retdata = []
for row in data:
- generated = time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(row[0]/1000))
+ generated = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]/1000))
retdata.append([generated, row[1], row[2], cgi.escape(row[3])])
return json.dumps(retdata)
scanlog.exposed = True
@@ -237,14 +237,14 @@ class SpiderFootWebUi:
data = dbh.scanInstanceList()
retdata = []
for row in data:
- created = time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(row[3]))
+ created = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[3]))
if row[4] != 0:
- started = time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(row[4]))
+ started = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[4]))
else:
started = "Not yet"
if row[5] != 0:
- finished = time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(row[5]))
+ finished = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[5]))
else:
finished = "Not yet"
retdata.append([row[0], row[1], row[2], created, started, finished, row[6], row[7]])
@@ -257,7 +257,7 @@ class SpiderFootWebUi:
data = dbh.scanResultSummary(id)
retdata = []
for row in data:
- lastseen = time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(row[2]))
+ lastseen = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[2]))
retdata.append([row[0], row[1], lastseen, row[3]])
return json.dumps(retdata)
scansummary.exposed = True
@@ -268,12 +268,23 @@ class SpiderFootWebUi:
data = dbh.scanResultEvent(id, eventType)
retdata = []
for row in data:
- lastseen = time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(row[0]))
+ lastseen = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]))
escaped = cgi.escape(row[1])
retdata.append([lastseen, escaped, row[2], row[3]])
return json.dumps(retdata, ensure_ascii=False)
scaneventresults.exposed = True
+ # Unique event results for a scan
+ def scaneventresultsunique(self, id, eventType):
+ dbh = SpiderFootDb(self.config)
+ data = dbh.scanResultEventUnique(id, eventType)
+ retdata = []
+ for row in data:
+ escaped = cgi.escape(row[0])
+ retdata.append([escaped, row[1]])
+ return json.dumps(retdata, ensure_ascii=False)
+ scaneventresultsunique.exposed = True
+
# Historical data for the scan, graphs will be rendered in JS
def scanhistory(self, id):
dbh = SpiderFootDb(self.config)