This script demonstrates PhishLens without visiting suspicious external sites or using a real PhishTank key.
Start the backend with the local demo threat source enabled:
$env:PHISHLENS_ENABLE_DEMO_THREAT_SOURCE="true"
.\.venv\Scripts\python.exe -m uvicorn app.main:app --app-dir backend --reload
Start the local demo pages in a second terminal:
python demo/serve_demo.py
Build and load the extension:
cd extension
npm install
npm run build
Load extension/dist from chrome://extensions with Developer mode enabled.
Open PhishLens settings from the popup and confirm:
http://localhost:8000.2500.Open http://localhost:8080/pages/safe.html.
Confirm a low-risk result and the Backend enriched state.
Open http://localhost:8080/pages/suspicious.html.
Confirm the popup explains form, iframe, or external-link signals and shows category scores such as URL, Page structure, TLS, Threat intelligence, and ML.
Open http://localhost:8080/pages/phishlens-demo-dangerous-login-secure-update.html.
Confirm the final label is dangerous and the dismissible overlay appears.
Stop the backend and reopen the popup on a demo page.
Confirm the analysis still works and the UI shows Backend unavailable.
Restart the backend and use popup feedback:
Mark as safe for suspected false positives.Mark as phishing for suspected false negatives.Use Copy report.
Confirm the copied text contains host-level context and excludes full URLs, form values, page text, cookies, screenshots, and HTML.
Inspect diagnostics:
curl http://localhost:8000/diagnostics
Confirm the payload contains counters only, not URLs or page content.
Inspect the structured analyze response:
curl -X POST http://localhost:8000/analyze `
-H "Content-Type: application/json" `
-d "{\"url\":\"http://localhost:8080/pages/suspicious.html\",\"dom_features\":{\"has_password_field\":true,\"num_forms\":1,\"external_form_action\":false,\"num_iframes\":1,\"external_links_ratio\":0.2,\"has_hidden_inputs\":true}}"
Confirm risk_breakdown includes URL, DOM, threat intelligence, TLS, and ML entries with category scores and caps.
risk_breakdown, while reasons remains for compatibility.