An AI-powered system for detecting online scams and suspicious content. Uses Ollama with Llama3.2-vision for image analysis.
- AI-Based Analysis: Utilizes Llama3.2-vision for precise scam detection
- Modern Web UI: Responsive design with drag & drop upload
- Production-Ready: Docker-based deployment with Nginx
- Comprehensive Analysis: Score from 0β100 with detailed explanation
- Multiple Scam Types: Detects phishing, fake shops, tech support scams, and more
- Security: Rate limiting, input validation, secure headers
- Python 3.11+
- Node.js (optional, for frontend development)
- Ollama with Llama3.2-vision model
- Docker & Docker Compose
- Ollama (runs on the host system)
Install Ollama from ollama.ai and download the model:
# Install Ollama (according to your OS)
curl -fsSL https://ollama.ai/install.sh | sh
# Download the Llama3.2-vision model
ollama pull llama3.2-vision
# Start the Ollama server (runs on port 11434)
ollama servegit clone <your-repo-url>
cd scam-detectorcd backend
pip install -r requirements.txt
python -m app.mainThe backend runs at: http://localhost:8000
Open frontend/index.html directly in your browser, or use a local server:
cd frontend
python -m http.server 3000
# or
npx serve .# Start all services
docker-compose up -d
# Or only core services (without monitoring)
docker-compose up -d scam-detector-api nginx
# Show logs
docker-compose logs -f scam-detector-api
# Stop services
docker-compose downThe application is available at:
- Frontend: http://localhost
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs
OLLAMA_BASE_URL=http://localhost:11434 # Ollama server URL
MODEL_NAME=llama3.2-vision # Used model
LOG_LEVEL=INFO # Logging level// Set API base URL
this.apiBaseUrl = 'http://localhost:8000';Edit nginx.conf for production use:
- Configure SSL certificates
- Add domain-specific settings
- Adjust rate-limiting
Health check for service status
Response:
{
"status": "healthy",
"ollama_connected": true,
"model": "llama3.2-vision"
}Image analysis for scam detection
Request:
- Content-Type:
multipart/form-data - Body:
file(image file, max 10MB)
Response:
{
"score": 85,
"explanation": "The image shows a suspicious email with...",
"risk_level": "HIGH",
"confidence": 0.92
}LOW: Score 0β25MEDIUM: Score 26β50HIGH: Score 51β75VERY_HIGH: Score 76β100
- Upload image: Drag and drop an image or use the file picker
- Check preview: Review the uploaded image
- Start analysis: Click the βAnalyzeβ button
- Interpret results: Review the score, risk level, and explanation
import requests
# Analyze image
with open('suspicious_image.png', 'rb') as f:
response = requests.post(
'http://localhost:8000/analyze',
files={'file': f}
)
result = response.json()
print(f"Scam Score: {result['score']}/100")scam-detector/
βββ backend/ # FastAPI Backend
β βββ app/
β β βββ main.py # Main API code
β βββ requirements.txt # Python dependencies
β βββ Dockerfile # Backend container
βββ frontend/ # Web frontend
β βββ index.html # Main HTML
β βββ styles.css # CSS styling
β βββ script.js # JavaScript logic
βββ docker-compose.yml # Container orchestration
βββ nginx.conf # Webserver configuration
βββ README.md # This file
- Follows PEP 8
- Uses type hints
- Async/await for I/O operations
- Structured logging
- ES6+ features
- Modular classes
- Error handling
- Accessibility considerations
# Backend tests
cd backend
pytest
# Frontend tests (if implemented)
cd frontend
npm testEnable monitoring stack:
# With Prometheus & Grafana
docker-compose --profile monitoring up -d
# Access:
# - Prometheus: http://localhost:9090
# - Grafana: http://localhost:3000 (admin/admin)# Backend logs
docker-compose logs -f scam-detector-api
# Nginx logs
docker-compose logs -f nginx
# All logs
docker-compose logs -f- Input Validation: File type and size check
- Rate Limiting: Prevents abuse
- CORS Policy: Controlled cross-origin requests
- Security Headers: XSS and clickjacking protection
- No Data Storage: Images are not saved
- Set up HTTPS (SSL certificates)
- Configure firewall
- Apply regular updates
- Define backup strategies
# Check Ollama status
ollama list
# Is the model available?
ollama pull llama3.2-vision
# Is the server running?
curl http://localhost:11434/api/tags# Check container status
docker-compose ps
# Backend logs
docker-compose logs scam-detector-api
# Check network
docker network ls- Enable GPU support in Ollama
- Allocate more RAM to Docker
- Optimize model parameters
# GPU support (NVIDIA)
docker run --gpus all ollama/ollama
# Allocate more memory
OLLAMA_HOST=0.0.0.0:11434 OLLAMA_MODELS=/path/to/models ollama serve- Increase Gunicorn workers
- Implement Redis caching
- Optimize image compression
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push the branch (
git push origin feature/amazing-feature) - Open a pull request
This project is licensed under the MIT License β see LICENSE for details.
- Issues: Use GitHub Issues for bug reports
- Discussions: Use GitHub Discussions for general questions
- Security: Report security issues privately
- Multi-language support
- Per-user API rate limiting
- Extended scam categories
- Batch processing
- Mobile app
- Browser plugin
- Performance optimization
- Extended testing
- CI/CD pipeline
- Kubernetes deployment
- Enhanced monitoring
Important Note: This software is an aid for scam detection. Results are recommendations, not guarantees. Always consult security experts or authorities when in doubt.