Campaigns
The campaigns endpoint allows you to create, view, and manage Gophish campaigns.
Table of Contents
Quick Example
This example shows how to retrieve the names of every campaign launched in Gophish.
Models
gophish.models.Result
Attributes
id
(int) The result IDfirst_name
(str) The first namelast_name
(str) The last nameemail
(str) The email addressposition
(str) The position (job role)ip
(str) The last seen IP addresslatitude
(float) The latitude of theip
longitude
(float) The longitude of theip
status
(str) The users status in the campaign
Methods
__init__(self, **kwargs)
- Returns a new ResultExample:
gophish.models.Campaign
For each of the attributes in the campaign (groups, template, page, etc.), Gophish only cares about the name
.
This means that you don't have to fetch the resources you want to use. You can simply create new ones with the correct name for the campaign (see the example below).
Attributes
id
(int) The result IDresults
(list(models.Result)) The campaign resultstimeline
(list(models.TimelineEntry)) The timeline entriesname
(str) The campaign namestatus
(str) The current status of the campaigncreated_date
(optional: datetime.datetime) The campaign creation datesend_by_date
(optional: datetime.datetime) The date to send all emails bylaunch_date
(optional: datetime.datetime) The scheduled time for campaign launchtemplate
(models.Template) The template to use in the campaignpage
(models.Page) The Landing Page to use in the campaignsmtp
(models.SMTP) The SMTP Profile to use when sending emailsurl
(str) The URL to use when constructing links in phishing emails
Methods
__init__(self, **kwargs)
- Returns a new CampaignExample:
gophish.models.Stat
Statistics for a campaign's results.
The Gophish API never requires you to create campaign stats. Instead, they are returned as part of the campaign summary objects.
Attributes
total
(int) The total number of targets in the campaignsent
(int) The number of emails that were successfully sentopened
(int) The number of emails that were openedclicked
(int) The number of emails that were clicked by recipients in the campaignsubmitted_data
(int) The number of captured credentials from the campaignemail_reported
(int) The number of emails reported from the campaignerror
(int) The number of errors when sending emails in the campaign
gophish.models.CampaignSummary
A summarized view of a campaign. This is a lightweight high level view of campaign results, which can be quicker than retrieving full campaign details.
The Gophish API never requires you to create campaign summaries. Instead, they are returned when hitting the campaign summary endpoint.
Attributes
id
(int) The result IDname
(str) The campaign namecreated_date
(optional: datetime.datetime) The campaign creation datesend_by_date
(optional: datetime.datetime) The date to send all emails bylaunch_date
(optional: datetime.datetime) The scheduled time for campaign launchstatus
(str) The current status of the campaignstats
(list(models.Stat)) The stats of campaign results
Methods
__init__(self, **kwargs)
- Returns a new CampaignSummaryExample:
Methods
gophish.api.campaigns.get(campaign_id=None)
Gets the details for one or more campaigns. To get a particular campaign, set the ID to the campaign ID.
If the campaign_id
is not set, all campaigns owned by the current user will be returned.
Returns
If the
campaign_id
is set:models.Campaign
If
campaign_id
isNone
:list(models.Campaign)
gophish.api.campaigns.post(campaign)
Creates and launches a new campaign. This endpoint requires you to submit a gophish.models.Campaign
object.
Returns
The gophish.models.Campaign
object that was created.
gophish.api.campaigns.delete(campaign_id)
Deletes the campaign specified by campaign_id
.
Returns
A gophish.models.Status
message.
gophish.api.campaigns.complete(campaign_id)
Completes the campaign specified by campaign_id
.
Returns
A gophish.models.Status
message.
gophish.api.campaigns.summary(campaign_id=None)
Gets the summaries for one or more campaigns. To get a particular campaign, set the ID to the campaign ID.
If the campaign_id
is not set, the summary object for all campaigns owned by the current user will be returned.
Returns
If the
campaign_id
is set:models.CampaignSummary
If
campaign_id
isNone
:models.CampaignSummaries
Examples
Here are some examples to show how to use the API.
All of these examples assume the following setup:
Get All Campaigns
Get Single Campaign
Create New Campaign
Get Campaign Summaries
Last updated