diff --git a/controllers/route.go b/controllers/route.go index c2ea06c0..56e9da58 100644 --- a/controllers/route.go +++ b/controllers/route.go @@ -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 { diff --git a/db/db_mysql/migrations/20170104231222_0.2_result_statuses.sql b/db/db_mysql/migrations/20170104231222_0.2_result_statuses.sql new file mode 100644 index 00000000..fa819de5 --- /dev/null +++ b/db/db_mysql/migrations/20170104231222_0.2_result_statuses.sql @@ -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 diff --git a/db/db_sqlite3/migrations/20170104220731_0.2_result_statuses.sql b/db/db_sqlite3/migrations/20170104220731_0.2_result_statuses.sql new file mode 100644 index 00000000..bfdffce8 --- /dev/null +++ b/db/db_sqlite3/migrations/20170104220731_0.2_result_statuses.sql @@ -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 + diff --git a/static/css/main.css b/static/css/main.css index 5c2bb719..0a29431c 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -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; diff --git a/static/js/app/campaign_results.js b/static/js/app/campaign_results.js index f4aed2d3..0b65d33f 100644 --- a/static/js/app/campaign_results.js +++ b/static/js/app/campaign_results.js @@ -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" diff --git a/static/js/app/dashboard.js b/static/js/app/dashboard.js index d1b36e92..e9670474 100644 --- a/static/js/app/dashboard.js +++ b/static/js/app/dashboard.js @@ -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++; } })