Skip to main content

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

Python 3.8+ MIT License Ethical Use Only


โš ๏ธ 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:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

payloadforge-1.0.2.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

payloadforge-1.0.2-py3-none-any.whl (32.2 kB view details)

Uploaded Python 3

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

Hashes for payloadforge-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a9c37067dfbdff2cbcbbeaa2c9e80cc1f2212c32a2c8af0464e3b2caaab99cac
MD5 db8dc73d95e49706aff2c7e17959c491
BLAKE2b-256 d876c67effb79e523862a72cf2fc25b45b3302f2e6bb7fc50e5f1c205114ded0

See more details on using hashes here.

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

Hashes for payloadforge-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6afe993d6f5d5c08eb4d478b343dfaaeb3a8155d7e5aa92a6faacb111d924be4
MD5 07bf7a4eaae7b10a0264f6b58ca9eb2a
BLAKE2b-256 b785facd3b6519bd4f918570ba69c10cc64d496f7d8867674c8225514100cc60

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page