Documentation ¶
Overview ¶
Package controllers is responsible for setting up the routing and controllers (http.Handlers) for gophish.
Index ¶
- Constants
- Variables
- func Flash(w http.ResponseWriter, r *http.Request, t string, m string)
- type AdminServer
- func (as *AdminServer) Base(w http.ResponseWriter, r *http.Request)
- func (as *AdminServer) CampaignID(w http.ResponseWriter, r *http.Request)
- func (as *AdminServer) Campaigns(w http.ResponseWriter, r *http.Request)
- func (as *AdminServer) Groups(w http.ResponseWriter, r *http.Request)
- func (as *AdminServer) LandingPages(w http.ResponseWriter, r *http.Request)
- func (as *AdminServer) Login(w http.ResponseWriter, r *http.Request)
- func (as *AdminServer) Logout(w http.ResponseWriter, r *http.Request)
- func (as *AdminServer) SendingProfiles(w http.ResponseWriter, r *http.Request)
- func (as *AdminServer) Settings(w http.ResponseWriter, r *http.Request)
- func (as *AdminServer) Shutdown() error
- func (as *AdminServer) Start() error
- func (as *AdminServer) Templates(w http.ResponseWriter, r *http.Request)
- func (as *AdminServer) UserManagement(w http.ResponseWriter, r *http.Request)
- type AdminServerOption
- type PhishingServer
- func (ps *PhishingServer) PhishHandler(w http.ResponseWriter, r *http.Request)
- func (ps *PhishingServer) ReportHandler(w http.ResponseWriter, r *http.Request)
- func (ps *PhishingServer) RobotsHandler(w http.ResponseWriter, r *http.Request)
- func (ps *PhishingServer) Shutdown() error
- func (ps *PhishingServer) Start() error
- func (ps *PhishingServer) TrackHandler(w http.ResponseWriter, r *http.Request)
- func (ps *PhishingServer) TransparencyHandler(w http.ResponseWriter, r *http.Request)
- type PhishingServerOption
- type TransparencyResponse
Constants ¶
const TransparencySuffix = "+"
TransparencySuffix (when appended to a valid result ID), will cause Gophish to return a transparency response.
Variables ¶
var ErrCampaignComplete = errors.New("Event received on completed campaign")
ErrCampaignComplete is thrown when an event is received for a campaign that has already been marked as complete.
var ErrInvalidRequest = errors.New("Invalid request")
ErrInvalidRequest is thrown when a request with an invalid structure is received
Functions ¶
Types ¶
type AdminServer ¶ added in v0.8.0
type AdminServer struct {
// contains filtered or unexported fields
}
AdminServer is an HTTP server that implements the administrative Gophish handlers, including the dashboard and REST API.
func NewAdminServer ¶ added in v0.8.0
func NewAdminServer(config config.AdminServer, options ...AdminServerOption) *AdminServer
NewAdminServer returns a new instance of the AdminServer with the provided config and options applied.
func (*AdminServer) Base ¶ added in v0.8.0
func (as *AdminServer) Base(w http.ResponseWriter, r *http.Request)
Base handles the default path and template execution
func (*AdminServer) CampaignID ¶ added in v0.8.0
func (as *AdminServer) CampaignID(w http.ResponseWriter, r *http.Request)
CampaignID handles the default path and template execution
func (*AdminServer) Campaigns ¶ added in v0.8.0
func (as *AdminServer) Campaigns(w http.ResponseWriter, r *http.Request)
Campaigns handles the default path and template execution
func (*AdminServer) Groups ¶ added in v0.8.0
func (as *AdminServer) Groups(w http.ResponseWriter, r *http.Request)
Groups handles the default path and template execution
func (*AdminServer) LandingPages ¶ added in v0.8.0
func (as *AdminServer) LandingPages(w http.ResponseWriter, r *http.Request)
LandingPages handles the default path and template execution
func (*AdminServer) Login ¶ added in v0.8.0
func (as *AdminServer) Login(w http.ResponseWriter, r *http.Request)
Login handles the authentication flow for a user. If credentials are valid, a session is created
func (*AdminServer) Logout ¶ added in v0.8.0
func (as *AdminServer) Logout(w http.ResponseWriter, r *http.Request)
Logout destroys the current user session
func (*AdminServer) SendingProfiles ¶ added in v0.8.0
func (as *AdminServer) SendingProfiles(w http.ResponseWriter, r *http.Request)
SendingProfiles handles the default path and template execution
func (*AdminServer) Settings ¶ added in v0.8.0
func (as *AdminServer) Settings(w http.ResponseWriter, r *http.Request)
Settings handles the changing of settings
func (*AdminServer) Shutdown ¶ added in v0.8.0
func (as *AdminServer) Shutdown() error
Shutdown attempts to gracefully shutdown the server.
func (*AdminServer) Start ¶ added in v0.8.0
func (as *AdminServer) Start() error
Start launches the admin server, listening on the configured address.
func (*AdminServer) Templates ¶ added in v0.8.0
func (as *AdminServer) Templates(w http.ResponseWriter, r *http.Request)
Templates handles the default path and template execution
func (*AdminServer) UserManagement ¶ added in v0.8.0
func (as *AdminServer) UserManagement(w http.ResponseWriter, r *http.Request)
UserManagement is an admin-only handler that allows for the registration and management of user accounts within Gophish.
type AdminServerOption ¶ added in v0.8.0
type AdminServerOption func(*AdminServer)
AdminServerOption is a functional option that is used to configure the admin server
func WithWorker ¶ added in v0.8.0
func WithWorker(w worker.Worker) AdminServerOption
WithWorker is an option that sets the background worker.
type PhishingServer ¶ added in v0.8.0
type PhishingServer struct {
// contains filtered or unexported fields
}
PhishingServer is an HTTP server that implements the campaign event handlers, such as email open tracking, click tracking, and more.
func NewPhishingServer ¶ added in v0.8.0
func NewPhishingServer(config config.PhishServer, options ...PhishingServerOption) *PhishingServer
NewPhishingServer returns a new instance of the phishing server with provided options applied.
func (*PhishingServer) PhishHandler ¶ added in v0.8.0
func (ps *PhishingServer) PhishHandler(w http.ResponseWriter, r *http.Request)
PhishHandler handles incoming client connections and registers the associated actions performed (such as clicked link, etc.)
func (*PhishingServer) ReportHandler ¶ added in v0.8.0
func (ps *PhishingServer) ReportHandler(w http.ResponseWriter, r *http.Request)
ReportHandler tracks emails as they are reported, updating the status for the given Result
func (*PhishingServer) RobotsHandler ¶ added in v0.8.0
func (ps *PhishingServer) RobotsHandler(w http.ResponseWriter, r *http.Request)
RobotsHandler prevents search engines, etc. from indexing phishing materials
func (*PhishingServer) Shutdown ¶ added in v0.8.0
func (ps *PhishingServer) Shutdown() error
Shutdown attempts to gracefully shutdown the server.
func (*PhishingServer) Start ¶ added in v0.8.0
func (ps *PhishingServer) Start() error
Start launches the phishing server, listening on the configured address.
func (*PhishingServer) TrackHandler ¶ added in v0.8.0
func (ps *PhishingServer) TrackHandler(w http.ResponseWriter, r *http.Request)
TrackHandler tracks emails as they are opened, updating the status for the given Result
func (*PhishingServer) TransparencyHandler ¶ added in v0.8.0
func (ps *PhishingServer) TransparencyHandler(w http.ResponseWriter, r *http.Request)
TransparencyHandler returns a TransparencyResponse for the provided result and campaign.
type PhishingServerOption ¶ added in v0.8.0
type PhishingServerOption func(*PhishingServer)
PhishingServerOption is a functional option that is used to configure the the phishing server
func WithContactAddress ¶ added in v0.8.0
func WithContactAddress(addr string) PhishingServerOption
WithContactAddress sets the contact address used by the transparency handlers
type TransparencyResponse ¶ added in v0.7.0
type TransparencyResponse struct { Server string `json:"server"` ContactAddress string `json:"contact_address"` SendDate time.Time `json:"send_date"` }
TransparencyResponse is the JSON response provided when a third-party makes a request to the transparency handler.