A safe, modular tool that scans a given URL or IP for common, non-destructive vulnerabilities and produces a clear report.
Disclaimer: This tool is for educational purposes and authorized testing only. Unauthorized scanning of websites is illegal. The user is responsible for their actions.
- Connectivity check
- TCP port scanning
- Security header analysis
- Non-destructive SQL injection checks
- Non-destructive reflected XSS checks
- Text and JSON reporting
-
Clone the repository:
git clone https://github.com/NabinSharmaitgithub/CyberGuard cd CyberGuard -
Install the dependencies:
pip install -r requirements.txt
python3 scanner.py --target <URL_OR_IP> [OPTIONS]--target: The target URL or IP address (required).--output: The output format (textorjson, default:text).--ports: A comma-separated list of ports to scan (e.g.,80,443,8080).--timeout: The timeout for network requests in seconds (default:1.0).--aggressive: Perform more intensive (but still safe) checks.--i-have-permission: Required for aggressive scans.
Safe Scan
python3 scanner.py --target http://localhost:8000 --safeAggressive Scan
python3 scanner.py --target "http://localhost:8000?id=1" --aggressive --i-have-permission[Medium] Missing Security Header: Content-Security-Policy
Description: Mitigates XSS and other injection attacks.
Remediation: Implement a strict Content-Security-Policy.
[High] Potential SQL Injection
Description: A potential SQL injection vulnerability was found in the 'id' parameter.
Remediation: Use parameterized queries to prevent SQL injection.
[
{
"title": "Missing Security Header: Content-Security-Policy",
"severity": "Medium",
"description": "Mitigates XSS and other injection attacks.",
"remediation": "Implement a strict Content-Security-Policy."
},
{
"title": "Potential SQL Injection",
"severity": "High",
"description": "A potential SQL injection vulnerability was found in the 'id' parameter.",
"remediation": "Use parameterized queries to prevent SQL injection."
}
]The JSON output is an array of finding objects, each with the following structure:
title(string): The title of the finding.severity(string): The severity of the finding (High,Medium,Low,Info).description(string): A description of the finding.remediation(string, optional): Remediation advice.
To add a new scan module, see CONTRIBUTING.md.
- The tool does not perform any actions that could alter or delete data on the target system.
- SQL injection checks use benign payloads that only trigger errors.
- XSS checks only look for reflections and do not execute any scripts.
- The tool does not send any exploit payloads.
To test the scanner locally, you can run a simple Python web server:
-
Create a file named
test_server.py:from flask import Flask, request app = Flask(__name__) @app.route('/') def index(): param = request.args.get('id', '') if "'" in param: return "sql syntax error", 500 return f"Hello, {param}!" if __name__ == '__main__': app.run(port=8000)
-
Run the server:
pip install Flask python3 test_server.py
-
Scan the local server:
python3 scanner.py --target "http://localhost:8000?id=1" --aggressive --i-have-permission
