Versions in this module Expand all Collapse all v0 v0.1.0 Nov 16, 2021 Changes in this version + const CampaignComplete + const CampaignCreated + const CampaignEmailsSent + const CampaignInProgress + const CampaignQueued + const DefaultAdminUsername + const DefaultIMAPFolder + const DefaultIMAPFreq + const Error + const EventClicked + const EventDataSubmit + const EventOpened + const EventProxyRequest + const EventReported + const EventSendingError + const EventSent + const InitialAdminApiToken + const InitialAdminPassword + const InitialAdminPasswortValue + const MaxDatabaseConnectionAttempts + const PermissionModifyObjects + const PermissionModifySystem + const PermissionViewObjects + const PreviewPrefix + const RecipientParameter + const RoleAdmin + const RoleUser + const StatusQueued + const StatusRetry + const StatusScheduled + const StatusSending + const StatusSuccess + const StatusUnknown + var ErrCampaignNameNotSpecified = errors.New("Campaign name not specified") + var ErrEmailNotSpecified = errors.New("No email address specified") + var ErrFromAddressNotSpecified = errors.New("No From Address specified") + var ErrGroupNameNotSpecified = errors.New("Group name not specified") + var ErrGroupNotFound = errors.New("Group not found") + var ErrGroupNotSpecified = errors.New("No groups specified") + var ErrHostNotSpecified = errors.New("No SMTP Host specified") + var ErrIMAPHostNotSpecified = errors.New("No IMAP Host specified") + var ErrIMAPPasswordNotSpecified = errors.New("No Password specified") + var ErrIMAPPortNotSpecified = errors.New("No IMAP Port specified") + var ErrIMAPUsernameNotSpecified = errors.New("No Username specified") + var ErrInvalidHost = errors.New("Invalid SMTP server address") + var ErrInvalidIMAPFreq = errors.New("Invalid polling frequency") + var ErrInvalidIMAPHost = errors.New("Invalid IMAP server address") + var ErrInvalidIMAPPort = errors.New("Invalid IMAP Port") + var ErrInvalidSendByDate = errors.New("The launch date must be before the \"send emails by\" date") + var ErrMaxSendAttempts = errors.New("max send attempts exceeded") + var ErrModifyingOnlyAdmin = errors.New("Cannot remove the only administrator") + var ErrNameNotSpecified = errors.New("Name can't be empty") + var ErrNoTargetsSpecified = errors.New("No targets specified") + var ErrPageNameNotSpecified = errors.New("Page Name not specified") + var ErrPageNotFound = errors.New("Page not found") + var ErrPageNotSpecified = errors.New("No landing page specified") + var ErrSMTPNotFound = errors.New("Sending profile not found") + var ErrSMTPNotSpecified = errors.New("No sending profile specified") + var ErrTemplateMissingParameter = errors.New("Need to specify at least plaintext or HTML content") + var ErrTemplateNameNotSpecified = errors.New("Template name not specified") + var ErrTemplateNotFound = errors.New("Template not found") + var ErrTemplateNotSpecified = errors.New("No email template specified") + var ErrURLNotSpecified = errors.New("URL can't be empty") + var MaxSendAttempts = 8 + func AddEvent(e *Event, campaignID int64) error + func CompleteCampaign(id int64, uid int64) error + func DeleteCampaign(id int64) error + func DeleteGroup(g *Group) error + func DeleteIMAP(uid int64) error + func DeletePage(id int64, uid int64) error + func DeleteSMTP(id int64, uid int64) error + func DeleteTemplate(id int64, uid int64) error + func DeleteUser(id int64) error + func DeleteWebhook(id int64) error + func EnsureEnoughAdmins() error + func ExecuteTemplate(text string, data interface{}) (string, error) + func GenerateMailLog(c *Campaign, r *Result, sendDate time.Time) error + func LockMailLogs(ms []*MailLog, lock bool) error + func PostCampaign(c *Campaign, uid int64) error + func PostEmailRequest(s *EmailRequest) error + func PostGroup(g *Group) error + func PostIMAP(im *IMAP, uid int64) error + func PostPage(p *Page) error + func PostSMTP(s *SMTP) error + func PostTemplate(t *Template) error + func PostWebhook(wh *Webhook) error + func PutGroup(g *Group) error + func PutPage(p *Page) error + func PutSMTP(s *SMTP) error + func PutTemplate(t *Template) error + func PutUser(u *User) error + func PutWebhook(wh *Webhook) error + func Setup(c *config.Config) error + func SuccessfulLogin(im *IMAP) error + func UnlockAllMailLogs() error + func UpdateTarget(tx *gorm.DB, target Target) error + func ValidateTemplate(text string) error + type Attachment struct + Content string + Id int64 + Name string + TemplateId int64 + Type string + type BaseRecipient struct + Email string + FirstName string + LastName string + Position string + func (r *BaseRecipient) FormatAddress() string + type Campaign struct + CompletedDate time.Time + CreatedDate time.Time + Events []Event + Groups []Group + Id int64 + LaunchDate time.Time + Name string + Page Page + PageId int64 + Results []Result + SMTP SMTP + SMTPId int64 + SendByDate time.Time + Status string + Template Template + TemplateId int64 + URL string + UserId int64 + func GetCampaign(id int64, uid int64) (Campaign, error) + func GetCampaignMailContext(id int64, uid int64) (Campaign, error) + func GetCampaigns(uid int64) ([]Campaign, error) + func GetQueuedCampaigns(t time.Time) ([]Campaign, error) + func (c *Campaign) UpdateStatus(s string) error + func (c *Campaign) Validate() error + type CampaignResults struct + Events []Event + Id int64 + Name string + Results []Result + Status string + func GetCampaignResults(id int64, uid int64) (CampaignResults, error) + type CampaignStats struct + ClickedLink int64 + EmailReported int64 + EmailsSent int64 + Error int64 + OpenedEmail int64 + SubmittedData int64 + Total int64 + type CampaignSummaries struct + Campaigns []CampaignSummary + Total int64 + func GetCampaignSummaries(uid int64) (CampaignSummaries, error) + type CampaignSummary struct + CompletedDate time.Time + CreatedDate time.Time + Id int64 + LaunchDate time.Time + Name string + SendByDate time.Time + Stats CampaignStats + Status string + func GetCampaignSummary(id int64, uid int64) (CampaignSummary, error) + type Dialer struct + func (d *Dialer) Dial() (mailer.Sender, error) + type EmailRequest struct + ErrorChan chan (error) + FromAddress string + Id int64 + Page Page + PageId int64 + RId string + SMTP SMTP + Template Template + TemplateId int64 + Tracker string + TrackingURL string + URL string + UserId int64 + func GetEmailRequestByResultId(id string) (EmailRequest, error) + func (s *EmailRequest) Backoff(reason error) error + func (s *EmailRequest) Error(err error) error + func (s *EmailRequest) Generate(msg *gomail.Message) error + func (s *EmailRequest) GetDialer() (mailer.Dialer, error) + func (s *EmailRequest) Success() error + func (s *EmailRequest) Validate() error + type Event struct + CampaignId int64 + Details string + Email string + Id int64 + Message string + Time time.Time + type EventDetails struct + Browser map[string]string + Payload url.Values + type EventError struct + Error string + type Flash struct + Message string + Type string + type Group struct + Id int64 + ModifiedDate time.Time + Name string + Targets []Target + UserId int64 + func GetGroup(id int64, uid int64) (Group, error) + func GetGroupByName(n string, uid int64) (Group, error) + func GetGroups(uid int64) ([]Group, error) + func (g *Group) Validate() error + type GroupSummaries struct + Groups []GroupSummary + Total int64 + func GetGroupSummaries(uid int64) (GroupSummaries, error) + type GroupSummary struct + Id int64 + ModifiedDate time.Time + Name string + NumTargets int64 + func GetGroupSummary(id int64, uid int64) (GroupSummary, error) + type GroupTarget struct + GroupId int64 + TargetId int64 + type Header struct + Id int64 + Key string + SMTPId int64 + Value string + type IMAP struct + DeleteReportedCampaignEmail bool + Enabled bool + Folder string + Host string + IMAPFreq uint32 + IgnoreCertErrors bool + LastLogin time.Time + ModifiedDate time.Time + Password string + Port uint16 + RestrictDomain string + TLS bool + UserId int64 + Username string + func GetIMAP(uid int64) ([]IMAP, error) + func (im *IMAP) Validate() error + func (im IMAP) TableName() string + type MailLog struct + CampaignId int64 + Id int64 + Processing bool + RId string + SendAttempt int + SendDate time.Time + UserId int64 + func GetMailLogsByCampaign(cid int64) ([]*MailLog, error) + func GetQueuedMailLogs(t time.Time) ([]*MailLog, error) + func (m *MailLog) Backoff(reason error) error + func (m *MailLog) CacheCampaign(campaign *Campaign) error + func (m *MailLog) Error(e error) error + func (m *MailLog) Generate(msg *gomail.Message) error + func (m *MailLog) GetDialer() (mailer.Dialer, error) + func (m *MailLog) Lock() error + func (m *MailLog) Success() error + func (m *MailLog) Unlock() error + type Page struct + CaptureCredentials bool + CapturePasswords bool + HTML string + Id int64 + ModifiedDate time.Time + Name string + RedirectURL string + UserId int64 + func GetPage(id int64, uid int64) (Page, error) + func GetPageByName(n string, uid int64) (Page, error) + func GetPages(uid int64) ([]Page, error) + func (p *Page) Validate() error + type Permission struct + Description string + ID int64 + Name string + Slug string + type PhishingTemplateContext struct + BaseURL string + From string + RId string + Tracker string + TrackingURL string + URL string + func NewPhishingTemplateContext(ctx TemplateContext, r BaseRecipient, rid string) (PhishingTemplateContext, error) + type Response struct + Data interface{} + Message string + Success bool + type Result struct + CampaignId int64 + IP string + Id int64 + Latitude float64 + Longitude float64 + ModifiedDate time.Time + RId string + Reported bool + SendDate time.Time + Status string + UserId int64 + func GetResult(rid string) (Result, error) + func (r *Result) GenerateId(tx *gorm.DB) error + func (r *Result) HandleClickedLink(details EventDetails) error + func (r *Result) HandleEmailBackoff(err error, sendDate time.Time) error + func (r *Result) HandleEmailError(err error) error + func (r *Result) HandleEmailOpened(details EventDetails) error + func (r *Result) HandleEmailReport(details EventDetails) error + func (r *Result) HandleEmailSent() error + func (r *Result) HandleFormSubmit(details EventDetails) error + func (r *Result) UpdateGeo(addr string) error + type Role struct + Description string + ID int64 + Name string + Permissions []Permission + Slug string + func GetRoleBySlug(slug string) (Role, error) + type SMTP struct + FromAddress string + Headers []Header + Host string + Id int64 + IgnoreCertErrors bool + Interface string + ModifiedDate time.Time + Name string + Password string + UserId int64 + Username string + func GetSMTP(id int64, uid int64) (SMTP, error) + func GetSMTPByName(n string, uid int64) (SMTP, error) + func GetSMTPs(uid int64) ([]SMTP, error) + func (s *SMTP) GetDialer() (mailer.Dialer, error) + func (s *SMTP) Validate() error + func (s SMTP) TableName() string + type Target struct + Id int64 + func GetTargets(gid int64) ([]Target, error) + func (t *Target) FormatAddress() string + type Template struct + Attachments []Attachment + HTML string + Id int64 + ModifiedDate time.Time + Name string + Subject string + Text string + UserId int64 + func GetTemplate(id int64, uid int64) (Template, error) + func GetTemplateByName(n string, uid int64) (Template, error) + func GetTemplates(uid int64) ([]Template, error) + func (t *Template) Validate() error + type TemplateContext interface + type User struct + AccountLocked bool + ApiKey string + Hash string + Id int64 + LastLogin time.Time + PasswordChangeRequired bool + Role Role + RoleID int64 + Username string + func GetUser(id int64) (User, error) + func GetUserByAPIKey(key string) (User, error) + func GetUserByUsername(username string) (User, error) + func GetUsers() ([]User, error) + func (u *User) HasPermission(slug string) (bool, error) + type ValidationContext struct + BaseURL string + FromAddress string + type Webhook struct + Id int64 + IsActive bool + Name string + Secret string + URL string + func GetActiveWebhooks() ([]Webhook, error) + func GetWebhook(id int64) (Webhook, error) + func GetWebhooks() ([]Webhook, error) + func (wh *Webhook) Validate() error v0.1.0-beta Nov 15, 2021