Skip to content

Commit

Permalink
Updated logo, file exporting.
Browse files Browse the repository at this point in the history
  • Loading branch information
smicallef committed Mar 11, 2013
1 parent 23ed83b commit 900e4b7
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dyn/HEADER.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
color: #777777;
text-shadow: 0 1px 0 #ffffff;
background: url(static/img/spiderfoot.png) no-repeat center center;
background-size: 32px 32px;
background-size: 38px 38px;
height: 20px;
width: 20px;
}
Expand Down
22 changes: 19 additions & 3 deletions dyn/scaninfo.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
<div class="btn-group">
<a id='btn-browse' class="btn active" href="#" onClick='browseEventList("${id}")'>Browse</a>
<a id='btn-info' class="btn" href="#" onClick='viewScanConfig("${id}")'>Scan Info</a>
<a id='btn-export' class="btn" href="#">Export</a>
<a id='btn-export' class="btn" href="#" onClick='exportEventData("${id}", currentType)'>Export</a>
</div>
</div>

<script type='text/javascript'>
var currentType = "ALL";

function navTo(target) {
var targets = [ "btn-browse", "btn-info", "btn-export" ]
for (var i = 0; i < targets.length; i++) {
Expand All @@ -22,6 +24,8 @@

// Summary of event types and counts for a scan
function browseEventList(instanceId) {
currentType = "ALL";

// Remove pre-existing tables if they exist
$("#scansummary-content").remove();
navTo("btn-browse");
Expand All @@ -47,18 +51,29 @@
$("#scansummary-content").remove();
$("#loader").show();
navTo("btn-browse");
currentType = eventType;
sf.fetchData('/scaneventresults', {'id': instanceId, 'eventType': eventType }, function(data) {
var table = "<table id='scansummary-content' class='table table-bordered table-striped small'>";
table += "<thead><tr> <th>Data Element</th><th>Obtained</th><th>Source</th><th>Module</th></tr></thead><tbody>";
table += "<thead><tr> <th>Data Element</th><th>Source</th></tr></thead><tbody>";
for (var i = 0; i < data.length; i++) {
table += "<tr><td width=50%><pre>" + data[i][1] + "</pre></td><td>" + data[i][0] + "</td><td>" + data[i][2] + "</td><td>" + data[i][3] + "</td></tr>";
table += "<tr><td width=50%><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></tr>";
}
table += "</tbody></table>"
$("#loader").fadeOut(500);
$("#mainbody").append(table);
});
}

// Download the data currently being viewed
function exportEventData(instanceId, eventType) {
$("#loader").show();
var efr = document.getElementById('exportframe');
efr.src = '/scaneventresultexport?id=' + instanceId + '&eventType=' + eventType;
$("#loader").fadeOut(500);
}

// View the configuration that was used for this scan
function viewScanConfig(instanceId) {
$("#scansummary-content").remove();
Expand Down Expand Up @@ -103,4 +118,5 @@
browseEventList("${id}");

</script>
<iframe style='display: none' id='exportframe'>
<%include file="FOOTER.tmpl"/>
16 changes: 16 additions & 0 deletions sfwebui.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,22 @@ def __init__(self, config):
# DATA PROVIDERS (need to migrate all the ones from SpiderFootDataProvider
# to here)

# Get result data in CSV format
def scaneventresultexport(self, id, type):
dbh = SpiderFootDb(self.config)
data = dbh.scanResultEvent(id, type)
blob = "\"Updated\",\"Source\",\"Module\",\"Data\"\n"
for row in data:
lastseen = time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(row[0]))
escaped = cgi.escape(row[1].replace("\n", "<LB>").replace("\r", "<LB>"))
blob = blob + "\"" + lastseen + "\",\"" + row[2] + "\",\"" + row[3]
blob = blob + "\",\"" + escaped + "\"\n"
cherrypy.response.headers['Content-Disposition'] = "attachment; filename=SpiderFoot.csv"
cherrypy.response.headers['Content-Type'] = "application/csv"
cherrypy.response.headers['Pragma'] = "no-cache"
return blob
scaneventresultexport.exposed = True

# Configuration used for a scan
def scanopts(self, id):
ret = dict()
Expand Down
Binary file modified static/img/spiderfoot-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/img/spiderfoot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 900e4b7

Please sign in to comment.