Open-Source Static Analysis for Privacy Data Flows
Project description
truScanner from truConsent
Open-Source Static Analysis for Privacy Data Flows
truScanner is a static code analysis tool designed to discover and analyze personal data elements in your source code. It helps developers and security teams identify privacy-related data flows and generate comprehensive reports.
๐ฆ PyPI Project โข ๐ App Dashboard
๐ Features
- Comprehensive Detection: Identifies 300+ personal data elements (PII, financial data, device identifiers, etc.)
- Interactive Menu: Arrow-key navigable menu for selecting output formats
- Real-time Progress: Visual progress indicator during scanning
- Multiple Report Formats: Generate reports in TXT, Markdown, or JSON format
- AI-Powered Enhancement: Optional integration with Ollama or OpenAI for deeper context
- Backend Integration: Optional upload to backend API for centralized storage
- Auto-incrementing Reports: Automatically manages report file naming to prevent overwrites
truScanner CLI
๐ฆ Installation
Prerequisites
- Python 3.9 or higher
- ollama (optional, for local AI scanning)
Quick Install
Using pip:
pip install truscanner
Using uv:
uv pip install truscanner
Verify installation:
truscanner --help
๐ ๏ธ Usage
Basic Usage
Scan a directory with the interactive menu:
truscanner scan <directory_path>
Example
truscanner scan ./src
truscanner scan ./my-project
truscanner scan C:\Users\username\projects\my-app
Interactive Workflow
-
Select Output Format:
- Use arrow keys (โโ) to navigate
- Press Enter to select
- Options:
txt,md,json, orAll(generates all three formats)
-
Scanning Progress:
- Real-time progress bar shows file count and percentage
- Example:
Scanning: 50/200 (25%) [โโโโโโโโโโโโโโโโโโโโ] filename.js
-
AI Enhanced Scan (Optional):
- After the initial scan, you'll be prompted:
Do you want to use Ollama/AI for enhanced PII detection (find what regex missed)? (Y, N): - This uses local LLMs (via Ollama) or OpenAI to find complex PII.
- Live scanning timer:
AI Scanning: filename.js... (5.2s taken)
- After the initial scan, you'll be prompted:
-
Report Generation:
- Reports are saved in
reports/{directory_name}/folder - Files are named:
truscan_report.txt,truscan_report.md,truscan_report.json - Subsequent scans auto-increment:
truscan_report1.txt,truscan_report2.txt, etc. - AI findings are saved with
_llmsuffix.
- Reports are saved in
-
Backend Upload (Optional):
- After reports are saved, you'll be prompted:
Do you want to upload the scan report for the above purpose? (Y, N): - Enter
Yto upload scan results to backend API - View your uploaded scans and analytics at app.truconsent.io
- After reports are saved, you'll be prompted:
Command Options
truscanner scan <directory> [OPTIONS]
Options:
--with-ai Enable AI/LLM scanner directly
--ai-mode AI scan mode: fast, balanced, or full (default: balanced)
--personal-only Only report personal identifiable information (PII)
--help Show help message
AI Speed vs Coverage Modes
Use --ai-mode to control AI scan behavior:
fast: Small prompts, fastest runtime, may skip very large low-signal filesbalanced(default): Good speed while keeping broad file coveragefull: Largest context and highest coverage, slowest runtime
Examples:
truscanner scan ./src --ai-mode fast
truscanner scan ./src --ai-mode balanced
truscanner scan ./src --ai-mode full
๐ Report Output
Report Location
Reports are saved in: reports/{sanitized_directory_name}/
Report Formats
- TXT Report (
truscan_report.txt): Plain text format, easy to read - Markdown Report (
truscan_report.md): Formatted markdown with headers and code blocks - JSON Report (
truscan_report.json): Structured JSON data for programmatic access
Report Contents
Each report includes:
- Scan Report ID: Unique 32-bit hash identifier
- Summary: Total findings, time taken, files scanned
- Findings by File: Detailed list of data elements found in each file
- Summary by Category: Aggregated statistics by data category
Report ID
Each scan generates a unique Scan Report ID (32-bit MD5 hash) that:
- Appears in the terminal after scanning
- Is included at the top of all generated report files
- Can be used to track and reference specific scans
๐ง Configuration
The truscanner package is pre-configured with the live backend URL for seamless scan uploads. No additional configuration is required.
๐ Project Structure
truscanner/
โโโ src/
โ โโโ main.py # CLI entry point
โ โโโ regex_scanner.py # Core scanning engine
โ โโโ ai_scanner.py # AI/LLM scanning engine
โ โโโ report_utils.py # Report utilities
โ โโโ utils.py # Utilities
โโโ data_elements/ # Data element definitions
โโโ reports/ # Generated reports
โโโ pyproject.toml # Project configuration
โโโ README.md
๐ค Support
For issues, questions, or contributions, please contact: hello@truconsent.io
MIT License - see LICENSE file for details
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
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 truscanner-0.2.5.tar.gz.
File metadata
- Download URL: truscanner-0.2.5.tar.gz
- Upload date:
- Size: 36.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7009483e3122d41aee0dafff990b27e6a9120c37be74370df993384f672f120f
|
|
| MD5 |
0a95329ead257044a4984561a1dcbcb2
|
|
| BLAKE2b-256 |
6b5bba298f91e4fab8fdb99532f6fbaad1bbbd2032646b7d6f720245adf36de5
|
File details
Details for the file truscanner-0.2.5-py3-none-any.whl.
File metadata
- Download URL: truscanner-0.2.5-py3-none-any.whl
- Upload date:
- Size: 49.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
167b9ece4fca0856a0e95acd0adf5ddcef49549cf37d47f4e9665e4560a1afc2
|
|
| MD5 |
d400da49f9c58abe5a4fc37139ebdf36
|
|
| BLAKE2b-256 |
e98ff0702b87a3291e288965516c66fef5b21dcc3e9b778983ef1167151339d7
|