mirror of https://github.com/gophish/gophish
commit
8776694aa2
|
@ -112,6 +112,7 @@ func (ps *PhishingServer) registerRoutes() {
|
|||
router.PathPrefix("/static/").Handler(http.StripPrefix("/static/", fileServer))
|
||||
router.HandleFunc("/track", ps.TrackHandler)
|
||||
router.HandleFunc("/robots.txt", ps.RobotsHandler)
|
||||
router.HandleFunc("/event", ps.CustomEventHandler)
|
||||
router.HandleFunc("/{path:.*}/track", ps.TrackHandler)
|
||||
router.HandleFunc("/{path:.*}/report", ps.ReportHandler)
|
||||
router.HandleFunc("/report", ps.ReportHandler)
|
||||
|
@ -126,6 +127,31 @@ func (ps *PhishingServer) registerRoutes() {
|
|||
ps.server.Handler = phishHandler
|
||||
}
|
||||
|
||||
// CustomEventHandler deals with Custom events - for example opening Word documents, secondary links, etc
|
||||
func (ps *PhishingServer) CustomEventHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
r, err := setupContext(r)
|
||||
if err != nil {
|
||||
// Log the error if it wasn't something we can safely ignore
|
||||
if err != ErrInvalidRequest && err != ErrCampaignComplete {
|
||||
log.Error(err)
|
||||
}
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
rs := ctx.Get(r, "result").(models.Result)
|
||||
d := ctx.Get(r, "details").(models.EventDetails)
|
||||
|
||||
err = rs.HandleCustomEvent(d)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
http.NotFound(w, r)
|
||||
} else {
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
}
|
||||
}
|
||||
|
||||
// TrackHandler tracks emails as they are opened, updating the status for the given Result
|
||||
func (ps *PhishingServer) TrackHandler(w http.ResponseWriter, r *http.Request) {
|
||||
r, err := setupContext(r)
|
||||
|
|
|
@ -51,6 +51,7 @@ const (
|
|||
EventClicked string = "Clicked Link"
|
||||
EventDataSubmit string = "Submitted Data"
|
||||
EventReported string = "Email Reported"
|
||||
EventCustomEvent string = "Custom Event"
|
||||
EventProxyRequest string = "Proxied request"
|
||||
StatusSuccess string = "Success"
|
||||
StatusQueued string = "Queued"
|
||||
|
|
|
@ -3,6 +3,7 @@ package models
|
|||
import (
|
||||
"crypto/rand"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"math/big"
|
||||
"net"
|
||||
"time"
|
||||
|
@ -135,6 +136,24 @@ func (r *Result) HandleFormSubmit(details EventDetails) error {
|
|||
return db.Save(r).Error
|
||||
}
|
||||
|
||||
// HandleCustomEvent updates a Result with an custom event (e.g Word document opened, secondary link clicked)
|
||||
func (r *Result) HandleCustomEvent(details EventDetails) error {
|
||||
|
||||
EventTitle := details.Payload.Get("title")
|
||||
|
||||
if EventTitle == "" {
|
||||
return errors.New("No title supplied for custom event")
|
||||
}
|
||||
|
||||
event, err := r.createEvent(EventCustomEvent, details)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r.Status = EventTitle
|
||||
r.ModifiedDate = event.Time
|
||||
return db.Save(r).Error
|
||||
}
|
||||
|
||||
// HandleEmailReport updates a Result in the case where they report a simulated
|
||||
// phishing email using the HTTP handler.
|
||||
func (r *Result) HandleEmailReport(details EventDetails) error {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -54,8 +54,14 @@
|
|||
<div id="clicked_chart" style="height:200px;" class="col-lg-2 col-md-2"></div>
|
||||
<div id="submitted_data_chart" style="height:200px;" class="col-lg-2 col-md-2"></div>
|
||||
<div id="reported_chart" style="height:200px;" class="col-lg-2 col-md-2"></div>
|
||||
<!--<div id="opened_word_document_chart" style="height:200px;" class="col-lg-2 col-md-2" hidden></div>-->
|
||||
<div style="height:200px;" class="col-lg-1 col-md-1"></div>
|
||||
</div>
|
||||
|
||||
<!-- Add additional rows for arb events here: -->
|
||||
<div id="custompie"></div>
|
||||
|
||||
|
||||
<div class="row" id="resultsMapContainer">
|
||||
<div class="col-md-6">
|
||||
<p style="text-align:center;">Targets Map</p>
|
||||
|
|
Loading…
Reference in New Issue