controllers

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2018 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package controllers is responsible for setting up the routing and controllers (http.Handlers) for gophish.

Index

Constants

View Source
const TransparencySuffix = "+"

TransparencySuffix (when appended to a valid result ID), will cause Gophish to return a transparency response.

Variables

View Source
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.

View Source
var ErrInvalidRequest = errors.New("Invalid request")

ErrInvalidRequest is thrown when a request with an invalid structure is received

View Source
var Worker *worker.Worker

Worker is the worker that processes phishing events and updates campaigns.

Functions

func API

func API(w http.ResponseWriter, r *http.Request)

API (/api) provides access to api documentation

func API_Campaign_Id_Summary added in v0.3.0

func API_Campaign_Id_Summary(w http.ResponseWriter, r *http.Request)

API_Campaigns_Id_Summary returns just the summary for a given campaign.

func API_Campaigns

func API_Campaigns(w http.ResponseWriter, r *http.Request)

API_Campaigns returns a list of campaigns if requested via GET. If requested via POST, API_Campaigns creates a new campaign and returns a reference to it.

func API_Campaigns_Id

func API_Campaigns_Id(w http.ResponseWriter, r *http.Request)

API_Campaigns_Id returns details about the requested campaign. If the campaign is not valid, API_Campaigns_Id returns null.

func API_Campaigns_Id_Complete added in v0.2.0

func API_Campaigns_Id_Complete(w http.ResponseWriter, r *http.Request)

API_Campaigns_Id_Complete effectively "ends" a campaign. Future phishing emails clicked will return a simple "404" page.

func API_Campaigns_Id_Results added in v0.2.0

func API_Campaigns_Id_Results(w http.ResponseWriter, r *http.Request)

API_Campaigns_Id_Results returns just the results for a given campaign to significantly reduce the information returned.

func API_Campaigns_Summary added in v0.3.0

func API_Campaigns_Summary(w http.ResponseWriter, r *http.Request)

API_Campaigns_Summary returns the summary for the current user's campaigns

func API_Groups

func API_Groups(w http.ResponseWriter, r *http.Request)

API_Groups returns a list of groups if requested via GET. If requested via POST, API_Groups creates a new group and returns a reference to it.

func API_Groups_Id

func API_Groups_Id(w http.ResponseWriter, r *http.Request)

API_Groups_Id returns details about the requested group. If the group is not valid, API_Groups_Id returns null.

func API_Groups_Id_Summary added in v0.3.0

func API_Groups_Id_Summary(w http.ResponseWriter, r *http.Request)

API_Groups_Id_Summary returns a summary of the groups owned by the current user.

func API_Groups_Summary added in v0.3.0

func API_Groups_Summary(w http.ResponseWriter, r *http.Request)

API_Groups_Summary returns a summary of the groups owned by the current user.

func API_Import_Email

func API_Import_Email(w http.ResponseWriter, r *http.Request)

API_Import_Email allows for the importing of email. Returns a Message object

func API_Import_Group

func API_Import_Group(w http.ResponseWriter, r *http.Request)

API_Import_Group imports a CSV of group members

func API_Import_Site

func API_Import_Site(w http.ResponseWriter, r *http.Request)

API_Import_Site allows for the importing of HTML from a website Without "include_resources" set, it will merely place a "base" tag so that all resources can be loaded relative to the given URL.

func API_Pages

func API_Pages(w http.ResponseWriter, r *http.Request)

API_Pages handles requests for the /api/pages/ endpoint

func API_Pages_Id

func API_Pages_Id(w http.ResponseWriter, r *http.Request)

API_Pages_Id contains functions to handle the GET'ing, DELETE'ing, and PUT'ing of a Page object

func API_Reset

func API_Reset(w http.ResponseWriter, r *http.Request)

API (/api/reset) resets a user's API key

func API_SMTP added in v0.1.2

func API_SMTP(w http.ResponseWriter, r *http.Request)

API_SMTP handles requests for the /api/smtp/ endpoint

func API_SMTP_Id added in v0.1.2

func API_SMTP_Id(w http.ResponseWriter, r *http.Request)

API_SMTP_Id contains functions to handle the GET'ing, DELETE'ing, and PUT'ing of a SMTP object

func API_Send_Test_Email

func API_Send_Test_Email(w http.ResponseWriter, r *http.Request)

API_Send_Test_Email sends a test email using the template name and Target given.

func API_Templates

func API_Templates(w http.ResponseWriter, r *http.Request)

API_Templates handles the functionality for the /api/templates endpoint

func API_Templates_Id

func API_Templates_Id(w http.ResponseWriter, r *http.Request)

API_Templates_Id handles the functions for the /api/templates/:id endpoint

func Base

func Base(w http.ResponseWriter, r *http.Request)

Base handles the default path and template execution

func CampaignID

func CampaignID(w http.ResponseWriter, r *http.Request)

CampaignID handles the default path and template execution

func Campaigns

func Campaigns(w http.ResponseWriter, r *http.Request)

Campaigns handles the default path and template execution

func Clone

func Clone(w http.ResponseWriter, r *http.Request)

Clone takes a URL as a POST parameter and returns the site HTML

func CreateAdminRouter

func CreateAdminRouter() http.Handler

CreateAdminRouter creates the routes for handling requests to the web interface. This function returns an http.Handler to be used in http.ListenAndServe().

func CreatePhishingRouter

func CreatePhishingRouter() http.Handler

CreatePhishingRouter creates the router that handles phishing connections.

func Flash

func Flash(w http.ResponseWriter, r *http.Request, t string, m string)

Flash handles the rendering flash messages

func JSONResponse

func JSONResponse(w http.ResponseWriter, d interface{}, c int)

JSONResponse attempts to set the status code, c, and marshal the given interface, d, into a response that is written to the given ResponseWriter.

func LandingPages

func LandingPages(w http.ResponseWriter, r *http.Request)

LandingPages handles the default path and template execution

func Login

func Login(w http.ResponseWriter, r *http.Request)

Login handles the authentication flow for a user. If credentials are valid, a session is created

func Logout

func Logout(w http.ResponseWriter, r *http.Request)

Logout destroys the current user session

func PhishHandler

func PhishHandler(w http.ResponseWriter, r *http.Request)

PhishHandler handles incoming client connections and registers the associated actions performed (such as clicked link, etc.)

func PhishReporter added in v0.6.0

func PhishReporter(w http.ResponseWriter, r *http.Request)

PhishReporter tracks emails as they are reported, updating the status for the given Result

func PhishTracker

func PhishTracker(w http.ResponseWriter, r *http.Request)

PhishTracker tracks emails as they are opened, updating the status for the given Result

func Preview

func Preview(w http.ResponseWriter, r *http.Request)

Preview allows for the viewing of page html in a separate browser window

func Register

func Register(w http.ResponseWriter, r *http.Request)

Register creates a new user

func RobotsHandler added in v0.4.0

func RobotsHandler(w http.ResponseWriter, r *http.Request)

RobotsHandler prevents search engines, etc. from indexing phishing materials

func SendingProfiles added in v0.1.2

func SendingProfiles(w http.ResponseWriter, r *http.Request)

SendingProfiles handles the default path and template execution

func Settings

func Settings(w http.ResponseWriter, r *http.Request)

Settings handles the changing of settings

func Templates

func Templates(w http.ResponseWriter, r *http.Request)

Templates handles the default path and template execution

func TransparencyHandler added in v0.7.0

func TransparencyHandler(w http.ResponseWriter, r *http.Request)

TransparencyHandler returns a TransparencyResponse for the provided result and campaign.

func Use

func Use(handler http.HandlerFunc, mid ...func(http.Handler) http.HandlerFunc) http.HandlerFunc

Use allows us to stack middleware to process the request Example taken from https://github.com/gorilla/mux/pull/36#issuecomment-25849172

func Users

func Users(w http.ResponseWriter, r *http.Request)

Users handles the default path and template execution

Types

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.

type UnindexedFileSystem added in v0.7.0

type UnindexedFileSystem struct {
	// contains filtered or unexported fields
}

UnindexedFileSystem is an implementation of a standard http.FileSystem without the ability to list files in the directory. This implementation is largely inspired by https://www.alexedwards.net/blog/disable-http-fileserver-directory-listings

func (UnindexedFileSystem) Open added in v0.7.0

func (ufs UnindexedFileSystem) Open(name string) (http.File, error)

Open returns a file from the static directory. If the requested path ends with a slash, there is a check for an index.html file. If none exists, then an error is returned.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL