This is the fullstack application for SecureMe, a phishing training simulator. It manages scenarios, generate emails, simulate phishing calls, and batch send training emails.
- Features
- Requirements
- Installation
- Running the Server
- Project Structure
- CORS & Frontend Integration
- Environment Variables
- Getting Started with Full Stack
- Troubleshooting
- 📞 Simulate phishing phone calls for training purposes
- 📧 Generate phishing-style emails for employees
- 📨 Batch email sending using Postmark API
- 🎭 Scenario management via REST endpoints
- 🔊 Static file hosting for audio prompts
- 📊 Track and log phishing simulation results
- 🎯 Realistic SSO landing page for credential capture
- Python 3.11+
- FastAPI
- Uvicorn
- Postmark API (for sending emails)
- Twilio (for call simulations)
- ngrok (for public URL tunneling)
- Other dependencies listed in
requirements.txt
git clone https://github.com/your-username/Hackathon_NCSU.git
cd Hackathon_NCSU/backendpython -m venv venvWindows:
venv\Scripts\activatemacOS/Linux:
source venv/bin/activatepip install -r requirements.txtIf requirements.txt doesn't exist, install manually:
pip install fastapi uvicorn python-dotenv postmarker twilio pydanticCreate a .env file in the backend directory:
# Postmark (Email Service)
POSTMARK_API_KEY=your_postmark_server_token
# Twilio (Phone Service)
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=+1234567890
# Application
BASE_URL=https://your-ngrok-url.ngrok-free.dev
# Optional
PORT=8000python main.pybackend/
├── app/
│ ├── routers/
│ │ ├── EmailAutomationRouter.py # Email campaign logic
│ │ ├── twilio_router.py # Phone call handling
│ │ ├── scenarios_router.py # Scenario management
│ │ ├── generateEmail.py # Email generation
│ │ └── LandingPage.html # Phishing landing page
│ ├── config.py # Configuration management
│ └── main.py # FastAPI application
├── static/
│ └── audio/ # Audio files for calls
├── campaign_results.csv # Event logs
├── .env # Environment variables (not in git)
├── requirements.txt # Python dependencies
└── README.md # This file
CORS is configured to allow all origins for development. For production, specify allowed origins:
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:5173", "http://localhost:3000"], # Frontend URLs
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)Frontend Integration:
- React frontend should be running on
http://localhost:5173 - Update
BASE_URLin.envwith your ngrok URL for email links - Ensure CORS origins match your frontend URL
| Variable | Description | Required |
|---|---|---|
POSTMARK_API_KEY |
Postmark server token for sending emails | Yes |
TWILIO_ACCOUNT_SID |
Twilio account identifier | Yes |
TWILIO_AUTH_TOKEN |
Twilio authentication token | Yes |
TWILIO_PHONE_NUMBER |
Your Twilio phone number | Yes |
BASE_URL |
Public URL for webhooks (ngrok) | Yes |
PORT |
Server port (default: 8000) | No |
ngrok http 8000Copy the ngrok URL (e.g., https://abc123.ngrok-free.dev) and update BASE_URL in .env
cd backend
python main.pycd frontend
npm install
npm run dev- Go to Postmark dashboard
- Add webhook URL:
https://your-ngrok-url.ngrok-free.dev/webhooks/postmark - Enable "Click" tracking
- Navigate to
http://localhost:5173 - Select people from the People page
- Click "Batch" to send phishing emails
- Monitor
campaign_results.csvfor results
Problem: ModuleNotFoundError: No module named 'fastapi'
Solution: Install dependencies: pip install -r requirements.txt
Problem: Port 8000 already in use
Solution: Change port in main.py or kill the process using port 8000
Problem: Postmark returns 401 Unauthorized
Solution: Verify POSTMARK_API_KEY in .env is correct
Problem: Sender email not verified
Solution: Verify sender email in Postmark dashboard
Problem: 404 error on /verify
Solution: Ensure LandingPage.html is in backend/app/routers/
Problem: ngrok URL not working
Solution: Update BASE_URL in .env with current ngrok URL
Problem: Frontend can't reach backend
Solution: Verify frontend URL is in allow_origins in main.py
Problem: Endpoint not found
Solution: Ensure EmailAutomationRouter.router is included in main.py
pytestblack app/flake8 app/- ✅ Only use with explicit permission from organization
- ✅ Clearly debrief participants after training
- ✅ Store credentials securely (never log passwords in production)
- ✅ Use unique UIDs to track participants anonymously
- ✅ Delete sensitive data after training sessions
Never use this tool for:
- ❌ Actual phishing attacks
- ❌ Unauthorized social engineering
- ❌ Malicious credential harvesting
This project is for educational purposes only. Use responsibly and ethically.
Built for NCSU Hackathon 2025 🎓