mirror of https://github.com/gophish/gophish
Added graph of average phishing results to dashboard
parent
ad3e69e6ae
commit
28e074f1fd
|
@ -11,7 +11,8 @@ app.controller('DashboardCtrl', function($scope, $filter, $location, CampaignSer
|
||||||
getData: function($defer, params) {
|
getData: function($defer, params) {
|
||||||
CampaignService.query(function(campaigns) {
|
CampaignService.query(function(campaigns) {
|
||||||
$scope.campaigns = campaigns
|
$scope.campaigns = campaigns
|
||||||
var campaign_series = []
|
var campaign_series = [];
|
||||||
|
var avg = 0;
|
||||||
angular.copy(campaigns, campaign_series)
|
angular.copy(campaigns, campaign_series)
|
||||||
angular.forEach(campaigns, function(campaign, key) {
|
angular.forEach(campaigns, function(campaign, key) {
|
||||||
campaign.x = new Date(campaign.created_date)
|
campaign.x = new Date(campaign.created_date)
|
||||||
|
@ -22,7 +23,9 @@ app.controller('DashboardCtrl', function($scope, $filter, $location, CampaignSer
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
campaign.y = Math.floor((campaign.y / campaign.results.length) * 100)
|
campaign.y = Math.floor((campaign.y / campaign.results.length) * 100)
|
||||||
|
avg += campaign.y
|
||||||
});
|
});
|
||||||
|
avg = Math.floor(avg / campaigns.length);
|
||||||
$scope.overview_chart = {
|
$scope.overview_chart = {
|
||||||
options: {
|
options: {
|
||||||
chart: {
|
chart: {
|
||||||
|
@ -44,7 +47,6 @@ app.controller('DashboardCtrl', function($scope, $filter, $location, CampaignSer
|
||||||
point: {
|
point: {
|
||||||
events: {
|
events: {
|
||||||
click: function(e) {
|
click: function(e) {
|
||||||
console.log(this)
|
|
||||||
$location.path("/campaigns/" + this.id)
|
$location.path("/campaigns/" + this.id)
|
||||||
$scope.$apply()
|
$scope.$apply()
|
||||||
}
|
}
|
||||||
|
@ -74,6 +76,56 @@ app.controller('DashboardCtrl', function($scope, $filter, $location, CampaignSer
|
||||||
},
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
}
|
}
|
||||||
|
$scope.average_chart = {
|
||||||
|
options: {
|
||||||
|
chart: {
|
||||||
|
type: 'pie'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
formatter: function() {
|
||||||
|
return this.point.y + "%"
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
padding: 10,
|
||||||
|
fontWeight: 'bold'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plotOptions: {
|
||||||
|
pie: {
|
||||||
|
innerSize: '60%',
|
||||||
|
allowPointSelect: true,
|
||||||
|
cursor: 'pointer',
|
||||||
|
dataLabels: {
|
||||||
|
enabled: false
|
||||||
|
},
|
||||||
|
showInLegend: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
name: "Successful Phishes",
|
||||||
|
color: "#e74c3c",
|
||||||
|
y: avg
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Unsuccessful Phishes",
|
||||||
|
color: "#7cb5ec",
|
||||||
|
y: 100-avg
|
||||||
|
}]
|
||||||
|
}],
|
||||||
|
title: {
|
||||||
|
text: 'Average Phishing Results'
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
height: 300
|
||||||
|
},
|
||||||
|
credits: {
|
||||||
|
enabled: false
|
||||||
|
},
|
||||||
|
loading: false,
|
||||||
|
}
|
||||||
params.total(Math.min(campaigns.length, 5));
|
params.total(Math.min(campaigns.length, 5));
|
||||||
$defer.resolve(campaigns.slice(0, params.total()));
|
$defer.resolve(campaigns.slice(0, params.total()));
|
||||||
})
|
})
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
|
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
|
||||||
<highchart config="overview_chart"></highchart>
|
<highchart config="overview_chart"></highchart>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
|
||||||
|
<highchart config="average_chart"></highchart>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h2>Recent Campaigns</h2>
|
<h2>Recent Campaigns</h2>
|
||||||
|
|
Loading…
Reference in New Issue