A Python tool that scans GitHub repositories to identify API endpoints across various programming languages and frameworks. It helps developers discover and document API endpoints in codebases, which is useful for API documentation, security auditing, and understanding third-party APIs.
- Repository Scanning: Scan GitHub repositories by URL, username, or organization, or scan locally cloned repositories
- Endpoint Identification: Detect API endpoints in multiple programming languages and frameworks
- OpenAPI/Swagger Support:
- Find and save existing OpenAPI/Swagger documentation in repositories
- Generate OpenAPI/Swagger documentation from detected endpoints if none exists
- Reporting: Generate reports in various formats (text, CSV, JSON)
- Language Support:
- Tier 1 (Fully Implemented):
- Python: Flask (
@app.route,app.get, etc.), Django (path,url), FastAPI (@app.get,@app.post, etc.) - JavaScript/Node.js: Express.js (
app.get,router.post, etc.) - Java: Spring Boot (
@RequestMapping,@GetMapping,@PostMapping, etc.)
- Python: Flask (
- Tier 2 (Planned):
- PHP: Laravel, Symfony
- Ruby: Rails
- Go: Gin, Echo
- Tier 1 (Fully Implemented):
# Install the base package
pip install endpoint-finder
# Install with optional parser dependencies for better accuracy
pip install endpoint-finder[parsers]
# Install with development dependencies (for contributing)
pip install endpoint-finder[dev]-
Clone this repository:
git clone https://github.com/yourusername/endpoint-finder.git cd endpoint-finder -
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install in development mode:
pip install -e . # Or with optional dependencies pip install -e ".[parsers,dev]"
After installation, you can use Endpoint Finder either as a command-line tool or as a Python module.
# If installed via pip
endpoint-finder scan --repo https://github.com/username/repo
# If using the module directly
python -m endpoint_finder scan --repo https://github.com/username/repoendpoint-finder scan --repo https://github.com/username/repo1 https://github.com/username/repo2# Scan all public repositories from a user
endpoint-finder scan --user username
# Scan all public repositories from an organization
endpoint-finder scan --org organization# Scan a single local repository
endpoint-finder scan --local /path/to/local/repo
# Scan multiple local repositories
endpoint-finder scan --local /path/to/repo1 /path/to/repo2# Scan only Python and JavaScript files
endpoint-finder scan --repo https://github.com/username/repo --languages python javascript# Output to console (default)
endpoint-finder scan --repo https://github.com/username/repo
# Output to CSV file
endpoint-finder scan --repo https://github.com/username/repo --output csv --output-file results.csv
# Output to JSON file
endpoint-finder scan --repo https://github.com/username/repo --output json --output-file results.json# Find existing OpenAPI/Swagger documentation (enabled by default)
endpoint-finder scan --repo https://github.com/username/repo --find-openapi
# Disable finding existing OpenAPI/Swagger documentation
endpoint-finder scan --repo https://github.com/username/repo --no-find-openapi
# Generate OpenAPI documentation if none exists (enabled by default)
endpoint-finder scan --repo https://github.com/username/repo --generate-openapi
# Disable generating OpenAPI documentation
endpoint-finder scan --repo https://github.com/username/repo --no-generate-openapi
# Specify directory to save OpenAPI documentation
endpoint-finder scan --repo https://github.com/username/repo --openapi-dir ./docs/openapi
# Specify format for generated OpenAPI documentation (json or yaml)
endpoint-finder scan --repo https://github.com/username/repo --openapi-format yamlFor private repositories or to avoid GitHub API rate limits:
endpoint-finder scan --repo https://github.com/username/repo --token YOUR_GITHUB_TOKENYou can also use Endpoint Finder as a Python module in your own scripts:
from endpoint_finder.scanner import scan_repositories
# Scan a remote GitHub repository
results = scan_repositories(
repositories=["https://github.com/username/repo"],
config={
"github": {"token": "YOUR_GITHUB_TOKEN"},
"scan": {"languages": ["python", "javascript", "java"]},
"output": {"format": "json"}
}
)
# Scan a local repository
results = scan_repositories(
repositories=[],
config={
"scan": {"languages": ["python", "javascript", "java"]},
"output": {"format": "json"}
},
local_repos=["/path/to/local/repo"]
)
# Process the results
print(f"Found {results['total_endpoints']} endpoints")
for repo in results['repositories']:
print(f"Repository: {repo['repository']}")
print(f"Endpoints: {repo['endpoint_count']}")
for endpoint in repo['endpoints']:
print(f" {endpoint['method']} {endpoint['path']}")You can use a configuration file to set default options:
endpoint-finder scan --config config.yamlExample config.yaml:
# GitHub API configuration
github:
# GitHub personal access token (optional)
token: YOUR_GITHUB_TOKEN
# GitHub username to scan repositories from (optional)
# user: username
# GitHub organization to scan repositories from (optional)
# org: organization
# Scanning configuration
scan:
# Languages to scan for endpoints
languages:
- python # Flask, Django, FastAPI
- javascript # Express.js
- java # Spring Boot
# Directories to exclude from scanning
exclude_dirs:
- .git
- node_modules
- venv
- .venv
- __pycache__
# OpenAPI/Swagger configuration
openapi:
# Find existing OpenAPI/Swagger documentation (default: true)
find_existing: true
# Generate OpenAPI documentation if none exists (default: true)
generate_if_none: true
# Directory to save OpenAPI documentation
output_dir: openapi-docs
# Format for generated OpenAPI documentation: json or yaml
output_format: json
# Output configuration
output:
# Output format: text, csv, or json
format: json
# Output file (optional)
file: results.jsonA sample configuration file is included in the repository as config.example.yaml.
Contributions are welcome! Here's how you can help:
- Add support for new frameworks: Implement parsers for additional frameworks and languages.
- Improve existing parsers: Enhance the accuracy and coverage of existing parsers.
- Add features: Implement new features like parallel processing, caching, or a web interface.
- Fix bugs: Help fix issues and improve the codebase.
- Improve documentation: Enhance the documentation with examples and tutorials.
- Fork and clone the repository
- Set up a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
- Install development dependencies:
pip install -e ".[parsers,dev]" - Run tests:
pytest
To add support for a new framework:
- Create a new file in the
endpoint_finder/parsersdirectory (e.g.,ruby.py) - Implement a parser class that extends
BaseParser - Register your parser in
endpoint_finder/parsers/__init__.py - Add tests in the
testsdirectory - Update the documentation
MIT