Making result statuses more granular as part of #505

pull/446/merge
Jordan Wright 2017-01-05 17:40:45 -06:00
parent 70b62934c1
commit 9982769d0f
6 changed files with 70 additions and 13 deletions

View File

@ -180,7 +180,6 @@ func PhishHandler(w http.ResponseWriter, r *http.Request) {
http.NotFound(w, r)
return
}
rs.UpdateStatus(models.STATUS_SUCCESS)
p, err := models.GetPage(c.PageId, c.UserId)
if err != nil {
Logger.Println(err)
@ -216,12 +215,16 @@ func PhishHandler(w http.ResponseWriter, r *http.Request) {
}
switch {
case r.Method == "GET":
if rs.Status != models.EVENT_CLICKED && rs.Status != models.EVENT_DATA_SUBMIT {
rs.UpdateStatus(models.EVENT_CLICKED)
}
err = c.AddEvent(models.Event{Email: rs.Email, Message: models.EVENT_CLICKED, Details: string(rj)})
if err != nil {
Logger.Println(err)
}
case r.Method == "POST":
// If data was POST'ed, let's record it
rs.UpdateStatus(models.EVENT_DATA_SUBMIT)
// Store the data in an event
c.AddEvent(models.Event{Email: rs.Email, Message: models.EVENT_DATA_SUBMIT, Details: string(rj)})
if err != nil {

View File

@ -0,0 +1,24 @@
-- +goose Up
-- SQL in section 'Up' is executed when this migration is applied
UPDATE results
SET status = "Submitted Data"
WHERE id IN (
SELECT results_tmp.id
FROM (SELECT * FROM results) AS results_tmp, events
WHERE results.status = "Success"
AND events.message="Submitted Data"
AND results_tmp.email = events.email
AND results_tmp.campaign_id = events.campaign_id);
UPDATE results
SET status = "Clicked Link"
WHERE id IN (
SELECT results_tmp.id
FROM (SELECT * FROM results) as results_tmp, events
WHERE results_tmp.status = "Success"
AND events.message="Clicked Link"
AND results_tmp.email = events.email
AND results_tmp.campaign_id = events.campaign_id);
-- +goose Down
-- SQL section 'Down' is executed when this migration is rolled back

View File

@ -0,0 +1,26 @@
-- +goose Up
-- SQL in section 'Up' is executed when this migration is applied
UPDATE results
SET status = "Submitted Data"
WHERE id IN (
SELECT results.id
FROM results, events
WHERE results.status = "Success"
AND events.message="Submitted Data"
AND results.email = events.email
AND results.campaign_id = events.campaign_id);
UPDATE results
SET status = "Clicked Link"
WHERE id IN (
SELECT results.id
FROM results, events
WHERE results.status = "Success"
AND events.message="Clicked Link"
AND results.email = events.email
AND results.campaign_id = events.campaign_id);
-- +goose Down
-- SQL section 'Down' is executed when this migration is rolled back

16
static/css/main.css vendored
View File

@ -223,11 +223,11 @@
}
.ct-point-clicked {
fill:#f05b4f !important;
fill:#F39C12 !important;
}
.ct-point-opened {
fill:#eb9532 !important;
fill:#f9bf3b !important;
}
.ct-point-sent {
@ -327,7 +327,7 @@
}
.ct-slice-donut.ct-slice-donut-opened{
stroke:#eb9532 !important;
stroke:#f9bf3b !important;
}
.ct-slice-donut.ct-slice-donut-success{
@ -335,7 +335,7 @@
}
.ct-slice-donut.ct-slice-donut-clicked{
stroke:#f05b4f !important;
stroke:#F39C12!important;
}
.ct-slice-donut.ct-slice-donut-sending{
@ -351,7 +351,7 @@
}
.ct-legend-opened {
background-color: #eb9532 !important;
background-color: #f9bf3b !important;
}
.ct-legend-success {
@ -359,13 +359,17 @@
}
.ct-legend-clicked {
background-color: #f05b4f !important;
background-color: #F39C12 !important;
}
.ct-legend-sending {
background-color: #428bca !important;
}
.label-clicked {
background-color: #F39C12 !important;
}
.gophish-editor {
font-family: 'Courier New',Monospace !important;
font-size: small !important;

View File

@ -20,13 +20,13 @@ var statuses = {
"Clicked Link": {
slice: "ct-slice-donut-clicked",
legend: "ct-legend-clicked",
label: "label-danger",
label: "label-clicked",
icon: "fa-mouse-pointer",
point: "ct-point-clicked"
},
"Success": {
slice: "ct-slice-donut-clicked",
legend: "ct-legend-clicked",
slice: "ct-slice-donut-success",
legend: "ct-legend-success",
label: "label-danger",
icon: "fa-exclamation",
point: "ct-point-clicked"
@ -46,8 +46,8 @@ var statuses = {
point: "ct-point-error"
},
"Submitted Data": {
slice: "ct-slice-donut-clicked",
legend: "ct-legend-clicked",
slice: "ct-slice-donut-success",
legend: "ct-legend-success",
label: "label-danger",
icon: "fa-exclamation",
point: "ct-point-clicked"

View File

@ -74,7 +74,7 @@ $(document).ready(function() {
// Add it to the chart data
campaign.y = 0
$.each(campaign.results, function(j, result) {
if (result.status == "Success") {
if (result.status == "Clicked Link" || result.status == "Submitted Data") {
campaign.y++;
}
})