Browse Source

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 3 years ago
parent
commit
6f81f1f2e2
8 changed files with 577 additions and 484 deletions
  1. +1
    -1
      static/css/dist/gophish.css
  2. +433
    -339
      static/css/main.css
  3. +1
    -1
      static/js/dist/app/campaign_results.min.js
  4. +1
    -1
      static/js/dist/app/settings.min.js
  5. +52
    -77
      static/js/src/app/campaign_results.js
  6. +13
    -8
      static/js/src/app/settings.js
  7. +1
    -1
      templates/campaign_results.html
  8. +75
    -56
      templates/settings.html

+ 1
- 1
static/css/dist/gophish.css
File diff suppressed because it is too large
View File


+ 433
- 339
static/css/main.css View File

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

+ 1
- 1
static/js/dist/app/campaign_results.min.js
File diff suppressed because it is too large
View File


+ 1
- 1
static/js/dist/app/settings.min.js 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))})});

+ 52
- 77
static/js/src/app/campaign_results.js View File

@ -404,16 +404,18 @@ var renderPieChart = function (chartopts) {
left = chart.plotLeft + pie.center[0],
top = chart.plotTop + pie.center[1];
this.innerText = rend.text(chartopts['data'][0].y, left, top).
attr({
'text-anchor': 'middle',
'font-size': '24px',
'font-weight': 'bold',
'fill': chartopts['colors'][0],
'font-family': 'Helvetica,Arial,sans-serif'
}).add();
attr({
'text-anchor': 'middle',
'font-size': '24px',
'font-weight': 'bold',
'fill': chartopts['colors'][0],
'font-family': 'Helvetica,Arial,sans-serif'
}).add();
},
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
*
* Updates:
@ -536,31 +573,7 @@ function poll() {
})
})
/* Update the map information */
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)
updateMap(campaign.results)
$("#refresh_message").hide()
$("#refresh_btn").show()
})
@ -568,6 +581,7 @@ function poll() {
function load() {
campaign.id = window.location.pathname.split('/').slice(-1)[0]
var use_map = JSON.parse(localStorage.getItem('gophish.use_map'))
api.campaignId.results(campaign.id)
.success(function (c) {
campaign = c
@ -696,7 +710,8 @@ function load() {
colors: [statuses[status].color, '#dddddd']
})
})
if (!map) {
if (use_map) {
$("#resultsMapContainer").show()
map = new Datamap({
element: document.getElementById("resultsMap"),
responsive: true,
@ -713,49 +728,8 @@ function load() {
}
});
}
$.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)
updateMap(campaign.results)
}
// 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 () {
$("#loading").hide()
@ -764,6 +738,7 @@ function load() {
}
var setRefresh
function refresh() {
if (!doPoll) {
return;
@ -787,4 +762,4 @@ $(document).ready(function () {
// Start the polling loop
setRefresh = setTimeout(refresh, 60000)
})
})

+ 13
- 8
static/js/src/app/settings.js View File

@ -1,24 +1,29 @@
$(document).ready(function() {
$("#apiResetForm").submit(function(e) {
$(document).ready(function () {
$("#apiResetForm").submit(function (e) {
$.post("/api/reset", $(this).serialize())
.done(function(data) {
.done(function (data) {
api_key = data.data
successFlash(data.message)
$("#api_key").val(api_key)
})
.fail(function(data) {
.fail(function (data) {
errorFlash(data.message)
})
return false
})
$("#settingsForm").submit(function(e) {
$("#settingsForm").submit(function (e) {
$.post("/settings", $(this).serialize())
.done(function(data) {
.done(function (data) {
successFlash(data.message)
})
.fail(function(data) {
.fail(function (data) {
errorFlash(data.responseJSON.message)
})
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))
})
})

+ 1
- 1
templates/campaign_results.html View File

@ -78,7 +78,7 @@
<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>
<div class="row">
<div class="row" id="resultsMapContainer">
<div class="col-md-6">
<p style="text-align:center;">Targets Map</p>
<div id="resultsMap"></div>

+ 75
- 56
templates/settings.html View File

@ -17,7 +17,9 @@
</li>
<li class="active"><a href="/settings">Settings</a>
</li>
<li><hr></li>
<li>
<hr>
</li>
<li><a href="https://gophish.gitbooks.io/user-guide/content/">User Guide</a>
</li>
<li><a href="/api/">API Documentation</a>
@ -31,66 +33,83 @@
<h1 class="page-header">Settings</h1>
</div>
<div id="flashes" class="row"></div>
<div class="row">
<label class="col-sm-2 control-label form-label">Gophish version</label>
<div class="col-md-6">
<label class="form-label">{{.Version}}</label>
</div>
</div>
<br/>
<div class="row">
<label class="col-sm-2 control-label form-label">Register a New User</label>
<div class="col-md-6">
<a href="/register" class="btn btn-primary"><i class="fa fa-plus"></i> Add User</a>
<!-- 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">
<label class="col-sm-2 control-label form-label">Gophish version</label>
<div class="col-md-6">
<label class="form-label">{{.Version}}</label>
</div>
</div>
</div>
<br/>
<div class="row">
<label for="api_key" class="col-sm-2 control-label form-label">API Key:</label>
<div class="col-md-6">
<input type="text" id="api_key" onclick="this.select();" value="{{.User.ApiKey}}" class="form-control" readonly/>
</div>
<form id="apiResetForm">
<button class="btn btn-primary"><i class="fa fa-refresh" type="submit"></i> Reset</button>
<input type="hidden" name="csrf_token" value="{{.Token}}"/>
</form>
</div>
<br />
<form id="settingsForm">
<div class="row">
<label for="username" class="col-sm-2 control-label form-label">Username:</label>
<div class="col-md-6">
<input type="text" id="username" name="username" value="{{.User.Username}}" class="form-control" />
</div>
</div>
<br />
<div class="row">
<label for="current_password" class="col-sm-2 control-label form-label">Old Password:</label>
<div class="col-md-6">
<input type="password" id="current_password" name="current_password" autocomplete="off" class="form-control"/>
<br/>
<div class="row">
<label class="col-sm-2 control-label form-label">Register a New User</label>
<div class="col-md-6">
<a href="/register" class="btn btn-primary"><i class="fa fa-plus"></i> Add User</a>
</div>
</div>
</div>
<br />
<div class="row">
<label for="new_password" class="col-sm-2 control-label form-label">New Password:</label>
<div class="col-md-6">
<input type="password" id="new_password" name="new_password" autocomplete="off" class="form-control" />
<br/>
<div class="row">
<label for="api_key" class="col-sm-2 control-label form-label">API Key:</label>
<div class="col-md-6">
<input type="text" id="api_key" onclick="this.select();" value="{{.User.ApiKey}}" class="form-control" readonly/>
</div>
<form id="apiResetForm">
<button class="btn btn-primary"><i class="fa fa-refresh" type="submit"></i> Reset</button>
<input type="hidden" name="csrf_token" value="{{.Token}}" />
</form>
</div>
<br />
<form id="settingsForm">
<div class="row">
<label for="username" class="col-sm-2 control-label form-label">Username:</label>
<div class="col-md-6">
<input type="text" id="username" name="username" value="{{.User.Username}}" class="form-control" />
</div>
</div>
<br />
<div class="row">
<label for="current_password" class="col-sm-2 control-label form-label">Old Password:</label>
<div class="col-md-6">
<input type="password" id="current_password" name="current_password" autocomplete="off" class="form-control" />
</div>
</div>
<br />
<div class="row">
<label for="new_password" class="col-sm-2 control-label form-label">New Password:</label>
<div class="col-md-6">
<input type="password" id="new_password" name="new_password" autocomplete="off" class="form-control" />
</div>
</div>
<br />
<div class="row">
<label for="confirm_new_password" class="col-sm-2 control-label form-label">Confirm New Password:</label>
<div class="col-md-6">
<input type="password" id="confirm_new_password" name="confirm_new_password" autocomplete="off" class="form-control" />
</div>
</div>
<input type="hidden" name="csrf_token" value="{{.Token}}" />
<br />
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> Save</button>
</form>
<br/>
</div>
<br />
<div class="row">
<label for="confirm_new_password" class="col-sm-2 control-label form-label">Confirm New Password:</label>
<div class="col-md-6">
<input type="password" id="confirm_new_password" name="confirm_new_password" autocomplete="off" class="form-control" />
<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>
<input type="hidden" name="csrf_token" value="{{.Token}}"/>
<br />
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> Save</button>
</form>
<br/>
</div>
</div>
{{end}}
{{define "scripts"}}
{{end}} {{define "scripts"}}
<script src="/js/dist/app/settings.min.js"></script>
{{end}}
{{end}}

Loading…
Cancel
Save