AI-powered scam detection that investigates suspicious messages, analyzes evidence, and explains the risk before you take action.
TrustLens is an AI-powered scam investigation platform designed to help users identify potentially fraudulent emails, SMS messages, job offers, scholarship messages, banking alerts, delivery notifications, social media messages, and suspicious URLs.
Instead of simply returning "SCAM" or "NOT SCAM", TrustLens combines traditional NLP, machine learning, LLM-based analysis, URL intelligence, and rule-based security signals to provide an explainable risk assessment.
Online scams are becoming increasingly convincing.
Attackers commonly use:
- Fake internship and job offers
- Fake bank/KYC alerts
- Scholarship scams
- Delivery/payment scams
- Fake investment opportunities
- Account verification messages
- OTP and credential requests
- Urgent payment requests
- Impersonation of companies or organizations
The problem is not just detecting a scam — users need to understand why a message is suspicious and what they should do next.
TrustLens analyzes suspicious content through multiple layers:
User Message / URL
│
▼
┌─────────────────┐
│ Text Processing │
└────────┬────────┘
│
┌──────────┴──────────┐
▼ ▼
Traditional ML LLM Analysis
TF-IDF + LR NLP Reasoning
│ │
└──────────┬──────────┘
▼
URL Analysis
│
▼
Security Signals
│
▼
Risk Engine
│
▼
┌────────────────────┐
│ Risk Score 0–100 │
└────────────────────┘
│
▼
Explanation + Evidence
│
▼
Recommendations
TrustLens uses a traditional NLP classifier based on:
- TF-IDF vectorization
- Unigrams and bigrams
- Logistic Regression
- Scam probability prediction
The ML model provides a quantitative signal that is combined with other analysis layers.
The LLM analyzes the meaning and context of the message to identify:
- Social engineering patterns
- Urgency and pressure tactics
- Payment requests
- OTP/password requests
- Impersonation
- Fake employment opportunities
- Financial manipulation
- Suspicious claims
- User intent
- Important entities
When a URL is present, TrustLens examines security-related characteristics such as:
- Domain
- Subdomain
- TLD
- HTTPS usage
- URL length
- Suspicious characters
- IP-based hostnames
- Punycode
- Excessive subdomains
- Domain mismatches
- Redirect behavior
TrustLens does not execute downloaded code or unsafe content.
The Risk Engine combines different signals and produces:
Risk Score: 0–100
LOW → Lower observed risk
MODERATE → Some suspicious indicators
HIGH → Multiple strong indicators
CRITICAL → Strong evidence of potentially malicious behavior
The result includes the factors contributing to the score instead of hiding the reasoning behind a single prediction.
TrustLens can provide:
- Risk score
- Risk level
- ML prediction
- ML probability
- Suspicious signals
- Evidence
- Extracted entities
- Claims
- URL findings
- Context/category
- Recommendations
- Confidence
- Limitations
- React
- Vite
- JavaScript
- CSS
- Python
- FastAPI
- Pydantic
- Uvicorn
- NLP
- TF-IDF
- Logistic Regression
- LLM-based analysis
- Rule-based security analysis
- URL parsing
- Domain analysis
- Suspicious URL heuristics
- Security signal detection
TrustLens/
│
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ ├── pages/
│ │ ├── services/
│ │ ├── hooks/
│ │ ├── utils/
│ │ ├── styles/
│ │ ├── App.jsx
│ │ └── main.jsx
│ └── package.json
│
├── backend/
│ ├── agents/
│ │ ├── message_analyzer.py
│ │ ├── url_analyzer.py
│ │ ├── claim_verifier.py
│ │ ├── context_analyzer.py
│ │ └── risk_engine.py
│ │
│ ├── api/
│ │ └── routes.py
│ │
│ ├── core/
│ │ ├── config.py
│ │ └── logging_config.py
│ │
│ ├── models/
│ │ └── schemas.py
│ │
│ ├── services/
│ │ └── analysis_service.py
│ │
│ ├── ml/
│ │ ├── train_model.py
│ │ ├── predict.py
│ │ ├── vectorizer.pkl
│ │ └── scam_classifier.pkl
│ │
│ ├── main.py
│ ├── requirements.txt
│ └── .env.example
│
├── data/
│ └── examples/
│
├── evaluation/
│ ├── benchmark.py
│ └── results.md
│
├── tests/
│ ├── test_analyzer.py
│ ├── test_risk_engine.py
│ └── test_api.py
│
├── docs/
│ ├── architecture.md
│ ├── ai_disclosure.md
│ └── demo.md
│
├── README.md
└── .gitignore
The user pastes a suspicious message or URL.
Example:
Congratulations! You have been selected for a Google internship.
Pay ₹3,999 as a refundable verification fee to confirm your position.
Complete verification at:
https://example-suspicious-domain.com
The text is converted into TF-IDF features.
Message
↓
TF-IDF
↓
Logistic Regression
↓
Scam Probability
The LLM analyzes the semantic meaning and identifies suspicious patterns such as:
- Fake recruitment claims
- Payment requests
- Urgency
- Impersonation
- Credential or financial requests
If a URL exists, TrustLens analyzes its structure and domain-related indicators.
The different signals are combined:
ML Prediction
+
LLM Analysis
+
URL Signals
+
Rule-Based Signals
+
Context
↓
Risk Engine
↓
Final Risk Score
The user receives an investigation report rather than only a binary classification.
URGENT: Your bank account will be blocked today.
Verify your account immediately by entering your OTP and password:
https://suspicious-example.com
Risk Score: 96/100
Risk Level: CRITICAL
Suspicious Signals:
✓ Requests OTP
✓ Requests password
✓ Uses urgent language
✓ Threatens account suspension
✓ Contains suspicious URL
Recommendation:
Do not enter your credentials or OTP.
Contact your bank through its official website or app.
git clone <YOUR_GITHUB_REPOSITORY_URL>
cd TrustLenscd backend
python -m venv venv
.\venv\Scripts\Activate.ps1
pip install -r requirements.txtIf PowerShell blocks virtual environment activation:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserThen:
.\venv\Scripts\Activate.ps1Create a .env file inside the backend directory.
Example:
LLM_API_KEY=your_api_key_hereNever commit your real API key to GitHub.
The repository contains .env.example instead.
uvicorn main:app --reloadBackend will run at:
http://127.0.0.1:8000
API documentation:
http://127.0.0.1:8000/docs
Open another terminal:
cd frontend
npm install
npm run devOpen the URL shown by Vite, usually:
http://localhost:5173
GET /api/healthChecks whether the backend is running.
POST /api/analyzeAnalyzes a suspicious message.
Example request:
{
"text": "Your account will be blocked. Verify your OTP immediately."
}POST /api/analyze-urlAnalyzes a URL for suspicious structural and security indicators.
TrustLens uses a lightweight supervised NLP pipeline:
Training Data
↓
Text Cleaning
↓
TF-IDF Vectorization
↓
Logistic Regression
↓
Scam Probability
This approach was selected because it is:
- Fast to train
- Lightweight
- Easy to interpret
- Suitable for text classification
- Easy to deploy
- A strong baseline for NLP classification
The model is used as one signal in the overall TrustLens investigation rather than being treated as the only source of truth.
TrustLens follows a multi-layer AI architecture:
┌───────────────┐
│ User Message │
└───────┬───────┘
│
┌───────────┴───────────┐
│ │
▼ ▼
Traditional NLP LLM Analysis
TF-IDF + LR Semantic Analysis
│ │
└───────────┬───────────┘
│
▼
URL Analyzer
│
▼
Context Analysis
│
▼
Risk Engine
│
▼
Explainable Report
TrustLens is an assistive analysis tool, not a definitive authority.
A high risk score does not automatically prove that a message is fraudulent, and a low score does not guarantee that a message is safe.
The system therefore provides:
- Evidence
- Suspicious signals
- Confidence
- Limitations
- Recommendations
Users should independently verify important communications through official channels.
For example, instead of clicking a link received through SMS, users should manually open the organization's official website or application.
TrustLens is designed to support multilingual scam analysis, including:
- English
- Hindi
- Marathi
This is important because scams frequently target users through regional languages and mixed-language communication.
Run backend tests with:
pytestThe test suite covers important components such as:
- Message analysis
- Risk scoring
- API behavior
- Security signal detection
Build the frontend with:
npm run buildThe traditional ML classifier can be evaluated using:
- Accuracy
- Precision
- Recall
- F1-score
For a scam detection system, precision and recall are especially important, because both false positives and false negatives can negatively affect users.
The training/evaluation dataset should be clearly identified in the project documentation, and benchmark results should not be presented as real-world performance unless evaluated on an appropriate real-world dataset.
TrustLens should not require users to expose sensitive credentials.
Never enter:
- Passwords
- OTPs
- Banking credentials
- API keys
- Private authentication tokens
into the application.
API keys are stored through environment variables and should never be committed to the repository.
AI-assisted development tools were used during the development of TrustLens.
Codex / AI coding assistance was used for:
- Project scaffolding
- Code generation
- Debugging
- Refactoring
- Documentation
- Test generation
- Development assistance
Generated code was reviewed, tested, and modified during development.
TrustLens itself uses AI/ML technologies as part of its application pipeline, including:
- TF-IDF + Logistic Regression for traditional NLP classification
- LLM-based natural language analysis
- Semantic investigation
- Context analysis
- Explainable risk assessment
Potential future improvements include:
- Browser extension for real-time website analysis
- Email integration
- SMS analysis
- WhatsApp/Telegram message analysis
- More multilingual models
- Reputation databases
- Domain age and registration intelligence
- Phishing webpage detection
- Screenshot/image-based scam detection
- Voice scam detection
- Continuous model retraining
- Human feedback-based learning
- Enterprise security integrations
TrustLens was built around a simple idea:
Before you trust the message, investigate it.
Our goal is to make scam detection more understandable, transparent, and useful by combining traditional NLP, machine learning, LLM reasoning, and security analysis into one investigation platform.
Vedant Shelake AI/ML • NLP • Backend • Full-Stack Development
This project is developed as a hackathon project.
Add an appropriate open-source license if you intend to distribute the project publicly.
Built for HyperBloom Hacks.
If you find the project interesting, consider ⭐ starring the repository.