When to Use
- When conducting security assessments that involve performing red team phishing with gophish
- When following incident response procedures for related security events
- When performing scheduled security testing or auditing activities
- When validating security controls through hands-on testing
Prerequisites
- Familiarity with security operations concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Instructions
- Install dependencies:
pip install gophish requests
- Deploy GoPhish server and obtain an API key from Settings.
- Use the Python gophish library to automate campaign setup:
- Create email templates with HTML body and tracking
- Configure SMTP sending profiles
- Import target groups from CSV
- Create landing pages for credential capture
- Launch and monitor campaigns
- Analyze campaign results: opens, clicks, submitted data, reported.
# For authorized penetration testing and lab environments only
python scripts/agent.py --gophish-url https://localhost:3333 --api-key <key> --campaign-name "Q1 Awareness" --output phishing_report.json
Examples
Create Campaign via API
from gophish import Gophish
from gophish.models import Campaign, Template, Group, SMTP, Page
api = Gophish("api_key", host="https://localhost:3333", verify=False) # Self-signed cert on localhost lab
campaign = Campaign(name="Q1 Test", groups=[Group(name="Sales Team")],
template=Template(name="IT Password Reset"), smtp=SMTP(name="Internal SMTP"),
page=Page(name="Credential Page"))
api.campaigns.post(campaign)
1---2name: performing-red-team-phishing-with-gophish3description: "Automates GoPhish phishing simulations using Python gophish. Signals: phishing, social engineering, phishing email."4zh-signals: "Automates GoPhish phishing simulation campaigns using the Python gophish 信号:钓鱼,社会工程,钓鱼邮件。"5when-to-use: Automates GoPhish phishing simulation campaigns using the Python gophish6 library, creating email templates with tracking pixels, configuring SMTP sending7 profiles, building target groups from CSV, launching campaigns, and analyzing results8 such as open rates, click rates, and credential submission statistics. Use when9 running an authorized phishing simulation or security awareness assessment via GoPhish.10domain: cybersecurity11subdomain: security-operations12tags:13- red-teaming14- phishing-simulation15- gophish16- social-engineering17- campaign-automation18- security-awareness19version: '1.0'20author: mahipal21license: Apache-2.022nist_csf:23- DE.CM-0124- RS.MA-0125- GV.OV-0126- DE.AE-0227mitre_attack:28- T107829- T119030- T105931- T100332- T111033mitre_f3:34 version: '1.1'35 tactics:36 - resource-development37 - reconnaissance38 - initial-access39 techniques:40 - id: T159841 name: Phishing for Information42 tactic: reconnaissance43 source: attack44 - id: T166045 name: Phishing46 tactic: initial-access47 source: attack48 - id: F1020.00249 name: 'Create Fake Materials: Fake Website'50 tactic: resource-development51 source: f352 - id: T1583.00153 name: 'Acquire Infrastructure: Domains'54 tactic: resource-development55 source: attack56 - id: F1006.00257 name: 'Account Takeover: Exposed Login Credential'58 tactic: initial-access59 source: f360metadata:61 source: https://skillmd.com/skills/dangeroussong/performing-red-team-phishing-with-gophish62---636465## When to Use6667- When conducting security assessments that involve performing red team phishing with gophish68- When following incident response procedures for related security events69- When performing scheduled security testing or auditing activities70- When validating security controls through hands-on testing7172## Prerequisites7374- Familiarity with security operations concepts and tools75- Access to a test or lab environment for safe execution76- Python 3.8+ with required dependencies installed77- Appropriate authorization for any testing activities7879## Instructions80811. Install dependencies: `pip install gophish requests`822. Deploy GoPhish server and obtain an API key from Settings.833. Use the Python gophish library to automate campaign setup:84 - Create email templates with HTML body and tracking85 - Configure SMTP sending profiles86 - Import target groups from CSV87 - Create landing pages for credential capture88 - Launch and monitor campaigns894. Analyze campaign results: opens, clicks, submitted data, reported.9091```bash92# For authorized penetration testing and lab environments only93python scripts/agent.py --gophish-url https://localhost:3333 --api-key <key> --campaign-name "Q1 Awareness" --output phishing_report.json94```9596## Examples9798### Create Campaign via API99```python100from gophish import Gophish101from gophish.models import Campaign, Template, Group, SMTP, Page102api = Gophish("api_key", host="https://localhost:3333", verify=False) # Self-signed cert on localhost lab103campaign = Campaign(name="Q1 Test", groups=[Group(name="Sales Team")],104 template=Template(name="IT Password Reset"), smtp=SMTP(name="Internal SMTP"),105 page=Page(name="Credential Page"))106api.campaigns.post(campaign)107```