Skip to content

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

Support for more data in the dashboard eventually.

smicallef389faae4d124
diff --git a/dyn/scaninfo.tmpl b/dyn/scaninfo.tmpl
index 99fcb69f..6084da1f 100644
--- a/dyn/scaninfo.tmpl
+++ b/dyn/scaninfo.tmpl
@@ -8,7 +8,6 @@
<a id='btn-info' class="btn" onClick='viewScanConfig("${id}")'><i class='icon-cog'></i>&nbsp;Scan Settings</a>
<a id='btn-log' class="btn" onClick='viewScanLog("${id}")'><i class='icon-book'></i>&nbsp;Log</a>
</div>
- <button class='btn btn-info disabled' id='scanreminder'>This page automatically reloads data every 5 seconds.</button>
<div id='btn-search' class='btn-group pull-right input-append'>
<input class=span2 id=searchvalue type=text placeholder='Search...' data-toggle='popover' data-html=true data-animation=true data-title='Usage' data-content="Supply a regular expression encapsulated in '/', e.g. <i>/searchregex/</i> or a simple wildcard search, e.g. <i>*string*</i> or an exact value, e.g. <i>string</i>.<br><br><b>Note</b> that the current scope is what's searched.">
<button class='btn btn-primary' id=searchbutton type=button onClick=$('#btn-search').popover('toggle');searchDirector('${id}')>
@@ -305,7 +304,7 @@
dataloaders.push(
function() {
- sf.fetchData('${docroot}/scansummary', {'id': instanceId}, function(data) {
+ sf.fetchData('${docroot}/scansummary', {'id': instanceId, 'by': 'type'}, function(data) {
scanSummary = [];
totalCount = 0;
uniqueCount = 0;
@@ -409,7 +408,7 @@
$("#btn-search").show();
$("#scanreminder").hide();
refresh = function() { browseEventList(instanceId); }
- sf.fetchData('${docroot}/scansummary', {'id': instanceId}, function(data) {
+ sf.fetchData('${docroot}/scansummary', {'id': instanceId, 'by': 'type'}, function(data) {
var table = "<table id='scansummary-content' class='table table-bordered table-striped tablesorter'>";
table += "<thead><tr> <th>Type</th><th>Unique Data Elements</th> <th>Total Data Elements</th><th>Last Data Element</th></tr></thead><tbody>";
for (var i = 0; i < data.length; i++) {
diff --git a/sfdb.py b/sfdb.py
index 5140059c..f5666cb2 100644
--- a/sfdb.py
+++ b/sfdb.py
@@ -378,11 +378,27 @@ class SpiderFootDb:
self.sf.error("SQL error encountered when retreiving scan instance:" + e.args[0])
# Obtain a summary of the results per event type
- def scanResultSummary(self, instanceId):
- qry = "SELECT r.type, e.event_descr, MAX(ROUND(generated)) AS last_in, \
- count(*) AS total, count(DISTINCT r.data) as utotal FROM \
- tbl_scan_results r, tbl_event_types e WHERE e.event = r.type \
- AND r.scan_instance_id = ? GROUP BY r.type ORDER BY e.event_descr"
+ def scanResultSummary(self, instanceId, by="type"):
+ if by == "type":
+ qry = "SELECT r.type, e.event_descr, MAX(ROUND(generated)) AS last_in, \
+ count(*) AS total, count(DISTINCT r.data) as utotal FROM \
+ tbl_scan_results r, tbl_event_types e WHERE e.event = r.type \
+ AND r.scan_instance_id = ? GROUP BY r.type ORDER BY e.event_descr"
+
+ if by == "module":
+ qry = "SELECT r.module, '', MAX(ROUND(generated)) AS last_in, \
+ count(*) AS total, count(DISTINCT r.data) as utotal FROM \
+ tbl_scan_results r, tbl_event_types e WHERE e.event = r.type \
+ AND r.scan_instance_id = ? GROUP BY r.module ORDER BY r.module DESC"
+
+ if by == "entity":
+ qry = "SELECT r.data, e.event_descr, MAX(ROUND(generated)) AS last_in, \
+ count(*) AS total, count(DISTINCT r.data) as utotal FROM \
+ tbl_scan_results r, tbl_event_types e WHERE e.event = r.type \
+ AND r.scan_instance_id = ? \
+ AND e.event_type in ('ENTITY') \
+ GROUP BY r.data, e.event_descr ORDER BY total DESC limit 50"
+
qvars = [instanceId]
try:
self.dbh.execute(qry, qvars)
diff --git a/sfwebui.py b/sfwebui.py
index a438e8f9..920d9f6e 100644
--- a/sfwebui.py
+++ b/sfwebui.py
@@ -717,9 +717,9 @@ class SpiderFootWebUi:
scanstatus.exposed = True
# Summary of scan results
- def scansummary(self, id):
+ def scansummary(self, id, by):
dbh = SpiderFootDb(self.config)
- data = dbh.scanResultSummary(id)
+ data = dbh.scanResultSummary(id, by)
retdata = []
for row in data:
if row[0] == "ROOT":