' + escapeHtml(event.message) +
'
' + moment(event.time).format('MMMM Do YYYY h:mm') + ''
if (event.details) {
results += '
View Details
'
@@ -161,8 +161,8 @@ function renderTimeline(data) {
return true;
}
results += '
'
- results += ' ' + param + ' | '
- results += ' ' + details.payload[param] + ' | '
+ results += ' ' + escapeHtml(param) + ' | '
+ results += ' ' + escapeHtml(details.payload[param]) + ' | '
results += '
'
})
results += ' '
@@ -373,10 +373,10 @@ function load() {
resultsTable.row.add([
result.id,
"
",
- result.first_name || "",
- result.last_name || "",
- result.email || "",
- result.position || "",
+ escapeHtml(result.first_name) || "",
+ escapeHtml(result.last_name) || "",
+ escapeHtml(result.email) || "",
+ escapeHtml(result.position) || "",
"
" + result.status + ""
]).draw()
if (!email_series_data[result.status]) {
@@ -447,7 +447,7 @@ function load() {
cidx = $point.attr('meta')
html = "Event: " + campaign.timeline[cidx].message
if (campaign.timeline[cidx].email) {
- html += '
' + "Email: " + campaign.timeline[cidx].email
+ html += '
' + "Email: " + escapeHtml(campaign.timeline[cidx].email)
}
$toolTip.html(html).show()
});
diff --git a/static/js/gophish.js b/static/js/gophish.js
index 854d1d37..ca8783fc 100644
--- a/static/js/gophish.js
+++ b/static/js/gophish.js
@@ -26,6 +26,14 @@ function query(endpoint, method, data, async) {
})
}
+function escapeHtml(text){
+ return $("
").text(text).html()
+}
+
+function unescapeHtml(html){
+ return $("
").html(html).text()
+}
+
/*
Define our API Endpoints
*/