Skip to content

Developer Contribution Guide

Contribution Banner

"Hack the planet, one pull request at a time" — GhostKit Developer Community

Introduction

This guide will help you contribute to the GhostKit project effectively. Whether you're fixing bugs, adding new offensive security capabilities, or improving documentation, this guide covers the workflow, coding standards, and best practices for contributing to GhostKit.

Getting Started

Development Environment Setup

  1. Fork the Repository

    # Clone your fork
    git clone https://github.com/YOUR-USERNAME/GhostKit.git
    cd GhostKit
    
    # Add upstream remote
    git remote add upstream https://github.com/K11E3R/GhostKit.git
    

  2. Create Virtual Environment

    python -m venv venv
    
    # On Windows
    venv\Scripts\activate
    
    # On Linux/macOS
    source venv/bin/activate
    

  3. Install Development Dependencies

    pip install -r requirements-dev.txt
    

  4. Install Pre-commit Hooks

    pre-commit install
    

Development Workflow

graph LR
    A[Fork Repository] --> B[Create Feature Branch]
    B --> C[Implement Changes]
    C --> D[Run Tests]
    D --> E[Submit Pull Request]
    E --> F[Code Review]
    F --> G[Address Feedback]
    G --> H[Merge]
  1. Create a Feature Branch

    git checkout -b feature/your-feature-name
    

  2. Make Your Changes

  3. Write code following the coding standards
  4. Add tests for new functionality
  5. Update documentation

  6. Commit Your Changes

  7. Follow the Git Commit Conventions

    git add .
    git commit -m "[ADD] module: implement new exploitation technique"
    

  8. Push to Your Fork

    git push origin feature/your-feature-name
    

  9. Create a Pull Request

  10. Go to the GhostKit repository
  11. Click "New Pull Request"
  12. Select "compare across forks"
  13. Select your fork and branch
  14. Fill out the PR template

Git Commit Conventions

All commits must follow the format: [TAG] module: description

TAG Description Example
ADD Adding new features [ADD] network: implement parallel nmap scanner
UPDATE Updating existing features [UPDATE] readme: update installation instructions
FIX Bug fixes [FIX] exploit: correct off-by-one in PoC buffer overflow
RM Removing code [RM] old_tool: remove deprecated recon script
MV Moving/renaming [MV] utils: refactor helper functions into modules
DOC Documentation changes [DOC] README: add usage examples for Mode 5

Coding Standards

Python Style Guide

GhostKit follows the Black code style with a few additional rules:

  1. Code Formatting
  2. Use Black with line length of 88 characters
  3. Use isort for import sorting

  4. Naming Conventions

  5. Classes: CamelCase
  6. Functions/Methods: snake_case
  7. Variables: snake_case
  8. Constants: UPPER_SNAKE_CASE
  9. Private attributes/methods: _leading_underscore

  10. Documentation

  11. All modules, classes, and methods must have docstrings
  12. Follow Google docstring format
def exploit_vulnerability(target: str, payload: bytes, timeout: int = 30) -> ExploitResult:
    """Exploits a vulnerability on the target system.

    This function attempts to exploit a known vulnerability by
    sending a specially crafted payload to the target.

    Args:
        target: The target IP address or hostname
        payload: The exploit payload to send
        timeout: Timeout in seconds (default: 30)

    Returns:
        ExploitResult: Object containing exploit results

    Raises:
        ConnectionError: If the target is unreachable
        TimeoutError: If the exploit times out

    Example:
        >>> result = exploit_vulnerability("192.168.1.100", payload_bytes)
        >>> if result.success:
        ...     print(f"Exploitation successful! Got shell on port {result.shell_port}")
    """
    # Implementation...

Code Organization

ghostkit/
├── core/             # Core framework components
├── modules/          # Attack/security modules
│   ├── recon/        # Reconnaissance modules
│   ├── web/          # Web attack modules
│   ├── network/      # Network attack modules
│   ├── wireless/     # Wireless attack modules
│   ├── hardware/     # Hardware attack modules
│   └── post/         # Post-exploitation modules
├── utils/            # Utility functions
├── data/             # Static data files
├── interface/        # User interface code
└── tests/            # Test suite

Security Considerations

  1. Avoid Hardcoded Secrets
  2. No API keys, passwords, or tokens in code
  3. Use environment variables or secure storage

  4. Input Validation

  5. Validate all user inputs
  6. Sanitize data coming from external sources

  7. Error Handling

  8. Implement proper exception handling
  9. Do not expose sensitive information in error messages

  10. Code Security

  11. No backdoors or undocumented features
  12. All capabilities must be transparent and documented

Testing

Writing Tests

GhostKit uses pytest for testing. Every module should have corresponding tests:

# tests/modules/test_exploit_module.py
import pytest
from ghostkit.modules.exploit import ExploitModule

@pytest.fixture
def exploit_module():
    return ExploitModule()

def test_exploit_validation(exploit_module):
    """Test that the exploit properly validates inputs."""
    with pytest.raises(ValueError):
        exploit_module.validate_target("not-a-valid-target")

    assert exploit_module.validate_target("192.168.1.1") is True

def test_exploit_execution(exploit_module, mocker):
    """Test that the exploit executes correctly."""
    # Mock network calls
    mock_socket = mocker.patch("socket.socket")
    mock_socket.return_value.recv.return_value = b"Shell connected"

    result = exploit_module.run(target="192.168.1.1", payload=b"TEST")

    assert result.success is True
    assert result.shell_connected is True

Running Tests

# Run all tests
python -m pytest

# Run specific test file
python -m pytest tests/modules/test_exploit_module.py

# Run with coverage
python -m pytest --cov=ghostkit

# Generate coverage report
python -m pytest --cov=ghostkit --cov-report=html

Documentation

All code contributions should include appropriate documentation:

  1. Code Documentation
  2. Docstrings for all modules, classes, and methods
  3. Inline comments for complex logic

  4. Module Documentation

  5. Create a markdown file in docs/modules/ for each new module
  6. Include usage examples, parameters, and sample output

  7. API Documentation

  8. Document all public APIs following OpenAPI standards
  9. Update API reference when changing interfaces

Pull Request Process

PR Checklist

Before submitting a pull request, ensure:

  • Code follows the style guidelines
  • All tests pass
  • New functionality includes tests
  • Documentation is updated
  • Commit messages follow conventions
  • No sensitive information is included

Review Process

  1. Initial Review
  2. Automated checks (linting, tests, security scans)
  3. Initial maintainer review

  4. Feedback Phase

  5. Address reviewer comments
  6. Make requested changes

  7. Final Approval

  8. Maintainer approves changes
  9. Changes are merged

Module Development

Module Structure

New modules should follow this structure:

from typing import Dict, List, Optional, Any
from ghostkit.core.module import BaseModule
from ghostkit.core.result import ModuleResult

class NewExploitModule(BaseModule):
    """Exploits a specific vulnerability in target systems.

    This module implements an exploit for CVE-XXXX-XXXXX,
    allowing for remote code execution on vulnerable systems.
    """

    name = "new_exploit"
    description = "Exploits CVE-XXXX-XXXXX for remote code execution"
    author = "Your Name"
    references = [
        "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-XXXX-XXXXX",
        "https://example.com/detailed-writeup"
    ]

    def _create_arg_parser(self):
        """Create argument parser for this module."""
        parser = super()._create_arg_parser()
        parser.add_argument("-t", "--target", required=True, help="Target IP or hostname")
        parser.add_argument("-p", "--port", type=int, default=80, help="Target port")
        parser.add_argument("-v", "--verbose", action="store_true", help="Enable verbose output")
        return parser

    def run(self, args: List[str]) -> ModuleResult:
        """Run the exploit module with the given arguments."""
        parsed_args = self.args_parser.parse_args(args)

        # Implementation logic
        self.logger.info(f"Targeting {parsed_args.target}:{parsed_args.port}")

        # Execute exploit
        result = self._exploit(parsed_args.target, parsed_args.port)

        return ModuleResult(
            success=result["success"],
            data=result["data"],
            message=result["message"]
        )

    def _exploit(self, target: str, port: int) -> Dict[str, Any]:
        """Core exploit implementation."""
        # Detailed exploit implementation
        pass

Module Requirements

All modules must:

  1. Be self-contained - Minimize dependencies
  2. Include documentation - Both docstrings and standalone docs
  3. Implement proper logging - Use the module's logger
  4. Handle errors gracefully - No uncaught exceptions
  5. Support verbose mode - Detailed output when requested
  6. Return standardized results - Use ModuleResult objects

Plugin Development

Plugin Structure

Plugins extend GhostKit functionality without modifying core code:

plugin_name/
├── __init__.py          # Plugin initialization
├── metadata.json        # Plugin metadata
├── modules/             # Plugin-specific modules
├── resources/           # Additional resources
└── README.md            # Plugin documentation

Plugin Metadata

{
  "name": "plugin_name",
  "version": "1.0.0",
  "author": "Your Name",
  "email": "your.email@example.com",
  "description": "Plugin description",
  "entry_point": "plugin_name.__init__",
  "dependencies": [
    "requests>=2.25.0",
    "cryptography>=3.4.0"
  ],
  "compatibility": "3.1.0",
  "category": "exploitation"
}

Plugin Registration

# __init__.py
from ghostkit.core.plugin import register_plugin
from .modules import CustomModule1, CustomModule2

def initialize():
    """Initialize the plugin."""
    register_plugin(
        name="plugin_name",
        modules=[CustomModule1, CustomModule2],
        hooks={
            "pre_scan": pre_scan_hook,
            "post_exploit": post_exploit_hook
        }
    )

def pre_scan_hook(context):
    """Hook that runs before scanning."""
    pass

def post_exploit_hook(context, result):
    """Hook that runs after exploitation."""
    pass

Quality Assurance

Static Analysis

GhostKit uses several static analysis tools:

# Run Bandit security analysis
bandit -r ghostkit/

# Run flake8 linting
flake8 ghostkit/ tests/

# Run mypy type checking
mypy ghostkit/

Security Testing

All code undergoes security review:

# Scan for hardcoded secrets
gitleaks detect --source .

# Scan for known vulnerabilities in dependencies
safety check

# Run SAST (Static Application Security Testing)
bandit -r ghostkit/ -f json -o bandit-results.json

Community Guidelines

Communication Channels

  • GitHub Issues: Bug reports, feature requests
  • Pull Requests: Code contributions
  • Discord Server: Real-time discussions
  • Mailing List: Announcements and discussions

Code of Conduct

All contributors must adhere to the Code of Conduct, which promotes:

  • Respectful and inclusive communication
  • Constructive feedback
  • Collaborative problem-solving
  • Focus on technical merit

Recognition

Contributors are recognized through:

  • Attribution in code (author credits)
  • Mention in release notes
  • Recognition on the contributors page
  • Opportunities for maintainership

Frequently Asked Questions

How do I report security vulnerabilities?

Please report security issues privately to security@ghostkit.io. Do not disclose security vulnerabilities publicly until they have been addressed.

How can I propose major changes?

Major changes should start with a Request for Comments (RFC) document submitted as an issue on GitHub. This allows discussion before significant development effort.

What if I need help?

  • Ask questions in the GitHub Discussions
  • Join the Discord server for real-time help
  • Check the documentation for guides
  • Review existing issues for similar problems

Resources


Last updated: May 30, 2025