Skip to content
tanzimulalamPublic

About

Chrome Extension

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

πŸ›‘οΈ PhishNet β€” AI-Powered Phishing Detection Chrome Extension

PhishNet is a Chrome browser extension that combines local heuristic analysis, VirusTotal threat intelligence, and Google Gemini AI to detect phishing websites and scam emails in real time. It scans every page you visit and every email you open in Gmail β€” providing instant, actionable risk assessments right in your browser.


πŸ“¦ Installation & Setup

Prerequisites

  • Node.js v18 or later β€” Download
  • npm (comes with Node.js)
  • Google Chrome browser

1. Install Dependencies

Open a terminal in the project root and run:

npm install

This installs all required packages including Plasmo, React, TypeScript, and Chrome type definitions.

2. Build the Extension

For a production build:

npm run build

This creates the compiled extension in the build/chrome-mv3-prod folder.

For development mode (auto-reloads on code changes):

npm run dev

This creates a development build in build/chrome-mv3-dev and watches for file changes.

3. Load into Chrome

  1. Open Chrome and navigate to chrome://extensions/
  2. Enable Developer mode (toggle in the top-right corner)
  3. Click "Load unpacked"
  4. Select the build folder:
    • Production: build/chrome-mv3-prod
    • Development: build/chrome-mv3-dev
  5. The PhishNet icon (πŸ›‘οΈ) will appear in your Chrome toolbar
  6. Pin it by clicking the puzzle-piece icon in the toolbar β†’ Pin

4. Configure API Keys

Click the PhishNet icon β†’ βš™οΈ Settings gear icon β†’ Fill in:

Setting Required? Purpose
VirusTotal API Key Recommended Threat intelligence from 90+ antivirus engines
Gemini API Key Recommended AI-powered analysis and chat
AI Provider Optional Choose between Gemini (default) or OpenAI
Gmail Scanning Optional Toggle email scanning on/off

πŸš€ Features

πŸ” Instant URL Scanning

Every webpage you visit is automatically analyzed using 15+ local heuristics β€” no API calls needed for the initial scan. Checks include:

  • Suspicious TLDs (.tk, .ml, .xyz, etc.)
  • IP-based URLs and excessive subdomains
  • URL length anomalies and encoded characters
  • Login forms with external form actions
  • Missing HTTPS, data URIs, and homoglyph attacks

πŸ§ͺ Deep Scan (VirusTotal + AI)

Click "Deep Scan" for a comprehensive multi-stage analysis:

  1. VirusTotal URL Lookup β€” checks against 90+ antivirus engines
  2. VirusTotal Domain Lookup β€” domain reputation, registrar, creation date
  3. DNS Resolution + IP Lookup β€” resolves the domain, checks if the server IP is flagged
  4. AI Analysis β€” sends all evidence to Gemini for an expert-level verdict

πŸ“Š Risk Score with Smart Merging

The risk gauge at the top dynamically updates after deep scan:

  • Combines local heuristics, VirusTotal flags, and AI verdict
  • Uses the most severe finding as the final risk level
  • Includes a post-AI safety net: if VirusTotal says a site is clean (0 malicious engines, 50+ harmless) but AI hallucinated a danger, the verdict is automatically corrected

πŸ“§ Gmail Email Scanning

When you open an email in Gmail, PhishNet automatically:

  • Extracts sender, subject, body text, and all embedded links
  • Runs 11 heuristic checks: sender spoofing, display-name mismatch, phishing keywords, urgency language, suspicious link TLDs, URL shorteners, and more
  • Shows a floating indicator panel in the bottom-right:
    • βœ… Green = Safe (auto-dismisses after 4 seconds)
    • ⚠️ Yellow = Suspicious (persists with indicator details)
    • 🚨 Red = Dangerous (persists with full threat breakdown)

πŸ’¬ AI Chat

Built-in chat tab powered by Gemini or OpenAI:

  • Ask questions about the current page's security
  • Get explanations of specific threats in plain English
  • Context-aware: the AI knows the current URL and scan results

πŸ—ΊοΈ Intel Tab

A dedicated intelligence dashboard with:

  • Server Location Map β€” Real OpenStreetMap tiles showing where the server is hosted, with precise geolocation via ipinfo.io and a pulsing red crosshair marker
  • Threat DNA Fingerprint β€” A unique barcode-style visualization of the threat pattern, with an "Explain by AI" button that calls Gemini to explain what the pattern means
  • Threat Profile Card β€” Six animated progress bars showing threat levels across URL, Page Content, VirusTotal, Domain Health, Network Trust, and AI Confidence
  • Security Report Generator β€” Creates a rich, printable HTML report with all findings, embedded map, VirusTotal data table, and AI analysis

βš™οΈ Settings & Customization

Full settings page with:

  • API key management (VirusTotal, Gemini, OpenAI)
  • AI model selection (Gemini 2.0 Flash, GPT-4o-mini, etc.)
  • Gmail scanning toggle
  • Notification preferences

πŸ› οΈ Technology Stack

Core Framework

Technology Version Purpose
Plasmo 0.90.5 Chrome extension framework β€” handles manifest generation, content scripts, background workers, and hot-reload during development. Eliminates the boilerplate of raw Chrome extension development.
React 18.2.0 Component-based UI for the popup, settings page, and all interactive elements. Enables reactive state management for real-time scan result updates.
TypeScript 5.3.3 Static typing across the entire codebase β€” catches bugs at compile time, provides better IDE support, and makes the code self-documenting.

External APIs

Service How It's Used
VirusTotal API URL reputation check (90+ engines), domain WHOIS data (registrar, creation date, reputation score), IP geolocation and malicious flagging. Provides the hard data that grounds the AI analysis.
Google Gemini API AI-powered threat analysis, chat, and DNA fingerprint explanation. Acts as the "expert brain" that synthesizes all evidence into a human-readable verdict.
OpenAI API Alternative AI provider (GPT-4o-mini) β€” users can choose their preferred AI backend.
ipinfo.io Precise IP geolocation (latitude/longitude + city) for the server location map. Free tier, no API key required.
Google DNS-over-HTTPS Resolves domain names to IP addresses for the IP lookup stage of deep scan β€” avoids CORS issues with traditional DNS.
OpenStreetMap Map tile images for the server location visualization. Free, open-source map data.

Chrome APIs Used

API Purpose
chrome.tabs Get active tab URL and inject content scripts
chrome.storage Persist settings (API keys, preferences) and chat history
chrome.scripting Execute page analysis scripts in the active tab
chrome.contextMenus Right-click menu integration
chrome.notifications System notifications for threat alerts

πŸ€– How Gemini AI Makes PhishNet Better

1. Expert-Level Threat Analysis

Local heuristics can detect surface-level red flags (suspicious TLD, long URL), but they lack contextual understanding. Gemini receives ALL evidence β€” VirusTotal results, local indicators, domain metadata, email context β€” and acts as a cybersecurity expert that weighs everything together.

For example, a login form on paypal.com is normal. A login form on paypa1-secure.xyz is phishing. Only an AI can make this contextual distinction β€” pure heuristics would flag both equally.

2. Intelligent Chat Assistant

The chat tab turns PhishNet from a passive scanner into an interactive security advisor. Users can ask:

  • "Is this email safe to click?"
  • "What does 'domain reputation -78' mean?"
  • "Should I enter my credit card on this site?"

Gemini responds with context-aware, plain-English explanations β€” making cybersecurity accessible to non-technical users.

3. Threat DNA Explanation

The DNA fingerprint is a visual pattern, but it means nothing without interpretation. The "Explain by AI" button calls Gemini to analyze the specific indicators and explain:

  • What type of attack this resembles
  • Why the fingerprint pattern looks the way it does
  • What the user should do

4. Accuracy Safeguards

The AI prompt is carefully calibrated with 8 explicit rules that prevent false positives:

  • "If VirusTotal shows 0 malicious engines, the verdict MUST be safe"
  • "Login forms on established domains are completely normal"
  • A post-AI override system catches any remaining hallucinations by cross-checking the AI verdict against hard VirusTotal data

5. Report Generation Intelligence

The generated HTML security report includes the AI's full analysis β€” verdict, confidence percentage, primary reason, and detailed explanation β€” alongside all other data, creating a comprehensive, shareable document that IT teams can use for incident response.


πŸ“ Project Structure

phish-net/
β”œβ”€β”€ popup.tsx                  # Main extension popup (Scan, Chat, Intel tabs)
β”œβ”€β”€ popup.css                  # All popup styles (1300+ lines)
β”œβ”€β”€ options.tsx                # Settings page
β”œβ”€β”€ options.css                # Settings page styles
β”œβ”€β”€ background.ts              # Service worker (context menus, notifications, messaging)
β”œβ”€β”€ content.ts                 # Content script injected into all pages
β”œβ”€β”€ contents/
β”‚   └── gmail.tsx              # Gmail content script (email scanning + floating panel)
β”œβ”€β”€ components/
β”‚   └── InsightsTab.tsx        # Intel tab components (WorldMap, DnaFingerprint, ReportCard)
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ phishingDetector.ts    # Local URL heuristic analysis (15+ checks)
β”‚   β”œβ”€β”€ deepScan.ts            # Deep scan orchestrator (VT + AI + prompt builder)
β”‚   β”œβ”€β”€ chat.ts                # AI chat integration (Gemini + OpenAI)
β”‚   └── storage.ts             # Chrome storage wrapper for settings
β”œβ”€β”€ assets/
β”‚   └── icon.png               # Extension icon
β”œβ”€β”€ package.json               # Dependencies, scripts, and manifest config
└── tsconfig.json              # TypeScript configuration

πŸ“ Additional Notes

Privacy & Security

  • All API keys are stored locally in Chrome's chrome.storage.sync β€” never sent to any third-party server except the respective API endpoints
  • No user data is collected β€” scan results are stored in session storage and cleared when Chrome closes
  • All network requests go directly to official API endpoints (VirusTotal, Google AI, ipinfo.io) β€” no middleman servers

Performance

  • Initial scan is instant (< 50ms) β€” runs entirely locally using URL pattern matching
  • Deep scan takes 3-8 seconds depending on API response times
  • Gmail scanning runs on a MutationObserver, triggering only when you open a new email
  • The extension popup is lightweight at ~33KB CSS + ~31KB TSX

Browser Compatibility

  • Built for Chrome (Manifest V3) β€” the latest extension platform
  • Compatible with all Chromium-based browsers (Edge, Brave, Arc, Opera)
  • Requires Chrome 88+ for Manifest V3 support

Rate Limits

  • VirusTotal free tier: 4 requests/minute, 500 requests/day
  • Gemini free tier: 15 requests/minute, 1500 requests/day
  • ipinfo.io free tier: 50,000 requests/month
  • PhishNet gracefully handles rate limits and API errors with fallback behavior

πŸ“œ License

This project is created by [email protected].


Built with ❀️ by Faim; using React, TypeScript, Plasmo, and Google Gemini AI.

About

Chrome Extension

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages