Skip to main content

Java and JSP Vulnerability Static Analyzer

Project description

DRSource

DRSource is a static analysis tool designed to detect vulnerabilities in Java and JSP projects. It combines multiple detection techniques—including regex‑based detection and AST‑based taint propagation analysis—to identify security issues such as SQL Injection, Cross‑Site Scripting (XSS), Path Traversal, Command Injection, Serialization Issues, LDAP Injection, XXE, SSRF, and unsafe cryptographic/hashing functions.

Features

  • Regex‑Based Detection
    Utilizes carefully crafted regular expressions to identify known vulnerability patterns in source code.

  • AST‑Based Taint Analysis
    Leverages javalang to parse Java source files into an Abstract Syntax Tree (AST) and performs forward data‑flow analysis to propagate taint from user input sources (e.g., request.getParameter) to sensitive sinks (e.g., executeQuery).

  • Data‑Flow Analysis Framework
    A simplified yet robust framework that tracks tainted variables through declarations and assignments to flag dangerous data flows.

  • Multi‑Detector Support
    Detects various vulnerabilities including:

    • SQL Injection
    • Cross‑Site Scripting (XSS)
    • Path Traversal
    • Command Injection
    • Serialization Issues
    • LDAP Injection
    • XXE (XML External Entity) Attacks
    • SSRF (Server-Side Request Forgery)
    • Unsafe Crypto/Hashing functions
  • Parallel Scanning & Progress Bar
    Files are scanned in parallel with a progress bar for faster analysis on large codebases.

  • Robust CLI
    The command‑line interface offers options to:

    • Initialize the database (--init-db)
    • View scan history (--history)
    • Compare scans (--compare)
    • Export results in SARIF, JSON, or HTML formats (--export)
    • Enable AST‑based detection (--ast)
    • Enable debug logging (--debug)
    • Display version information (--version)

Installation

Clone the repository and navigate to the project root:

git clone https://github.com/thesp0nge/dr_source.git
cd dr_source

Install the package in editable mode:

pip install --editable .

Usage

Run dr_source using the CLI:

dr_source [OPTIONS] TARGET_PATH

Options

  • TARGET_PATH: The path of the codebase (directory containing Java/JSP files) to analyze.
  • --init-db: Initialize the database from scratch (drops and recreates tables).
  • --history: Display the scan history for the project.
  • --compare : Compare the latest scan with a previous scan specified by ID.
  • --export [sarif|json|html]: Export scan results in the specified format.
  • --ast: Enable AST‑based detection (in addition to regex‑based detection).
  • --debug: Enable debug logging.
  • --version: Show DRSource version (as defined in setup.py) and exit.

Examples

  • Scan a Codebase Using AST‑Based Detection with Debug Logging:
dr_source --ast --debug /path/to/codebase
  • Initialize the Database:
dr_source --init-db /path/to/codebase
  • Export Results as SARIF:
dr_source --export sarif /path/to/codebase
  • Run a scan using AST-Based detection engine and create a ascii table with vulnerabilities:
dr_source --ast /path/to/codebase --export ascii --output report.txt

Contributing

Contributions are welcome! To contribute:

  • Fork the repository.
  • Create a new branch for your feature or bugfix.
  • Make your changes with clear commit messages.
  • Submit a pull request for review.
  • For major changes, please open an issue first to discuss your proposed changes.

License

dr_source is licensed under the MIT License.

Acknowledgments

Special thanks to the maintainers of javalang for their work on Java AST parsing. Inspired by various static analysis and security tools.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dr_source-0.80.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dr_source-0.80.0-py3-none-any.whl (31.7 kB view details)

Uploaded Python 3

File details

Details for the file dr_source-0.80.0.tar.gz.

File metadata

  • Download URL: dr_source-0.80.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for dr_source-0.80.0.tar.gz
Algorithm Hash digest
SHA256 3e3f69f2a06c27acc67e27fb2b343c15fc28dc3fba7dd21987880c6b27d4d0d9
MD5 18e549dab92263234a1f15262f58ac78
BLAKE2b-256 989fafb0721599cf87cfd60545cfd0d7ec8fe474837a8b48422e153537cb7e66

See more details on using hashes here.

File details

Details for the file dr_source-0.80.0-py3-none-any.whl.

File metadata

  • Download URL: dr_source-0.80.0-py3-none-any.whl
  • Upload date:
  • Size: 31.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for dr_source-0.80.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da53f32ca7fef946fc2309e531460b7ca02f3e475e19759225dcd1b5bbce8732
MD5 7769089ba6f78361fdf472a7cf71c56d
BLAKE2b-256 9396935bfb503c1922c78e68e4e4d94c5aea936ad4420763739febc72cf2898a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page