mirror of https://github.com/gophish/gophish
Fixed issue whereby attached campaign emails weren't being decoded
parent
f5d3ca4968
commit
d0e7bcf2f3
|
@ -7,6 +7,7 @@ package imap
|
||||||
* - Add field to User for numner of non-campaign emails reported
|
* - Add field to User for numner of non-campaign emails reported
|
||||||
*/
|
*/
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -216,7 +217,15 @@ func checkRIDs(em *email.Email) (map[string]int, error) {
|
||||||
//Next check each attachment
|
//Next check each attachment
|
||||||
for _, a := range em.Attachments {
|
for _, a := range em.Attachments {
|
||||||
if a.Header.Get("Content-Type") == "message/rfc822" {
|
if a.Header.Get("Content-Type") == "message/rfc822" {
|
||||||
for _, r := range goPhishRegex.FindAllStringSubmatch(string(a.Content), -1) {
|
|
||||||
|
//Let's decode the email
|
||||||
|
rawBodyStream := bytes.NewReader(a.Content)
|
||||||
|
attachementemail, err := email.NewEmailFromReader(rawBodyStream)
|
||||||
|
if err != nil {
|
||||||
|
return rids, err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, r := range goPhishRegex.FindAllStringSubmatch(string(attachementemail.Text)+string(attachementemail.HTML), -1) {
|
||||||
newrid := r[len(r)-1]
|
newrid := r[len(r)-1]
|
||||||
if _, ok := rids[newrid]; ok {
|
if _, ok := rids[newrid]; ok {
|
||||||
rids[newrid]++
|
rids[newrid]++
|
||||||
|
|
Loading…
Reference in New Issue