PrivacyGuard : Your On-device ML-powered phishing defense with privacy-first P2P threat sharing and homograph detection.
PrivacyGuard is an intelligent browser extension that protects users from phishing attacks and malicious websites using advanced machine learning, heuristic analysis, and homograph detection. Built with privacy-first principles, all analysis happens locally in your browserโno data ever leaves your device.
- Custom TensorFlow.js Model: Trained on 100k+ samples with 88.8% accuracy
- 16 URL Features: Real-time analysis of lexical patterns and suspicious traits
- On-Device Processing: Complete privacy - no data sent to servers
- Sub-500ms Analysis: Fast threat assessment
- ๐ด Red Alert: Full-page warnings for high-risk sites (>75 risk score)
- ๐ก Yellow Alert: Non-intrusive notifications for suspicious sites (30-75 score)
- ๐ข Green Status: Silent monitoring for safe sites (<30 score)
- Homograph Detection: Catches Unicode/Punycode spoofing attacks
- Heuristic Analysis: Flags suspicious URL patterns and forms
- P2P Intelligence: Community-driven threat sharing (mock implementation)
- Smart Whitelisting: Learn from your browsing preferences
Trained and validated using comprehensive datasets:
Dataset Sources:
โโโ Primary: github.com/ebubekirbbr/dephides (~100k samples)
โโโ Secondary: IEEE DataPort phishing dataset (validation)
Results:
โโโ Accuracy: 88.88%
- Analysis Speed: 450ms average per URL
- Memory Usage: ~15MB additional browser memory
- CPU Impact: <2% during analysis
- Model Loading: 1.8s (cached after first load)
PrivacyGuard/
โโโ js/
โ โโโ content.js # Main analysis engine & alert system
โ โโโ tf.min.js # TensorFlow.js runtime
โ โโโ tfjs_model/ # Trained ML model files
โโโ popup/
โ โโโ popup.html # Extension interface
โ โโโ popup.js # UI logic & controls
โ โโโ popup.css # Styling
โโโ manifest.json # Extension configuration
โโโ icons/ # Extension icons
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Browser Extension โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Content โ โ Popup โ โ Background โ โ
โ โ Script โ โ Interface โ โ Service โ โ
โ โ โ โ โ โ โ โ
โ โ โข ML Model โ โ โข Risk โ โ โข Storage Mgmt โ โ
โ โ โข Heuristicsโ โ Display โ โ โข Settings โ โ
โ โ โข Homograph โ โ โข Controls โ โ โข P2P Simulation โ โ
โ โ โข Alerts โ โ โข Analytics โ โ โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Detection Engines โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ML โ โ Heuristic โ โ Homograph โ โ
โ โ Engine โ โ Analysis โ โ Detection โ โ
โ โ โ โ โ โ โ โ
โ โ โข 16 URL โ โ โข HTTPS โ โ โข Punycode โ โ
โ โ Features โ โ Check โ โ โข Mixed Scripts โ โ
โ โ โข TF.js โ โ โข Form โ โ โข Confusables โ โ
โ โ Model โ โ Detection โ โ โข Unicode Analysis โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// Isolated CSS to prevent conflicts
const createAlert = (riskData) => {
const container = document.createElement('div');
const shadow = container.attachShadow({mode: 'closed'});
shadow.innerHTML = `
<style>
.privacy-guard-alert {
position: fixed; z-index: 2147483647;
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
/* Fully isolated styles */
}
</style>
${getAlertHTML(riskData)}
`;
document.body.appendChild(container);
};
git clone https://github.com/yourusername/PrivacyGuard.git
cd PrivacyGuard
- Open
chrome://extensions/
- Enable Developer Mode (top right)
- Click "Load unpacked"
- Select the
PrivacyGuard
folder - Pin the extension icon for easy access
# Serve test files locally
python -m http.server 8000
# Test URLs:
http://localhost:8000/college.html # Yellow alert (HTTP)
http://www.xn--pypal-4ve.com/ # Red alert (Homograph)
https://www.google.com # Green (Safe)
// Check whitelist
chrome.storage.local.get('privacyGuardWhitelist', console.log);
// View P2P data
chrome.storage.local.get(['privacyGuardP2PUserPhishing', 'privacyGuardP2PUserSafe'], console.log);
// Manual analysis
analyzeCurrentURL().then(console.log);
// Add to phishing list
const p2pSettings = await new Promise(resolve => {
chrome.storage.local.get([P2P_ENABLED_KEY, P2P_USER_CONFIRMED_SAFE_KEY, P2P_USER_CONFIRMED_PHISHING_KEY], result => resolve(result));
});
-
Primary Dataset: github.com/ebubekirbbr/dephides
- ~100,000 balanced samples (legitimate + phishing URLs)
- Combined from PhishTank, Tranco rankings, academic sources
-
Validation Dataset: Tranco
- Curated academic dataset for cross-validation
- Used for performance benchmarking
# 16 lexical features extracted from URLs
const featureDescriptions = [
"1. length",
"2. hostname_length",
"3. path_length",
"4. query_length",
"5. num_dots",
"6. num_hyphens",
"7. num_at",
"8. num_question_marks",
"9. num_equals",
"10. num_underscore",
"11. num_percent",
"12. num_slash",
"13. has_https",
"14. has_ip",
"15. num_digits",
"16. num_let_
Visit: https://www.google.com
Result: ๐ข Green status, no alerts
Popup: Shows low risk score, clean analysis
Visit: http://localhost:8000/college.html
Result: ๐ก Yellow corner alert appears
Action: Choose "Trust", "Block", or "Details"
Visit: http://www.xn--pypal-4ve.com/ (fake PayPal)
Result: ๐ด Full-page red warning blocks access
Reason: Punycode homograph detection triggered
Visit: Your phishing.html test file
Result: ๐ด Red alert based on ML model + heuristics
Details: High-risk features identified and scored
- โ Fixed ML Score Inversion: Corrected risk calculation bug
- โ Enhanced Shadow DOM: Complete CSS isolation for alerts
- โ Improved Homograph Detection: Better Unicode analysis
- โ Performance Optimization: Faster model loading and inference
- โ Enhanced P2P Mock: More realistic community simulation
- Alert positioning issues on responsive sites
- Memory leaks in model tensor operations
- Edge cases in URL feature extraction
- Improved error handling for malformed URLs
- Enhanced ML Model: Retrain with larger, more diverse dataset
- Dark Mode Support: UI themes for better user experience
- Advanced Analytics: Detailed threat statistics and trends
- Export/Import Settings: Backup and sync user preferences
- Model Size: ~2MB addition to extension size
- Feature Scope: Currently limited to lexical URL features
- Browser Support: Optimized for Chromium-based browsers
- P2P System: Currently mock implementation using local storage
- Sophisticated Attacks: May miss advanced social engineering
- Content-based Phishing: Limited analysis of page content beyond forms
- Zero-day Threats: Effectiveness depends on training data coverage
- Language Support: Homograph detection primarily covers Latin scripts
- False Positives: ~5.8% rate may require manual whitelisting
- Alert Fatigue: Balance between security and usability
- Performance: Slight delays possible on resource-constrained devices
We welcome contributions! Here's how to get involved:
- Use GitHub Issues for bugs and feature requests
- Include browser version, extension version, and reproduction steps
- Screenshots of alerts/console output are helpful
# Fork the repository
git clone https://github.com/yourusername/PrivacyGuard.git
cd PrivacyGuard
# Create feature branch
git checkout -b feature/your-feature-name
# Make changes and test thoroughly
# Submit pull request with detailed description
- Improve README sections
- Add code comments and examples
- Create user guides and tutorials
This project is licensed under the MIT License - see the LICENSE file for details.
- Datasets: ebubekirbbr/dephides and Tranco
- ML Framework: TensorFlow.js team for browser-based ML capabilities
- UI Framework: Minimal custom CSS with Shadow DOM for isolation
- Community: Beta testers and security researchers who provided feedback
- Issues: Report bugs on GitHub Issues
- Discussions: Join GitHub Discussions
- Email: [email protected]
- Twitter: @AdityaPat_
- LinkedIn: Aditya Pattanayak
โญ Star this repository if PrivacyGuard helps keep you safe online! โญ
Built with ๐ for safer browsing | Protecting privacy while fighting phishing