"The internet is full of traps. We built the detector."
Dark Pattern Detective is an AI-powered forensic tool designed to expose deceptive user interfaces. By leveraging Multi-Agent Systems (MAS), it combines computer vision and semantic text analysis to identify "Dark Patterns"—manipulative design choices intended to trick users into giving up privacy, money, or attention.
The modern web is plagued by Dark Patterns:
- Urgency Scarcity: "Only 1 room left!" (when there are 50).
- Confirmshaming: "No, I hate saving money."
- Visual Interference: Hiding the "Unsubscribe" button in grey text on a white background.
Traditional ad-blockers use rigid scripts. They fail when designers change a CSS class. We needed a solution that sees and thinks like a human.
We utilize a Multi-Agent Architecture to deconstruct web pages.
graph LR
A[User Input URL] --> B(🕵️ Navigator Agent)
B --> C{Data Extraction}
C -->|Screenshot| D[👁️ Vision Agent]
C -->|DOM/Text| E[🧠 Analyst Agent]
D --> F[⚖️ Risk Aggregator]
E --> F
F --> G[Final Safety Report]
style A fill:#333,stroke:#fff,stroke-width:2px,color:#fff
style G fill:#b92b27,stroke:#333,stroke-width:2px,color:#fff
- 🕵️ Navigator Agent: Uses Selenium/Playwright to browse the live site, handling popups and scrolling to capture the true user experience.
- 👁️ Vision Agent: A Multi-modal LLM (e.g., Gemini Pro Vision / GPT-4V) that scans screenshots for "Visual Interference" and low-contrast traps.
- 🧠 Analyst Agent: Parses the HTML text to detect manipulative wording, aggression, or guilt-tripping language.
- Core: Python 3.10+
- Orchestration: LangChain / CrewAI
- LLMs: Google Gemini Pro / OpenAI GPT-4
- Frontend: Streamlit / Gradio
- Computer Vision: PIL / OpenCV
- Browser Automation: Selenium / Playwright
Prerequisites: Ensure you have Python 3.10+ installed on your system.
git clone [https://github.com/B-Mohid/Dark_Pattern_Detective.git](https://github.com/B-Mohid/Dark_Pattern_Detective.git)
cd Dark_Pattern_Detective# For Linux/Mac (Fedora)
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtCreate a .env file in the root directory:
GOOGLE_API_KEY=your_gemini_key_here
# or
OPENAI_API_KEY=your_openai_key_herestreamlit run app.py
# or if using Gradio
python app.pyTo see the agent in full effect, test it against these educational "Honey Pot" sites:
- User In Yer Face (The ultimate stress test)
- Deceptive Design Hall of Shame
- Basic Dark Pattern Detection (Text & Visual)
- Hugging Face Deployment
- Browser Extension: Real-time protection overlay.
- Auto-Fill Defense: Prevent agents from signing up for spam.
- Mobile App: Scan screenshots from your phone.
Contributions are welcome! Please fork the repository and submit a pull request.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
