🔒 API Security Auditor Pro
Professional command-line tool for comprehensive API security auditing with CI/CD integration.
🚀 Features
- 10+ Security Checks: SQL/NoSQL injection, XSS, IDOR, JWT vulnerabilities, rate limiting, CORS, security headers, data exposure, file upload, GraphQL
- Multiple API Types: REST, GraphQL, SOAP support
- OpenAPI/Swagger Integration: Automatically parse and test all endpoints
- CI/CD Ready: JUnit XML output for Jenkins/GitLab CI integration
- Multiple Output Formats: JSON, HTML, CSV, PDF, JUnit XML
- Rate Limiting Testing: Detect missing rate limiting with configurable concurrency
- Passive Analysis: Analyze proxy logs and PCAP files
- Custom Plugins: Extend functionality with Python plugins
- Docker Support: Run in containers with ease
📦 Installation
From PyPI (Recommended)
pip install api-security-auditor-pro
From Source
git clone https://github.com/[YOUR_GITHUB_USERNAME]/api-security-auditor-pro.git
cd api-security-auditor-pro
pip install -e .
Using Docker
docker pull [YOUR_DOCKER_USERNAME]/api-security-auditor-pro:latest
docker run [YOUR_DOCKER_USERNAME]/api-security-auditor-pro --help
🎯 Quick Start
Basic API Scan
# Scan a single endpoint
api-auditor scan https://api.example.com/users
# With verbose output
api-auditor scan https://api.example.com/users --verbose
# Save results to HTML report
api-auditor scan https://api.example.com/users --output report.html --format html
Complete API Audit from OpenAPI Spec
# Audit all endpoints from OpenAPI specification
api-auditor audit --spec ./openapi.yaml
# Skip specific checks
api-auditor audit --spec ./openapi.yaml --skip-checks rate_limiting,data_exposure
# Run only specific checks
api-auditor audit --spec ./openapi.yaml --checks sql_injection,idor
Test Rate Limiting
# Test with 1000 requests, 50 concurrent connections
api-auditor test-rate-limit https://api.example.com/login --requests 1000 --concurrency 50
Passive Analysis
# Analyze proxy logs (Burp Suite, OWASP ZAP)
api-auditor analyze --log-file burp.log
# Analyze PCAP file
api-auditor analyze --pcap-file traffic.pcap --output analysis.json
🛠️ Command Reference
Global Options
| Option | Description |
|---|---|
--help |
Show help message |
--version |
Show version information |
Scan Command
api-auditor scan URL [OPTIONS]
| Option | Description | Default |
|---|---|---|
-v, --verbose |
Enable verbose output | False |
-o, --output |
Output file path | None |
-f, --format |
Output format (json/html/csv/pdf) | json |
-t, --timeout |
Request timeout in seconds | 30 |
-th, --threads |
Number of concurrent threads | 10 |
-c, --checks |
Comma-separated checks to run | all |
-s, --skip-checks |
Comma-separated checks to skip | none |
Audit Command
api-auditor audit --spec PATH [OPTIONS]
| Option | Description | Required |
|---|---|---|
--spec |
OpenAPI/Swagger file path | Yes |
-o, --output |
Output file path | No |
-f, --format |
Output format | json |
-c, --checks |
Specific checks to run | No |
-k, --skip-checks |
Checks to skip | No |
📊 Security Checks Reference
| ID | Check | Severity | Description |
|---|---|---|---|
| INJ001 | SQL Injection | CRITICAL | Detect SQL injection vulnerabilities |
| INJ002 | NoSQL Injection | CRITICAL | Detect NoSQL injection in MongoDB/others |
| INJ003 | XSS | MEDIUM | Cross-site scripting in API responses |
| AUTH001 | JWT Weak Signature | HIGH | Weak JWT secrets or none algorithm |
| AUTH002 | IDOR/BOLA | HIGH | Insecure Direct Object References |
| RATE001 | Missing Rate Limiting | MEDIUM | No rate limiting protection |
| HEAD001 | Security Headers | LOW | Missing security headers |
| HEAD002 | CORS Misconfiguration | MEDIUM | Overly permissive CORS policies |
| DATA001 | Data Exposure | HIGH | Sensitive data in responses |
| UPLOAD001 | File Upload | HIGH | Unrestricted file upload |
| GRAPH001 | GraphQL Introspection | MEDIUM | GraphQL schema exposure |
🐳 Docker Usage
Build Image
docker build -t api-auditor:latest .
Run Scans
# Basic scan with output mounted
docker run -v $(pwd)/output:/output api-auditor:latest scan https://api.example.com --output /output/report.html
# Using docker-compose with test environment
docker-compose up api-auditor
# Interactive mode
docker run -it api-auditor:latest --help
🔌 Custom Plugins
Create custom security checks by extending the SecurityCheck class:
# ~/.api-auditor/plugins/custom_check.py
from api_security_auditor_pro.core.base_check import BaseCheck
class CustomSecurityCheck(BaseCheck):
name = "Custom API Security Check"
severity = "HIGH"
async def execute(self, target: str) -> dict:
# Your custom check logic
response = await self.request_builder.get(target)
if "vulnerable" in response.text:
return {
"finding": "Custom vulnerability detected",
"severity": self.severity,
"remediation": "Apply custom fix"
}
return None
📈 CI/CD Integration
Jenkins Pipeline
pipeline {
agent any
stages {
stage('API Security Audit') {
steps {
sh 'pip install api-security-auditor-pro'
sh 'api-auditor audit --spec openapi.yaml --format junit --output security-report.xml'
junit 'security-report.xml'
}
}
}
}
GitLab CI
security-audit:
stage: test
script:
- pip install api-security-auditor-pro
- api-auditor audit --spec openapi.yaml --format junit --output security-report.xml
artifacts:
reports:
junit: security-report.xml
GitHub Actions
- name: API Security Audit
run: |
pip install api-security-auditor-pro
api-auditor audit --spec openapi.yaml --format json --output security-report.json
📝 Output Examples
JSON Output
{
"target": "https://api.example.com",
"timestamp": "2024-01-15T10:30:00",
"vulnerabilities": [
{
"check_id": "sql_injection",
"severity": "CRITICAL",
"finding": "SQL Injection vulnerability detected",
"payload": "' OR '1'='1",
"remediation": "Use parameterized queries/prepared statements"
}
],
"scan_summary": {
"checks_performed": 10,
"total_requests": 245,
"duration_seconds": 12.34
}
}
HTML Report
Generates a professional, responsive HTML report with:
- Executive summary dashboard
- Vulnerability heatmap
- Detailed findings with CVSS scoring
- Remediation recommendations
- MITRE ATT&CK mapping
🧪 Development Setup
# Clone repository
git clone https://github.com/[YOUR_GITHUB_USERNAME]/api-security-auditor-pro.git
cd api-security-auditor-pro
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run linting
flake8 src tests
black --check src tests
mypy src
# Build documentation
cd docs && make html
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
📄 License
MIT License - see LICENSE file for details.
⚠️ Disclaimer
This tool is for authorized security testing only. Users are responsible for complying with applicable laws and regulations. Always obtain proper authorization before scanning any API.
🌟 Support
🙏 Acknowledgments
- OWASP API Security Top 10
- Burp Suite and OWASP ZAP communities
- All security researchers and contributors
Star ⭐ this repository if you find it useful!
Metadata
Release files for api-security-auditor-pro 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| api_security_auditor_pro-1.0.0.tar.gz | 15.0 kB | Without provenance | Details for api_security_auditor_pro-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| api_security_auditor_pro-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for api_security_auditor_pro-1.0.0-py3-none-any.whl |
Total release size: 28.6 kB
Release files / api_security_auditor_pro-1.0.0.tar.gz
| Download URL | api_security_auditor_pro-1.0.0.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8883f79f8ccff7b26845a52ed98884fbcbd67e3ae9a53ffcbd5f780799e42103
|
|
BLAKE2b-256 checksum How to use checksums |
2d5d18d7b92a352daa770620c95029f0bec26cd8ea69e3316df0e7bf3397153c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / api_security_auditor_pro-1.0.0-py3-none-any.whl
| Download URL | api_security_auditor_pro-1.0.0-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dab8f07fa7ef77feb6dac346e56bee41db09bd5d3f44528ade108198183a20ba
|
|
BLAKE2b-256 checksum How to use checksums |
f174b4e5a8b0f0ffe55feb095d83a87c13e8ec846c62494c9cf3e005e9d0d026
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for api-security-auditor-pro 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.