Skip to main content

Professional Web Security Assessment Tool

Project description

๐Ÿ›ก๏ธ ShieldScan - Professional Web Security Assessment Tool

Python Version License Code Style

ShieldScan is a professional, ethical web security assessment tool designed for authorized penetration testing. It provides comprehensive OWASP Top 10 vulnerability detection with a focus on safety, legal compliance, and responsible disclosure.

โš ๏ธ Legal Notice

USE THIS TOOL RESPONSIBLY AND LEGALLY

  • โœ… Only use on systems you own or have explicit written authorization to test
  • โœ… Obtain proper consent before running in active mode
  • โœ… Respect rate limits and avoid causing service disruption
  • โŒ Unauthorized access to computer systems is illegal under applicable laws
  • โŒ The authors assume no liability for misuse of this tool

๐Ÿš€ Features

Safe-by-Default Design

  • Passive Mode (Default): Non-intrusive reconnaissance and header analysis
  • Active Mode: Requires explicit consent file for intrusive testing
  • Rate Limiting: Configurable request throttling (default: 1 req/sec)
  • Dry Run: Preview checks without sending requests

Comprehensive Security Checks

โœ… HTTP Security Headers: CSP, HSTS, X-Frame-Options, etc.
โœ… Cookie Security: Secure, HttpOnly, SameSite attributes
โœ… XSS Detection: Reflected XSS using benign markers
โœ… SQL Injection: Error-based detection (non-destructive)
โœ… CORS Misconfiguration: Wildcard and origin reflection
โœ… Directory Listing: Common directory exposure
โœ… Open Redirect: Parameter-based redirect testing
โœ… Clickjacking: Frame protection analysis

Professional Reporting

  • JSON: Structured data for automation
  • Markdown: Stakeholder-friendly reports
  • HTML: Styled web reports with severity visualization
  • Console: Real-time terminal output

Reconnaissance

  • ๐Ÿ” robots.txt and sitemap.xml parsing
  • ๐Ÿ”— Intelligent link discovery and crawling
  • ๐Ÿ“ Form and input parameter extraction
  • ๐Ÿ”ง Technology fingerprinting

๐Ÿ“ฆ Installation

From Source

# Clone the repository
git clone https://github.com/yourusername/shieldscan.git
cd shieldscan

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Install in development mode
pip install -e .

Using pip (once published)

pip install shieldscan

๐ŸŽฏ Quick Start

1. Basic Passive Scan (Safe)

shieldscan scan --target https://example.com --output report.json

This performs non-intrusive checks:

  • Security header analysis
  • Cookie configuration
  • CORS policy review
  • Basic reconnaissance

2. Active Scan with Consent

First, create a consent file (see examples/consent_template.txt):

# Edit consent file with authorization details
cp examples/consent_template.txt my_consent.txt
nano my_consent.txt

Then run active scan:

shieldscan scan \
  --target https://authorized-site.com \
  --mode active \
  --consent-file my_consent.txt \
  --output report.md \
  --format markdown

3. Scan Multiple Targets

# Create file with URLs (one per line)
cat > targets.txt << EOF
https://example.com
https://test.example.com
EOF

shieldscan scan --target-file targets.txt --format all --output results

4. Dry Run (Preview)

shieldscan scan --target https://example.com --dry-run

๐Ÿ”ง Usage

Command-Line Options

shieldscan scan [OPTIONS]

Target Options:
  --target URL              Single target URL
  --target-file FILE        File with URLs (one per line)

Scan Options:
  --mode MODE               Scanning mode: passive (default) or active
  --consent-file FILE       Consent file (required for active mode)
  --throttle FLOAT          Requests per second (default: 1.0)
  --max-depth INT           Maximum crawl depth (default: 2)

Output Options:
  --output FILE             Output file path
  --format FORMAT           Output format: json, markdown, html, all

Other Options:
  --dry-run                 Show planned checks without executing
  --no-logo                 Suppress logo display
  -v, --verbosity LEVEL     Logging verbosity: 0 (warn), 1 (info), 2 (debug)

Examples

Comprehensive scan with all report formats:

shieldscan scan \
  --target https://example.com \
  --format all \
  --output comprehensive_report \
  --throttle 2.0 \
  --max-depth 3

Quiet passive scan:

shieldscan scan --target https://example.com --verbosity 0 --no-logo

Active scan with custom rate limit:

shieldscan scan \
  --target https://authorized.com \
  --mode active \
  --consent-file consent.txt \
  --throttle 0.5 \
  --output detailed_scan.html \
  --format html

๐Ÿ“‹ Consent File Format

Active mode requires a consent file with the following information:

TARGET: https://example.com
SIGNATURE: John Doe
DATE: 2025-10-29

See examples/consent_template.txt for a complete template.

๐Ÿ—๏ธ Architecture

ShieldScan follows a modular design:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   CLI       โ”‚  โ† Entry point, argument parsing
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Scanner    โ”‚  โ† Orchestrates scan workflow
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚              โ”‚             โ”‚              โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ HTTP Client โ”‚ โ”‚ Gatherer โ”‚ โ”‚ VulnCheckโ”‚  โ”‚  Reporter  โ”‚
โ”‚ (Rate Ltd.) โ”‚ โ”‚ (Recon)  โ”‚ โ”‚ (Detect) โ”‚  โ”‚ (Output)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Modules

  • cli.py: Command-line interface with argparse
  • scanner.py: Core orchestration engine
  • http_client.py: HTTP wrapper with rate limiting and retries
  • gather.py: Reconnaissance (robots.txt, sitemap, crawling)
  • vuln_checks.py: Vulnerability detection checks
  • reporter.py: Multi-format report generation
  • utils.py: Common utilities and helpers
  • logo.py: ASCII branding

๐Ÿงช Testing

Run the test suite:

# Run all tests
pytest

# With coverage
pytest --cov=web_pentest_cli --cov-report=html

# Run specific test file
pytest tests/test_utils.py -v

๐Ÿ”Œ Adding Custom Checks

ShieldScan supports plugin-style vulnerability checks:

from web_pentest_cli.vuln_checks import VulnerabilityCheck, VulnerabilityResult

class CustomCheck(VulnerabilityCheck):
    @property
    def check_id(self) -> str:
        return "CUSTOM-001"

    @property
    def check_name(self) -> str:
        return "My Custom Check"

    def check(self, target_url: str, context: dict) -> List[VulnerabilityResult]:
        # Implement your check logic
        results = []
        response = self.client.get(target_url)

        if response and "vulnerable_pattern" in response.text:
            results.append(VulnerabilityResult(
                vuln_id=self.check_id,
                name="Custom Vulnerability",
                severity="medium",
                confidence="high",
                description="Description of the issue",
                evidence="Evidence from response",
                remediation="How to fix it"
            ))

        return results

๐Ÿ“Š Sample Output

Console Summary

================================================================================
  SCAN SUMMARY
================================================================================
Target:     https://example.com
Scan ID:    scan_1730193600
Duration:   12.45 seconds
Requests:   23

Total Vulnerabilities: 5

Severity Breakdown:
  HIGH: 2
  MEDIUM: 2
  LOW: 1
================================================================================

JSON Report Structure

{
  "scan_id": "scan_1730193600",
  "target_url": "https://example.com",
  "mode": "passive",
  "vulnerabilities": [
    {
      "vuln_id": "SEC-HEADERS-001-csp",
      "name": "Missing Content-Security-Policy Header",
      "severity": "medium",
      "confidence": "high",
      "description": "CSP header is missing",
      "evidence": "Header 'content-security-policy' not found",
      "remediation": "Implement CSP to prevent XSS",
      "references": ["https://owasp.org/..."]
    }
  ],
  "statistics": {
    "total_vulnerabilities": 5,
    "severity_breakdown": {"high": 2, "medium": 2, "low": 1}
  }
}

๐Ÿ› ๏ธ Development

Setup Development Environment

# Install with dev dependencies
pip install -e ".[dev]"

# Format code
black web_pentest_cli/

# Lint
flake8 web_pentest_cli/

# Type checking
mypy web_pentest_cli/

Project Structure

shieldscan/
โ”œโ”€โ”€ web_pentest_cli/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ cli.py
โ”‚   โ”œโ”€โ”€ scanner.py
โ”‚   โ”œโ”€โ”€ http_client.py
โ”‚   โ”œโ”€โ”€ gather.py
โ”‚   โ”œโ”€โ”€ vuln_checks.py
โ”‚   โ”œโ”€โ”€ reporter.py
โ”‚   โ”œโ”€โ”€ utils.py
โ”‚   โ””โ”€โ”€ logo.py
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ test_utils.py
โ”‚   โ”œโ”€โ”€ test_http_client.py
โ”‚   โ””โ”€โ”€ test_vuln_checks.py
โ”œโ”€โ”€ examples/
โ”‚   โ”œโ”€โ”€ consent_template.txt
โ”‚   โ””โ”€โ”€ example_urls.txt
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ setup.py
โ””โ”€โ”€ pyproject.toml

๐Ÿ“š References

๐Ÿ“ License

MIT License - see LICENSE file for details.

๐Ÿ‘จโ€๐Ÿ’ป Author

Dr. Ing. [Marzouk Mohamed Amine]
๐Ÿ“ง Email: med.amine.mzk@gmail.com or mohamedamin.marzouk@sousse.r-iset.tn
๐Ÿ›๏ธ Institution: University of Sousse
๐Ÿ”ฌ Research: Internet of Vehicles, Security Testing, Traffic Optimization

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

๐Ÿ“ž Support

For issues, questions, or contributions:

โšก Disclaimer

This tool is provided for educational and authorized testing purposes only. The authors and contributors:

  • Are not responsible for any misuse or damage caused by this tool
  • Do not endorse illegal activities
  • Recommend obtaining proper authorization before testing
  • Advise consulting legal counsel regarding testing activities

Always test responsibly and ethically.


Made with โค๏ธ for the security community

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

shieldscan-1.0.2.tar.gz (30.2 kB view details)

Uploaded Source

Built Distribution

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

shieldscan-1.0.2-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

Details for the file shieldscan-1.0.2.tar.gz.

File metadata

  • Download URL: shieldscan-1.0.2.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for shieldscan-1.0.2.tar.gz
Algorithm Hash digest
SHA256 bf2d9134b2b31db894f08b75cc6baec4add2f70a391b40b2b2919626a93d7314
MD5 02cc77532a9f8107fd97ea3dff9bd9de
BLAKE2b-256 7e2c9f1899f676015f77028c34f2e1a917e6b89234fe344dfb875466ba7d6ea2

See more details on using hashes here.

File details

Details for the file shieldscan-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: shieldscan-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 33.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for shieldscan-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 98dc1931e90be2f695098c8ea71d32bf45d1de2df45590577491bb0d8d285590
MD5 9895157fc91df143462e272d0ad561e8
BLAKE2b-256 301a93717ca9b0168030c04c54025ef583f5945c388897f81ab9c89040b66bc7

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