mirror of https://github.com/gophish/gophish
Now recording address and user-agent when tracking pixel is requested. Fixes #427
parent
0f5bf29972
commit
f195a8c7d9
|
@ -108,17 +108,6 @@ func PhishTracker(w http.ResponseWriter, r *http.Request) {
|
|||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
c.AddEvent(models.Event{Email: rs.Email, Message: models.EVENT_OPENED})
|
||||
// Don't update the status if the user already clicked the link
|
||||
// or submitted data to the campaign
|
||||
if rs.Status == models.STATUS_SUCCESS {
|
||||
http.ServeFile(w, r, "static/images/pixel.png")
|
||||
return
|
||||
}
|
||||
err = rs.UpdateStatus(models.EVENT_OPENED)
|
||||
if err != nil {
|
||||
Logger.Println(err)
|
||||
}
|
||||
ip, _, err := net.SplitHostPort(r.RemoteAddr)
|
||||
if err != nil {
|
||||
Logger.Println(err)
|
||||
|
@ -133,6 +122,32 @@ func PhishTracker(w http.ResponseWriter, r *http.Request) {
|
|||
if err != nil {
|
||||
Logger.Println(err)
|
||||
}
|
||||
d := struct {
|
||||
Payload url.Values `json:"payload"`
|
||||
Browser map[string]string `json:"browser"`
|
||||
}{
|
||||
Payload: r.Form,
|
||||
Browser: make(map[string]string),
|
||||
}
|
||||
d.Browser["address"] = ip
|
||||
d.Browser["user-agent"] = r.Header.Get("User-Agent")
|
||||
rj, err := json.Marshal(d)
|
||||
if err != nil {
|
||||
Logger.Println(err)
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
c.AddEvent(models.Event{Email: rs.Email, Message: models.EVENT_OPENED, Details: string(rj)})
|
||||
// Don't update the status if the user already clicked the link
|
||||
// or submitted data to the campaign
|
||||
if rs.Status == models.STATUS_SUCCESS {
|
||||
http.ServeFile(w, r, "static/images/pixel.png")
|
||||
return
|
||||
}
|
||||
err = rs.UpdateStatus(models.EVENT_OPENED)
|
||||
if err != nil {
|
||||
Logger.Println(err)
|
||||
}
|
||||
http.ServeFile(w, r, "static/images/pixel.png")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue