mirror of https://github.com/gophish/gophish
parent
8dcbfed3a3
commit
b574fb2741
|
@ -25,6 +25,7 @@ type Campaign struct {
|
|||
Groups []Group `json:"groups,omitempty"`
|
||||
Events []Event `json:"timeline,omitemtpy"`
|
||||
SMTP SMTP `json:"smtp"`
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
// ErrCampaignNameNotSpecified indicates there was no template given by the user
|
||||
|
|
|
@ -20,6 +20,7 @@ function save(){
|
|||
template:{
|
||||
name: $("#template").val()
|
||||
},
|
||||
url: $("#url").val(),
|
||||
smtp: {
|
||||
from_address: $("input[name=from]").val(),
|
||||
host: $("input[name=host]").val(),
|
||||
|
|
|
@ -19,6 +19,8 @@ function save(idx){
|
|||
template.name = $("#name").val()
|
||||
template.subject = $("#subject").val()
|
||||
template.html = CKEDITOR.instances["html_editor"].getData();
|
||||
// Fix the URL Scheme added by CKEditor (until we can remove it from the plugin)
|
||||
template.html = template.html.replace(/https?:\/\/{{\.URL}}/gi, "{{.URL}}")
|
||||
template.text = $("#text_editor").val()
|
||||
// Add the attachments
|
||||
$.each($("#attachmentsTable").DataTable().rows().data(), function(i, target){
|
||||
|
|
|
@ -144,4 +144,6 @@ var api = {
|
|||
// Register our moment.js datatables listeners
|
||||
$(document).ready(function(){
|
||||
$.fn.dataTable.moment('MMMM Do YYYY, h:mm:ss a');
|
||||
// Setup tooltips
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
});
|
||||
|
|
|
@ -68,11 +68,12 @@
|
|||
<div class="form-group">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" class="form-control" id="name" placeholder="Campaign name" autofocus>
|
||||
<br />
|
||||
<label class="control-label" for="template">Template:</label>
|
||||
<input type="text" class="typeahead form-control" placeholder="Template Name" id="template"/>
|
||||
<br>
|
||||
<br>
|
||||
<label class="control-label" for="url">URL: <i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right" title="Location of gophish listener (must be reachable by targets!)"></i></label>
|
||||
<input type="text" class="form-control" placeholder="http://192.168.1.1" id="url"/>
|
||||
<br/>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading" role="tab">
|
||||
<a role="button" class="collapsed" data-toggle="collapse" href="#smtpPanel" aria-expanded="false" aria-controls="#smtpPanel">
|
||||
|
|
|
@ -3,12 +3,11 @@ package worker
|
|||
import (
|
||||
"bytes"
|
||||
"log"
|
||||
"net"
|
||||
"net/mail"
|
||||
"net/smtp"
|
||||
"os"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/jordan-wright/email"
|
||||
"github.com/jordan-wright/gophish/models"
|
||||
|
@ -52,24 +51,27 @@ func processCampaign(c *models.Campaign) {
|
|||
if c.SMTP.Username != "" && c.SMTP.Password != "" {
|
||||
auth = smtp.PlainAuth("", c.SMTP.Username, c.SMTP.Password, strings.Split(c.SMTP.Host, ":")[0])
|
||||
}
|
||||
ips, err := net.InterfaceAddrs()
|
||||
f, err := mail.ParseAddress(c.SMTP.FromAddress)
|
||||
if err != nil {
|
||||
Logger.Println(err)
|
||||
}
|
||||
for _, i := range ips {
|
||||
Logger.Println(i.String())
|
||||
ft := f.Name
|
||||
if ft == "" {
|
||||
ft = f.Address
|
||||
}
|
||||
for _, t := range c.Results {
|
||||
td := struct {
|
||||
models.Result
|
||||
URL string
|
||||
Tracker string
|
||||
TrackingURL string
|
||||
Tracker string
|
||||
From string
|
||||
}{
|
||||
t,
|
||||
"http://" + ips[0].String() + "?rid=" + t.RId,
|
||||
"<img src='http://" + ips[0].String() + "/track?rid=" + t.RId + "'/>",
|
||||
"http://" + ips[0].String() + "/track?rid=" + t.RId,
|
||||
c.URL + "?rid=" + t.RId,
|
||||
c.URL + "/track?rid=" + t.RId,
|
||||
"<img src='" + c.URL + "/track?rid=" + t.RId + "'/>",
|
||||
ft,
|
||||
}
|
||||
// Parse the templates
|
||||
var subjBuff bytes.Buffer
|
||||
|
@ -118,6 +120,9 @@ func processCampaign(c *models.Campaign) {
|
|||
Logger.Println(err)
|
||||
}
|
||||
}
|
||||
time.Sleep(1)
|
||||
}
|
||||
err = c.UpdateStatus(models.CAMPAIGN_EMAILS_SENT)
|
||||
if err != nil {
|
||||
Logger.Println(err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue