Add your description here
Project description
OpenAPI Scanner
A tool for scanning and testing OpenAPI specifications.
Features
- Support for both JSON and YAML OpenAPI specifications
- Flexible authentication system
- Automatic path parameter replacement
- Custom header support
- Multiple report formats (Console, HTML, CSV, JSONL)
Installation
# Install dependencies
pip install -r requirements.txt
# Install in development mode
pip install -e .
Usage
Basic Usage
# Using JSON specification
python -m specphp_scanner spec.json --host localhost --port 8080
# Using YAML specification
python -m specphp_scanner spec.yaml --host localhost --port 8080
Using Authentication
# Using module path
python -m specphp_scanner spec.json --auth-class examples.koel.auth.KoelAuth --auth-params '{"email": "user@example.com", "password": "secret"}'
# Using file path
python -m specphp_scanner spec.json --auth-class ./examples/koel/auth.py --auth-params '{"email": "user@example.com", "password": "secret"}'
Using Custom Headers
python -m specphp_scanner spec.json --headers '{"X-Custom-Header": "value"}'
Generating Reports
# Console output (default)
python -m specphp_scanner spec.json
# HTML report
python -m specphp_scanner spec.json --format html --output report.html
# CSV report
python -m specphp_scanner spec.json --format csv --output report.csv
# JSONL report
python -m specphp_scanner spec.json --format jsonl --output report.jsonl
Command Line Options
spec_file: Path to OpenAPI specification file (JSON or YAML)--host: Target host (default: localhost)--port: Target port (default: 8080)--auth-class: Authentication class path or Python file path--auth-params: JSON string containing authentication parameters--headers: JSON string containing custom headers--format: Report format (console, html, csv, jsonl)--output: Output file path for the report--verbose,-v: Enable verbose logging
Creating Custom Authentication Classes
Create a class that inherits from BaseAuth:
from specphp_scanner.auth.base import BaseAuth
class MyCustomAuth(BaseAuth):
def __init__(self, **kwargs):
# Initialize your authentication parameters
self.token = None
def authenticate(self):
# Implement your authentication logic
# This method should be called before making API requests
pass
def get_headers(self):
# Return headers required for authentication
return {"Authorization": f"Bearer {self.token}"}
def get_cookies(self):
# Return cookies required for authentication
return {}
Examples
See the examples directory for sample implementations.
Project Structure
specphp_scanner/
├── __init__.py
├── cli.py
├── scanner.py
├── auth/
│ ├── __init__.py
│ ├── base.py
│ └── factory.py
└── utils/
├── __init__.py
├── param_generator.py
├── report.py
└── templates/
└── report.html
Running Tests
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
specphp_scanner-0.0.1.tar.gz
(12.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file specphp_scanner-0.0.1.tar.gz.
File metadata
- Download URL: specphp_scanner-0.0.1.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18dda88126215ae7d65b7ab924c593960c6b77582ad4b62f0f838870bb271b5c
|
|
| MD5 |
cd3966dc6003935546e0874b8593f019
|
|
| BLAKE2b-256 |
c77ecbce6ccbfb0118c80e65aabbadd1ebe5e95e899576cbb6864e1dba0bc5ad
|
File details
Details for the file specphp_scanner-0.0.1-py3-none-any.whl.
File metadata
- Download URL: specphp_scanner-0.0.1-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1d1cd40fe9d7e05ebf7268942eaa47013fe408596b9575c2bb0233df54cf3d1
|
|
| MD5 |
a52098c82c9cf46dfaf8536652aa7834
|
|
| BLAKE2b-256 |
b0ab993e25a637e68e31e0b448aba77b8fc172c2029273e26b437db914c6afc5
|