Tyr is a vulnerability scanner written in Python that analyzes software projects for vulnerable dependencies and suspicious code patterns. Named after the Norse god of war and justice, Tyr aims to protect your projects by identifying potential weak points in dependencies and code.
- π Multi-Source Scanning: Queries both NVD (National Vulnerability Database) and OSV (Open Source Vulnerabilities) databases
- π΅οΈ Code Pattern Detection: Scans for suspicious code patterns and potential security issues
- π Detailed Reports: Generates comprehensive HTML-colored reports in Markdown format
- π Optimized Performance: Configurable delays and NVD API key support for faster scanning
- π― Accurate Detection: Identifies vulnerabilities by specific version across multiple package managers
- π Colorful Interface: Terminal output with colors for better readability
- π CVE Links: Direct links to vulnerability details in NVD database
- π Smart Reporting: Intelligent text truncation and severity-based coloring
- JavaScript/Node.js:
package.json - PHP:
composer.json - Python:
requirements.txt - Ruby:
Gemfile - Java:
pom.xml,build.gradle - Rust:
Cargo.toml - Docker:
Dockerfile
- Python 3.7 or higher
- pip (Python package manager)
pip install requestsgit clone https://github.com/chrisatdev/tyr.git
cd tyrpython3 tyr.py /path/to/your/projectpython3 tyr.py /path/to/your/project -n "My Project"python3 tyr.py /path/to/your/project -k YOUR_NVD_API_KEYpython3 tyr.py /path/to/your/project -cpython3 tyr.py /path/to/your/project -q| Option | Description |
|---|---|
project_path |
Path to project to scan (required) |
-n, --project-name |
Project name for report |
-o, --output |
Output filename (default: tyr_report.md) |
-k, --nvd-api-key |
NVD API key for faster scans |
-d, --delay |
Delay between API requests in seconds (default: 1.0) |
-c, --code-scan |
Enable suspicious code pattern detection |
-q, --quiet |
Quiet mode (only shows final message) |
-h, --help |
Show help and exit |
-v, --version |
Show version and exit |
To get an NVD API key for faster scanning:
- Visit NVD API Key Request
- Register on the portal
- Request your free API key
- Use it with the
-kparameter
Note: With API key the delay between requests is 0.6s, without API key it's 6s.
ββββββββββββββββββββββββββββββββββββββββββββ
β β
β ββββββββββββ ββββββββββ β
β βββββββββββββ ββββββββββββ β
β βββ βββββββ ββββββββ β
β βββ βββββ ββββββββ β
β βββ βββ βββ βββ β
β βββ βββ βββ βββ β
β β
β Security Scanner v1.1.0 β
β by Christian Benitez β
β cbenitezdiaz@gmail.com β
β β
ββββββββββββββββββββββββββββββββββββββββββββ
Tyr - Vulnerability Scanner v1.1.0
==================================================
π Scanning project: my-project
π Path: /path/to/my-project
π Dependency files found: 3
π¦ Dependencies found: 15
π΅οΈ Code pattern scanning: Enabled
π Searching for vulnerabilities...
π‘ Using multiple sources: NVD and OSV
β
Using NVD API Key: faster scanning
π¨ Vulnerabilities found: 2
π΅οΈ Suspicious patterns found: 3
π Report generated: tyr_report.md
π Summary:
CRITICAL: 1
HIGH: 1
MEDIUM: 1
LOW: 0
π΅οΈ Suspicious patterns:
HIGH: 1
MEDIUM: 2
LOW: 0
The script generates a comprehensive Markdown report with:
- Executive Summary: Overview of vulnerabilities and code findings
- Vulnerability Table: Color-coded severity levels with direct CVE links
- Code Pattern Findings: Detailed suspicious code patterns with risk levels
- Recommendations: Actionable security improvement suggestions
tyr/
βββ tyr.py # Main scanner script
βββ README.md # This documentation
βββ es/README.md # This documentation in Spanish
βββ tyr_report.md # Example generated report
- NVDClient: Client for interacting with NVD API
- OSVClient: Client for Open Source Vulnerabilities database
- CodeScanner: Class for suspicious code pattern detection
- Colors: Terminal color handling utilities
- Parser Functions: For different dependency file types
- Report Generator: Creates colored Markdown format reports
- Multi-Source Scanning: Queries both NVD and OSV databases for comprehensive coverage
- Pattern Detection: Regex-based detection of common security anti-patterns
- Smart Reporting: Intelligent text processing and HTML-colored output
- Error Handling: Robust error handling with informative messages
This project is under the MIT License. See the LICENSE file for details.
Contributions are welcome. Please:
- Fork the project
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Scanning depends on NVD and OSV API availability
- Without NVD API key, the process may be slow for projects with many dependencies
- Version vulnerability detection might have false positives/negatives
- Code pattern detection is based on basic pattern matching
If you encounter any issues:
- Check that you have the latest version
- Verify that your NVD API key is valid (if using one)
- Open an issue in the repository with:
- Problem description
- Command executed
- Error output
- Operating system and Python version
Developed by Christian Benitez - Questions? Open an issue in the repository.