Making the results map an optional setting stored in localStorage. Fixes #747

Also does more formatting fixes for various files.
pull/843/merge
Jordan Wright 2017-09-16 23:30:04 -05:00
parent c49474fd10
commit 6f81f1f2e2
8 changed files with 585 additions and 492 deletions

File diff suppressed because one or more lines are too long

572
static/css/main.css vendored
View File

@ -1,51 +1,65 @@
.nav-tabs { .nav-tabs {
cursor:pointer; cursor: pointer;
} }
.datatable_hidden { .datatable_hidden {
display:none; display: none;
} }
.navbar-logo {
.navbar-logo {
margin: 4px 0px; margin: 4px 0px;
float: left; float: left;
} }
#navbar-login {
padding-top:8px; #navbar-login {
padding-bottom:0px; padding-top: 8px;
} padding-bottom: 0px;
#navbar-dropdown { }
margin-top:6px;
margin-right:15px; #navbar-dropdown {
} margin-top: 6px;
.sans { margin-right: 15px;
font-family:'Open Sans', sans-serif !important; }
}
.label { .sans {
font-family:'Roboto', sans-serif !important; font-family: 'Open Sans', sans-serif !important;
} }
.form-signin {
.label {
font-family: 'Roboto', sans-serif !important;
}
.form-signin {
max-width: 400px; max-width: 400px;
padding: 15px; padding: 15px;
margin: 40px auto 0px auto; margin: 40px auto 0px auto;
} }
ul .dropdown-menu .ng-isolate-scope {
ul .dropdown-menu .ng-isolate-scope {
visibility: visible; visibility: visible;
display:block; display: block;
opacity: 1; opacity: 1;
} }
#login-button{
padding:10px 15px; #login-button {
} padding: 10px 15px;
.form-signin-heading { }
text-align:center;
} .form-signin-heading {
.form-signin .form-signin-heading, .form-signin .checkbox { text-align: center;
}
.form-signin .form-signin-heading,
.form-signin .checkbox {
margin-bottom: 10px; margin-bottom: 10px;
} }
.form-signin .checkbox {
.form-signin .checkbox {
font-weight: normal; font-weight: normal;
} }
.form-signin .form-control {
font-family:'Open Sans', sans-serif; .form-signin .form-control {
font-family: 'Open Sans', sans-serif;
position: relative; position: relative;
font-size: 16px; font-size: 16px;
height: auto; height: auto;
@ -53,86 +67,98 @@
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
} }
.form-signin .form-control:focus {
.form-signin .form-control:focus {
z-index: 2; z-index: 2;
} }
.form-signin .top-input {
.form-signin .top-input {
margin-bottom: -1px; margin-bottom: -1px;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
} }
.form-signin .middle-input {
.form-signin .middle-input {
margin-bottom: -1px; margin-bottom: -1px;
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; border-top-right-radius: 0;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
} }
.form-signin .bottom-input {
.form-signin .bottom-input {
margin-bottom: 10px; margin-bottom: 10px;
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; border-top-right-radius: 0;
} }
#logo {
#logo {
display: block; display: block;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
footer > p {
color:#444444; footer>p {
font-family:'Open Sans', sans-serif; color: #444444;
} font-family: 'Open Sans', sans-serif;
.header { }
margin-top:10px;
} .header {
.sidebar { margin-top: 10px;
padding-left:0px; }
}
.sidebar a { .sidebar {
color:#201e1c; padding-left: 0px;
} }
.sidebar a:hover {
color:#201e1c; .sidebar a {
} color: #201e1c;
.api_heading { }
font-family:'Open Sans', sans-serif;
background-color:#201e1c; .sidebar a:hover {
color: #201e1c;
}
.api_heading {
font-family: 'Open Sans', sans-serif;
background-color: #201e1c;
border-radius: 5px; border-radius: 5px;
padding:10px; padding: 10px;
color:#E2E2E2; color: #E2E2E2;
width:100%; width: 100%;
} }
p {
font-size:1.2em;
}
.form-label { p {
padding-top:7px; font-size: 1.2em;
} }
.hover { .form-label {
padding-top: 7px;
}
.hover {
visibility: visible; visibility: visible;
} }
.edit-button { .edit-button {
display:none; display: none;
} }
.editable-row:hover .edit-button { .editable-row:hover .edit-button {
display : inline-block; display: inline-block;
padding: 3px 6px; padding: 3px 6px;
font-size:9px; font-size: 9px;
} }
.remove-row { .remove-row {
float:right; float: right;
cursor:pointer; cursor: pointer;
} }
.pagination { .pagination {
margin:0px; margin: 0px;
} }
@media (min-width: 992px) { @media (min-width: 992px) {
.modal-dialog { .modal-dialog {
@ -140,14 +166,15 @@
} }
} }
.dropdown-menu > li > a { .dropdown-menu>li>a {
cursor:pointer; cursor: pointer;
} }
.btn-file { .btn-file {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
.btn-file input[type=file] { .btn-file input[type=file] {
position: absolute; position: absolute;
top: 0; top: 0;
@ -162,18 +189,22 @@
cursor: inherit; cursor: inherit;
display: block; display: block;
} }
.typeahead { .typeahead {
border-left-radius:6px !important; border-left-radius: 6px !important;
float:none !important; float: none !important;
} }
.tt-query { .tt-query {
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
} }
.tt-hint { .tt-hint {
color: #999 color: #999
} }
.tt-menu { .tt-menu {
width: 422px; width: 422px;
margin-top: 4px; margin-top: 4px;
@ -184,114 +215,118 @@
-webkit-border-radius: 4px; -webkit-border-radius: 4px;
-moz-border-radius: 4px; -moz-border-radius: 4px;
border-radius: 4px; border-radius: 4px;
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2); -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2); -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
box-shadow: 0 5px 10px rgba(0,0,0,.2); box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
} }
.tt-suggestion { .tt-suggestion {
padding: 3px 20px; padding: 3px 20px;
line-height: 24px; line-height: 24px;
} }
.tt-suggestion.tt-cursor { .tt-suggestion.tt-cursor {
color: #fff; color: #fff;
background-color: #0097cf; background-color: #0097cf;
} }
.tt-suggestion p { .tt-suggestion p {
margin: 0; margin: 0;
} }
.typeahead-button { .typeahead-button {
line-height:1.39 !important; line-height: 1.39 !important;
} }
.ct-point { .ct-point {
cursor:pointer; cursor: pointer;
} }
.ct-timeline-point{ .ct-timeline-point {
cursor:pointer; cursor: pointer;
stroke:#ffffff; stroke: #ffffff;
stroke-width:1px; stroke-width: 1px;
} }
.ct-point-sending { .ct-point-sending {
fill:#428bca !important; fill: #428bca !important;
} }
.ct-point-error { .ct-point-error {
fill:#6c7a89 !important; fill: #6c7a89 !important;
} }
.ct-point-clicked { .ct-point-clicked {
fill:#F39C12 !important; fill: #F39C12 !important;
} }
.ct-point-opened { .ct-point-opened {
fill:#f9bf3b !important; fill: #f9bf3b !important;
} }
.ct-point-sent { .ct-point-sent {
fill:#1abc9c !important; fill: #1abc9c !important;
} }
.ct-point-success { .ct-point-success {
fill:#f05b4f !important; fill: #f05b4f !important;
} }
.chartist-tooltip{ .chartist-tooltip {
position:absolute; position: absolute;
display:inline-block; display: inline-block;
min-width:5em; min-width: 5em;
padding:.5em; padding: .5em;
background:#283F50; background: #283F50;
color:#ffffff; color: #ffffff;
font-weight:700; font-weight: 700;
text-align:center; text-align: center;
pointer-events:none; pointer-events: none;
z-index:1; z-index: 1;
margin-left:1.25em; margin-left: 1.25em;
font-size: .75em; font-size: .75em;
border-radius: 4px; border-radius: 4px;
} }
.chartist-pie-tooltip{ .chartist-pie-tooltip {
position:absolute; position: absolute;
display:inline-block; display: inline-block;
min-width:5em; min-width: 5em;
padding:.5em; padding: .5em;
background:#283F50; background: #283F50;
color:#ffffff; color: #ffffff;
font-weight:700; font-weight: 700;
text-align:center; text-align: center;
pointer-events:none; pointer-events: none;
z-index:1; z-index: 1;
margin-left:1.25em; margin-left: 1.25em;
font-size: .75em; font-size: .75em;
border-radius: 4px; border-radius: 4px;
} }
.chartist-tooltip:after{ .chartist-tooltip:after {
content:""; content: "";
position:absolute; position: absolute;
top:100%; top: 100%;
left:50%; left: 50%;
width:0; width: 0;
height:0; height: 0;
margin-left:-15px; margin-left: -15px;
border:15px solid transparent; border: 15px solid transparent;
border-top-color:#283F50 border-top-color: #283F50
} }
.chartist-chart { .chartist-chart {
height:175px; height: 175px;
} }
.chartist-legend { .chartist-legend {
list-style: none; list-style: none;
position: absolute; position: absolute;
padding-left:0px; padding-left: 0px;
top: 0; top: 0;
} }
.chartist-legend li { .chartist-legend li {
display: block; display: block;
position: relative; position: relative;
@ -305,41 +340,42 @@
-o-transition: background-color 200ms ease-in-out; -o-transition: background-color 200ms ease-in-out;
transition: background-color 200ms ease-in-out; transition: background-color 200ms ease-in-out;
} }
.chartist-legend li span { .chartist-legend li span {
display: inline-block; display: inline-block;
vertical-align:middle; vertical-align: middle;
width: 20px; width: 20px;
height: 20px; height: 20px;
margin-right:10px; margin-right: 10px;
border-radius: 50%; border-radius: 50%;
} }
.ct-series-a .ct-slice-donut { .ct-series-a .ct-slice-donut {
stroke:#1abc9c !important; stroke: #1abc9c !important;
} }
.ct-slice-donut.ct-slice-donut-error { .ct-slice-donut.ct-slice-donut-error {
stroke:#6c7a89 !important; stroke: #6c7a89 !important;
} }
.ct-slice-donut.ct-slice-donut-sent{ .ct-slice-donut.ct-slice-donut-sent {
stroke:#1abc9c !important stroke: #1abc9c !important
} }
.ct-slice-donut.ct-slice-donut-opened{ .ct-slice-donut.ct-slice-donut-opened {
stroke:#f9bf3b !important; stroke: #f9bf3b !important;
} }
.ct-slice-donut.ct-slice-donut-success{ .ct-slice-donut.ct-slice-donut-success {
stroke:#f05b4f !important; stroke: #f05b4f !important;
} }
.ct-slice-donut.ct-slice-donut-clicked{ .ct-slice-donut.ct-slice-donut-clicked {
stroke:#F39C12!important; stroke: #F39C12!important;
} }
.ct-slice-donut.ct-slice-donut-sending{ .ct-slice-donut.ct-slice-donut-sending {
stroke:#428bca !important; stroke: #428bca !important;
} }
.ct-legend-error { .ct-legend-error {
@ -371,13 +407,17 @@
} }
.gophish-editor { .gophish-editor {
font-family: 'Courier New',Monospace !important; font-family: 'Courier New', Monospace !important;
font-size: small !important; font-size: small !important;
} }
#resultsMap { #resultsMap {
margin-top:-30px; margin-top: -30px;
} }
/* Handle the navbar collapse at < 1300px */ /* Handle the navbar collapse at < 1300px */
@media (min-width: 768px) and (max-width: 1300px) { @media (min-width: 768px) and (max-width: 1300px) {
.navbar-collapse.collapse { .navbar-collapse.collapse {
display: none !important; display: none !important;
@ -385,23 +425,33 @@
.navbar-collapse.collapse.in { .navbar-collapse.collapse.in {
display: block !important; display: block !important;
} }
.navbar-header .collapse, .navbar-toggle { .navbar-header .collapse,
display:block !important; .navbar-toggle {
display: block !important;
} }
.navbar-header { .navbar-header {
float:none !important; float: none !important;
} }
} }
/* Table Styling */ /* Table Styling */
.modal-content .dataTable tbody td { .modal-content .dataTable tbody td {
font-size: 16px;/* Smaller font on modal tables */ font-size: 16px;
/* Smaller font on modal tables */
} }
.dataTables_info{
.dataTables_info {
font-size: 15px; font-size: 15px;
} }
/* Sort Icons */ /* Sort Icons */
table.dataTable thead .sorting:after, table.dataTable thead .sorting_asc:after, table.dataTable thead .sorting_desc:after {
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
font-family: 'FontAwesome' !important; font-family: 'FontAwesome' !important;
position: relative !important; position: relative !important;
display: initial !important; display: initial !important;
@ -410,160 +460,204 @@ table.dataTable thead .sorting:after, table.dataTable thead .sorting_asc:after,
left: 6px; left: 6px;
color: #1abc9c; color: #1abc9c;
} }
table.dataTable thead .sorting:after{
table.dataTable thead .sorting:after {
content: "\f0dc" !important; content: "\f0dc" !important;
color: initial; color: initial;
} }
table.dataTable thead .sorting_asc:after { table.dataTable thead .sorting_asc:after {
content: "\f0de" !important; content: "\f0de" !important;
opacity: .8 !important; opacity: .8 !important;
} }
table.dataTable thead .sorting_desc:after { table.dataTable thead .sorting_desc:after {
content: "\f0dd" !important; content: "\f0dd" !important;
opacity: .8 !important; opacity: .8 !important;
} }
td.details-control{
cursor:pointer; td.details-control {
cursor: pointer;
} }
.timeline{
text-align:left; .timeline {
background-color:#ffffff; text-align: left;
background-color: #ffffff;
} }
.timeline-graph{
margin-left:30px; .timeline-graph {
margin-left: 30px;
} }
.timeline>h6{
margin-top:0px; .timeline>h6 {
margin-bottom:5px; margin-top: 0px;
margin-bottom: 5px;
} }
.timeline>.subtitle{
.timeline>.subtitle {
color: #999999; color: #999999;
font-style: italic; font-style: italic;
margin-bottom:15px; margin-bottom: 15px;
display:block; display: block;
} }
.timeline-entry{
position:relative; .timeline-entry {
padding-bottom:36px; position: relative;
padding-bottom: 36px;
} }
.timeline-bar { .timeline-bar {
display:block; display: block;
content:""; content: "";
position:absolute; position: absolute;
top:5px; top: 5px;
bottom:0; bottom: 0;
width:1px; width: 1px;
left:-6px; left: -6px;
background:#aaaaaa; background: #aaaaaa;
} }
.timeline-entry:last-child .timeline-bar{
display:none; .timeline-entry:last-child .timeline-bar {
display: none;
} }
.timeline-entry:last-child { .timeline-entry:last-child {
padding-bottom:0px; padding-bottom: 0px;
} }
.timeline-icon{
position:relative; .timeline-icon {
float:left; position: relative;
margin-left:-24px; float: left;
width:36px; margin-left: -24px;
top:-5px; width: 36px;
height:36px; top: -5px;
text-align:center; height: 36px;
border-radius:50%; text-align: center;
border-radius: 50%;
} }
.timeline-icon>i{
margin-top:10px; .timeline-icon>i {
color:#ffffff; margin-top: 10px;
color: #ffffff;
} }
.timeline-message { .timeline-message {
padding-left:30px; padding-left: 30px;
} }
.timeline-date { .timeline-date {
float:right; float: right;
color:#999999; color: #999999;
font-style:italic; font-style: italic;
} }
.timeline-event-details { .timeline-event-details {
font-size:16px; font-size: 16px;
margin-top:5px; margin-top: 5px;
cursor:pointer; cursor: pointer;
} }
.timeline-replay-button { .timeline-replay-button {
margin-top:10px; margin-top: 10px;
} }
.timeline-event-details>.table-responsive{
display:none; .timeline-event-details>.table-responsive {
display: none;
} }
.timeline-event-details{
.timeline-event-details {
margin-top: 10px; margin-top: 10px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.timeline-event-results{
font-size:16px; .timeline-event-results {
display:none; font-size: 16px;
display: none;
} }
.tooltip-inner { .tooltip-inner {
width:300px !important; width: 300px !important;
} }
#refresh_message{
display:none; #refresh_message {
display: none;
} }
#capture_passwords { #capture_passwords {
display:none; display: none;
} }
#redirect_url { #redirect_url {
display:none; display: none;
} }
@media (max-width: 767px) { @media (max-width: 767px) {
.navbar-header { .navbar-header {
margin-left:10px !important; margin-left: 10px !important;
} }
} }
table.dataTable{
width:100% !important; table.dataTable {
width: 100% !important;
} }
.btn-blue { .btn-blue {
color:#fff; color: #fff;
background-color:#428bca; background-color: #428bca;
border-color:#428bca; border-color: #428bca;
} }
.btn-blue:hover{
background-color:#64a1d6; .btn-blue:hover {
background-color: #64a1d6;
} }
.select2-container--bootstrap .select2-selection--single .select2-selection__rendered { .select2-container--bootstrap .select2-selection--single .select2-selection__rendered {
font-size: 15px !important; font-size: 15px !important;
} }
.select2-container--bootstrap .select2-selection--single { .select2-container--bootstrap .select2-selection--single {
height: 42px !important; height: 42px !important;
padding: 8px 12px !important; padding: 8px 12px !important;
} }
.input-group-btn .btn { .input-group-btn .btn {
line-height:20px !important; line-height: 20px !important;
} }
.highcharts-title { .highcharts-title {
font-family: "Source Sans Pro",Helvetica,Arial,sans-serif; font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;
font-size: 16px !important; font-size: 16px !important;
} }
.color-success { .color-success {
font-weight: bold; font-weight: bold;
color: #f05b4f; color: #f05b4f;
} }
.color-sent { .color-sent {
font-weight: bold; font-weight: bold;
color: #1abc9c; color: #1abc9c;
} }
.color-opened { .color-opened {
font-weight: bold; font-weight: bold;
color: #f9bf3b; color: #f9bf3b;
} }
.color-clicked { .color-clicked {
font-weight: bold; font-weight: bold;
color: #f39c12; color: #f39c12;
} }
.color-success { .color-success {
color: #f05b4f; color: #f05b4f;
} }
.nav-sidebar>li.active>a:focus, .nav-sidebar>li.active>a:hover {
.nav-sidebar>li.active>a:focus,
.nav-sidebar>li.active>a:hover {
background-color: #37485a; background-color: #37485a;
} }
#resultsMapContainer {
display: none;
}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
$(document).ready(function(){$("#apiResetForm").submit(function(s){return $.post("/api/reset",$(this).serialize()).done(function(s){api_key=s.data,successFlash(s.message),$("#api_key").val(api_key)}).fail(function(s){errorFlash(s.message)}),!1}),$("#settingsForm").submit(function(s){return $.post("/settings",$(this).serialize()).done(function(s){successFlash(s.message)}).fail(function(s){errorFlash(s.responseJSON.message)}),!1})}); $(document).ready(function(){$("#apiResetForm").submit(function(e){return $.post("/api/reset",$(this).serialize()).done(function(e){api_key=e.data,successFlash(e.message),$("#api_key").val(api_key)}).fail(function(e){errorFlash(e.message)}),!1}),$("#settingsForm").submit(function(e){return $.post("/settings",$(this).serialize()).done(function(e){successFlash(e.message)}).fail(function(e){errorFlash(e.responseJSON.message)}),!1});var e=localStorage.getItem("gophish.use_map");$("#use_map").prop("checked",JSON.parse(e)),$("#use_map").on("change",function(){localStorage.setItem("gophish.use_map",JSON.stringify(this.checked))})});

View File

@ -413,7 +413,9 @@ var renderPieChart = function (chartopts) {
}).add(); }).add();
}, },
render: function () { render: function () {
this.innerText.attr({ text: chartopts['data'][0].y }) this.innerText.attr({
text: chartopts['data'][0].y
})
} }
} }
}, },
@ -446,6 +448,41 @@ var renderPieChart = function (chartopts) {
}) })
} }
/* Updates the bubbles on the map
@param {campaign.result[]} results - The campaign results to process
*/
var updateMap = function (results) {
if (!map) {
return
}
bubbles = []
$.each(campaign.results, function (i, result) {
// Check that it wasn't an internal IP
if (result.latitude == 0 && result.longitude == 0) {
return true;
}
newIP = true
$.each(bubbles, function (i, bubble) {
if (bubble.ip == result.ip) {
bubbles[i].radius += 1
newIP = false
return false
}
})
if (newIP) {
bubbles.push({
latitude: result.latitude,
longitude: result.longitude,
name: result.ip,
fillKey: "point",
radius: 2
})
}
})
map.bubbles(bubbles)
}
/* poll - Queries the API and updates the UI with the results /* poll - Queries the API and updates the UI with the results
* *
* Updates: * Updates:
@ -536,31 +573,7 @@ function poll() {
}) })
}) })
/* Update the map information */ /* Update the map information */
bubbles = [] updateMap(campaign.results)
$.each(campaign.results, function (i, result) {
// Check that it wasn't an internal IP
if (result.latitude == 0 && result.longitude == 0) {
return true;
}
newIP = true
$.each(bubbles, function (i, bubble) {
if (bubble.ip == result.ip) {
bubbles[i].radius += 1
newIP = false
return false
}
})
if (newIP) {
bubbles.push({
latitude: result.latitude,
longitude: result.longitude,
name: result.ip,
fillKey: "point",
radius: 2
})
}
})
map.bubbles(bubbles)
$("#refresh_message").hide() $("#refresh_message").hide()
$("#refresh_btn").show() $("#refresh_btn").show()
}) })
@ -568,6 +581,7 @@ function poll() {
function load() { function load() {
campaign.id = window.location.pathname.split('/').slice(-1)[0] campaign.id = window.location.pathname.split('/').slice(-1)[0]
var use_map = JSON.parse(localStorage.getItem('gophish.use_map'))
api.campaignId.results(campaign.id) api.campaignId.results(campaign.id)
.success(function (c) { .success(function (c) {
campaign = c campaign = c
@ -696,7 +710,8 @@ function load() {
colors: [statuses[status].color, '#dddddd'] colors: [statuses[status].color, '#dddddd']
}) })
}) })
if (!map) { if (use_map) {
$("#resultsMapContainer").show()
map = new Datamap({ map = new Datamap({
element: document.getElementById("resultsMap"), element: document.getElementById("resultsMap"),
responsive: true, responsive: true,
@ -713,49 +728,8 @@ function load() {
} }
}); });
} }
$.each(campaign.results, function (i, result) { updateMap(campaign.results)
// Check that it wasn't an internal IP
if (result.latitude == 0 && result.longitude == 0) {
return true;
} }
newIP = true
$.each(bubbles, function (i, bubble) {
if (bubble.ip == result.ip) {
bubbles[i].radius += 1
newIP = false
return false
}
})
if (newIP) {
bubbles.push({
latitude: result.latitude,
longitude: result.longitude,
name: result.ip,
fillKey: "point",
radius: 2
})
}
})
map.bubbles(bubbles)
}
// Load up the map data (only once!)
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
if ($(e.target).attr('href') == "#overview") {
if (!map) {
map = new Datamap({
element: document.getElementById("resultsMap"),
responsive: true,
fills: {
defaultFill: "#ffffff"
},
geographyConfig: {
highlightFillColor: "#1abc9c",
borderColor: "#283F50"
}
});
}
}
})
}) })
.error(function () { .error(function () {
$("#loading").hide() $("#loading").hide()
@ -764,6 +738,7 @@ function load() {
} }
var setRefresh var setRefresh
function refresh() { function refresh() {
if (!doPoll) { if (!doPoll) {
return; return;

View File

@ -1,24 +1,29 @@
$(document).ready(function() { $(document).ready(function () {
$("#apiResetForm").submit(function(e) { $("#apiResetForm").submit(function (e) {
$.post("/api/reset", $(this).serialize()) $.post("/api/reset", $(this).serialize())
.done(function(data) { .done(function (data) {
api_key = data.data api_key = data.data
successFlash(data.message) successFlash(data.message)
$("#api_key").val(api_key) $("#api_key").val(api_key)
}) })
.fail(function(data) { .fail(function (data) {
errorFlash(data.message) errorFlash(data.message)
}) })
return false return false
}) })
$("#settingsForm").submit(function(e) { $("#settingsForm").submit(function (e) {
$.post("/settings", $(this).serialize()) $.post("/settings", $(this).serialize())
.done(function(data) { .done(function (data) {
successFlash(data.message) successFlash(data.message)
}) })
.fail(function(data) { .fail(function (data) {
errorFlash(data.responseJSON.message) errorFlash(data.responseJSON.message)
}) })
return false return false
}) })
var use_map = localStorage.getItem('gophish.use_map')
$("#use_map").prop('checked', JSON.parse(use_map))
$("#use_map").on('change', function () {
localStorage.setItem('gophish.use_map', JSON.stringify(this.checked))
})
}) })

View File

@ -78,7 +78,7 @@
<div id="clicked_chart" style="height:200px;" class="col-lg-3 col-md-3"></div> <div id="clicked_chart" style="height:200px;" class="col-lg-3 col-md-3"></div>
<div id="submitted_data_chart" style="height:200px;" class="col-lg-3 col-md-3"></div> <div id="submitted_data_chart" style="height:200px;" class="col-lg-3 col-md-3"></div>
</div> </div>
<div class="row"> <div class="row" id="resultsMapContainer">
<div class="col-md-6"> <div class="col-md-6">
<p style="text-align:center;">Targets Map</p> <p style="text-align:center;">Targets Map</p>
<div id="resultsMap"></div> <div id="resultsMap"></div>

View File

@ -17,7 +17,9 @@
</li> </li>
<li class="active"><a href="/settings">Settings</a> <li class="active"><a href="/settings">Settings</a>
</li> </li>
<li><hr></li> <li>
<hr>
</li>
<li><a href="https://gophish.gitbooks.io/user-guide/content/">User Guide</a> <li><a href="https://gophish.gitbooks.io/user-guide/content/">User Guide</a>
</li> </li>
<li><a href="/api/">API Documentation</a> <li><a href="/api/">API Documentation</a>
@ -31,6 +33,15 @@
<h1 class="page-header">Settings</h1> <h1 class="page-header">Settings</h1>
</div> </div>
<div id="flashes" class="row"></div> <div id="flashes" class="row"></div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="active" role="mainSettings"><a href="#mainSettings" aria-controls="mainSettings" role="tab" data-toggle="tab">Account Settings</a></li>
<li role="uiSettings"><a href="#uiSettings" aria-controls="uiSettings" role="tab" data-toggle="tab">UI Settings</a></li>
</ul>
<!-- Tab Panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="mainSettings">
<br/>
<div class="row"> <div class="row">
<label class="col-sm-2 control-label form-label">Gophish version</label> <label class="col-sm-2 control-label form-label">Gophish version</label>
<div class="col-md-6"> <div class="col-md-6">
@ -52,7 +63,7 @@
</div> </div>
<form id="apiResetForm"> <form id="apiResetForm">
<button class="btn btn-primary"><i class="fa fa-refresh" type="submit"></i> Reset</button> <button class="btn btn-primary"><i class="fa fa-refresh" type="submit"></i> Reset</button>
<input type="hidden" name="csrf_token" value="{{.Token}}"/> <input type="hidden" name="csrf_token" value="{{.Token}}" />
</form> </form>
</div> </div>
<br /> <br />
@ -67,7 +78,7 @@
<div class="row"> <div class="row">
<label for="current_password" class="col-sm-2 control-label form-label">Old Password:</label> <label for="current_password" class="col-sm-2 control-label form-label">Old Password:</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="password" id="current_password" name="current_password" autocomplete="off" class="form-control"/> <input type="password" id="current_password" name="current_password" autocomplete="off" class="form-control" />
</div> </div>
</div> </div>
<br /> <br />
@ -84,13 +95,21 @@
<input type="password" id="confirm_new_password" name="confirm_new_password" autocomplete="off" class="form-control" /> <input type="password" id="confirm_new_password" name="confirm_new_password" autocomplete="off" class="form-control" />
</div> </div>
</div> </div>
<input type="hidden" name="csrf_token" value="{{.Token}}"/> <input type="hidden" name="csrf_token" value="{{.Token}}" />
<br /> <br />
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> Save</button> <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> Save</button>
</form> </form>
<br/> <br/>
</div>
<div role="tabpanel" class="tab-pane" id="uiSettings">
<br/>
<div class="checkbox checkbox-primary">
<input id="use_map" type="checkbox">
<label for="use_map">Show campaign results map</label>
</div>
</div>
</div>
</div> </div>
{{end}} {{end}} {{define "scripts"}}
{{define "scripts"}}
<script src="/js/dist/app/settings.min.js"></script> <script src="/js/dist/app/settings.min.js"></script>
{{end}} {{end}}