A toolkit for generating safe cybersecurity payloads for ethical testing and research
Project description
๐ง PayloadForge
A toolkit for generating safe cybersecurity payloads for ethical testing and research
โ ๏ธ ETHICAL USE ONLY: This toolkit is designed exclusively for authorized security testing, educational purposes, and research. Never use against systems without explicit written permission.
๐ Overview
PayloadForge is a Python library and CLI tool designed for security professionals and students to generate proof-of-concept payloads for vulnerability testing. It emphasizes ethical use with built-in safety mechanisms.
Key Features
- ๐ฏ XSS Payloads - Basic, DOM-based, event handlers, polyglot
- ๐ SQL Injection - MySQL, MSSQL, PostgreSQL templates
- ๐ง SSTI Templates - Jinja2, Twig, Smarty, Velocity
- ๐ฅ๏ธ Command Injection - Linux & Windows payloads
- ๐ Encoding Utilities - URL, HTML, Unicode, Base64
- โจ Obfuscation - WAF bypass techniques
- ๐ง Interactive Wizard - Step-by-step payload building
๐ Installation
Via pip (Recommended)
pip install payloadforge
From Source
git clone https://github.com/payloadforge/payloadforge.git
cd payloadforge
pip install -e .
Development Installation
pip install -e ".[dev]"
๐ป CLI Usage
XSS Payloads
# Basic reflection XSS
payloadforge --xss basic
# DOM-based XSS
payloadforge --xss dom
# Event handler XSS
payloadforge --xss event
# Polyglot (works in multiple contexts)
payloadforge --xss polyglot
# All XSS types
payloadforge --xss all
SQL Injection
# Error-based MySQL
payloadforge --sqli error mysql
# Time-based blind MSSQL
payloadforge --sqli time mssql
# Union-based PostgreSQL
payloadforge --sqli union postgres
# Boolean-based blind
payloadforge --sqli boolean mysql
SSTI (Server-Side Template Injection)
# Jinja2 (Python)
payloadforge --ssti jinja2
# Twig (PHP)
payloadforge --ssti twig
# Smarty (PHP)
payloadforge --ssti smarty
# Velocity (Java)
payloadforge --ssti velocity
Command Injection
# Linux commands
payloadforge --cmd linux
# Windows commands
payloadforge --cmd windows
# With encoding
payloadforge --cmd linux --encode=url
payloadforge --cmd windows --encode=base64
Encoding Utilities
# URL encoding
payloadforge encode --url "<script>alert()</script>"
# HTML entity encoding
payloadforge encode --html "<img src=x>"
# Base64 encoding
payloadforge encode --base64 "whoami"
# Unicode escape
payloadforge encode --unicode "alert"
# Decoding
payloadforge encode --url --decode "%3Cscript%3E"
Interactive Wizard
# Start interactive wizard
payloadforge wizard
# Wizard for specific type
payloadforge wizard --type xss
payloadforge wizard --type sqli
Additional Options
# Limit number of payloads
payloadforge --xss basic --count 5
# Enable action logging
payloadforge --xss basic --log
# Show all categories
payloadforge list-all
# Show disclaimer
payloadforge --disclaimer
๐ Library Usage
XSS Generator
from payloadforge.generators.xss import XSSGenerator
# Generate basic XSS payloads
payloads = XSSGenerator.generate_basic()
for payload in payloads:
print(payload)
# Generate with encoding
encoded = XSSGenerator.with_encoding(payloads, "url")
# Generate all types
all_payloads = XSSGenerator.generate_all()
SQL Injection Generator
from payloadforge.generators.sqli import SQLiGenerator
# Error-based MySQL
payloads = SQLiGenerator.generate_error_based("mysql")
# Time-based blind
time_payloads = SQLiGenerator.generate_time_based("mssql")
# With obfuscation
obfuscated = SQLiGenerator.obfuscate(payloads, "case")
SSTI Generator
from payloadforge.generators.ssti import SSTIGenerator
# Jinja2 payloads
jinja2 = SSTIGenerator.generate_jinja2()
# Safe detection only
safe = SSTIGenerator.generate_jinja2(safe_only=True)
# All engines
all_ssti = SSTIGenerator.generate_all()
Command Injection Generator
from payloadforge.generators.cmdi import CMDiGenerator
# Linux payloads
linux = CMDiGenerator.generate_linux()
# Windows payloads
windows = CMDiGenerator.generate_windows()
# With encoding
encoded = CMDiGenerator.with_encoding(linux, "base64")
Encoding Utilities
from payloadforge.encoders import url, html, unicode, base64_enc
# URL encoding
encoded = url.encode("<script>alert()</script>")
decoded = url.decode(encoded)
# HTML entities
html_encoded = html.encode_hex("<script>")
# Unicode escape
unicode_escaped = unicode.encode_escape("alert")
# Base64 with command wrapper
linux_cmd = base64_enc.encode_command_linux("id")
๐ Project Structure
payloadforge/
โโโ payloadforge/
โ โโโ __init__.py # Package init with version
โ โโโ cli.py # CLI entry point
โ โโโ disclaimer.py # Ethical use disclaimer
โ โโโ logger.py # Opt-in action logging
โ โโโ generators/
โ โ โโโ xss.py # XSS payloads
โ โ โโโ sqli.py # SQL injection payloads
โ โ โโโ ssti.py # SSTI payloads
โ โ โโโ cmdi.py # Command injection payloads
โ โโโ encoders/
โ โ โโโ url.py # URL encoding
โ โ โโโ html.py # HTML entity encoding
โ โ โโโ unicode.py # Unicode encoding
โ โ โโโ base64_enc.py # Base64 encoding
โ โโโ utils/
โ โโโ obfuscation.py # Obfuscation utilities
โโโ tests/ # Unit tests
โโโ examples/ # Usage examples
โโโ pyproject.toml # Package configuration
โโโ LICENSE # MIT License
โโโ README.md # This file
๐งช Running Tests
# Install dev dependencies
pip install -e ".[dev]"
# Run all tests
pytest
# Run with coverage
pytest --cov=payloadforge
# Run specific test
pytest tests/test_xss.py -v
๐ค Contributing
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Contribution Guidelines
- Follow PEP 8 style guidelines
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
- Include ethical use disclaimers in new modules
โ ๏ธ Responsible Usage Disclaimer
PayloadForge is intended solely for:
- โ Authorized penetration testing with written permission
- โ Educational purposes and security research
- โ Capture The Flag (CTF) competitions
- โ Testing your own systems and applications
Prohibited uses:
- โ Unauthorized access or testing of systems you don't own
- โ Malicious exploitation or attacks
- โ Any illegal activities
By using this software, you agree to:
- Obtain proper authorization before testing any systems
- Accept full responsibility for your actions
- Use this tool ethically and legally
The authors and contributors are not responsible for any misuse of this software.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ฎ Future Roadmap
- Plugin system for custom payloads
- YAML configuration support
- API mode for educational portals
- More template engine support
- Payload mutation/fuzzing
- Integration with Burp Suite
Made with โค๏ธ for the security community
Remember: With great power comes great responsibility. Test ethically!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file payloadforge-1.0.2.tar.gz.
File metadata
- Download URL: payloadforge-1.0.2.tar.gz
- Upload date:
- Size: 32.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9c37067dfbdff2cbcbbeaa2c9e80cc1f2212c32a2c8af0464e3b2caaab99cac
|
|
| MD5 |
db8dc73d95e49706aff2c7e17959c491
|
|
| BLAKE2b-256 |
d876c67effb79e523862a72cf2fc25b45b3302f2e6bb7fc50e5f1c205114ded0
|
File details
Details for the file payloadforge-1.0.2-py3-none-any.whl.
File metadata
- Download URL: payloadforge-1.0.2-py3-none-any.whl
- Upload date:
- Size: 32.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6afe993d6f5d5c08eb4d478b343dfaaeb3a8155d7e5aa92a6faacb111d924be4
|
|
| MD5 |
07bf7a4eaae7b10a0264f6b58ca9eb2a
|
|
| BLAKE2b-256 |
b785facd3b6519bd4f918570ba69c10cc64d496f7d8867674c8225514100cc60
|