Open-Source Static Analysis for Privacy Data Flows
Project description
truScanner
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.
๐ Features
- Comprehensive Detection: Identifies 110+ 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
- Backend Integration: Optional upload to backend API for centralized storage
- Auto-incrementing Reports: Automatically manages report file naming to prevent overwrites
๐ฆ Installation
Prerequisites
- Python 3.9 or higher
- pip or uv package manager
Install from Source
-
Clone or navigate to the truscanner directory:
cd truscanner
-
Install dependencies:
Using pip:
pip install -r requirements.txt
Or using uv:
uv pip install -e .
-
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
-
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.
- Reports are saved in
-
Backend Upload (Optional):
- After reports are saved, you'll be prompted:
Do you want to analyze? (Y/n): - Enter
Yto upload scan results to backend API - Requires
TRUSCANNER_BACKEND_URLin environment variables
- After reports are saved, you'll be prompted:
Command Options
truScanner scan <directory> [OPTIONS]
Options:
--with-presidio Enable Presidio NLP scanner (requires model download)
--with-ai Enable AI/LLM scanner (requires OPENAI_API_KEY)
--personal-only Only report personal identifiable information (PII)
--help Show help message
Examples with Options
# Scan with only PII data
truScanner scan ./src --personal-only
# Scan with Presidio NLP scanner
truScanner scan ./src --with-presidio
# Scan with AI/LLM scanner
truScanner scan ./src --with-ai
๐ 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
๐ง 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
โ โโโ report_utils.py # Report utilities
โ โโโ utils.py # Interactive menu & backend integration
โโโ data_elements/ # Data element definitions (JSON files)
โโโ Reports/ # Generated reports (created automatically)
โโโ requirements.txt # Python dependencies
โโโ README.md
๐ Troubleshooting
Interactive Menu Not Working
If the arrow-key menu doesn't appear, ensure inquirer is installed:
pip install inquirer
Backend Upload Fails
- Verify network connectivity to the internet
- Check if the backend server is currently under maintenance
No Reports Generated
- Ensure you have write permissions in the current directory
- Check that the directory you're scanning contains readable files
- Verify Python version is 3.9 or higher
๐ License
MIT License - see LICENSE file for details
๐ค Support
For issues, questions, or contributions, please contact: hello@truconsent.io
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.3.tar.gz.
File metadata
- Download URL: truscanner-0.2.3.tar.gz
- Upload date:
- Size: 30.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd1bb2c9f08df3878c54b22feed29553016eec17f6ed7444578ce067a1b96650
|
|
| MD5 |
9476bad9e1e60c25ee3ef45065a2905e
|
|
| BLAKE2b-256 |
72fa60ca52aac1d1b3403dc3f012f9f20cf0e110528949ef6e5ce8752f65fb20
|
File details
Details for the file truscanner-0.2.3-py3-none-any.whl.
File metadata
- Download URL: truscanner-0.2.3-py3-none-any.whl
- Upload date:
- Size: 42.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba6f46d00afa3588c6fb5fed1e6971ace7d62889b2564891323170fa791aa42a
|
|
| MD5 |
7c7dec1b9cfa5cd55e7a677bc9bed3b8
|
|
| BLAKE2b-256 |
791c8ac38782a270671206cc1c6df760a5aaa42c50ea35518c8bb456c919c097
|