Skip to content

B-Mohid/Dark_Pattern_Detective

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🕵️‍♂️ Dark Pattern Detective

Python 3.10+ License: MIT Hugging Face Spaces Status

"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.


Demo :

Watch the video

🚩 The Problem

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.

🧠 Architecture & Agents

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
Loading

The Agents

  1. 🕵️ Navigator Agent: Uses Selenium/Playwright to browse the live site, handling popups and scrolling to capture the true user experience.
  2. 👁️ Vision Agent: A Multi-modal LLM (e.g., Gemini Pro Vision / GPT-4V) that scans screenshots for "Visual Interference" and low-contrast traps.
  3. 🧠 Analyst Agent: Parses the HTML text to detect manipulative wording, aggression, or guilt-tripping language.

🛠️ Tech Stack

  • 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

🚀 Installation & Usage

Prerequisites: Ensure you have Python 3.10+ installed on your system.

1. Clone the Repository

git clone [https://github.com/B-Mohid/Dark_Pattern_Detective.git](https://github.com/B-Mohid/Dark_Pattern_Detective.git)
cd Dark_Pattern_Detective

2. Set up Virtual Environment

# For Linux/Mac (Fedora)
python3 -m venv venv
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure Environment Variables

Create a .env file in the root directory:

GOOGLE_API_KEY=your_gemini_key_here
# or
OPENAI_API_KEY=your_openai_key_here

5. Run the Detective

streamlit run app.py
# or if using Gradio
python app.py

🧪 Testing

To see the agent in full effect, test it against these educational "Honey Pot" sites:


🗺️ Roadmap

  • 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.

🤝 Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

Distributed under the MIT License. See LICENSE for more information.


Made with lots of 💖️ using Fedora 42 💫️ 🤖️

About

Unlike traditional dark pattern detectors that only analyze text, this is a Multimodal Agent. It uses Playwright to navigate dynamic content and Gemini 2.0 flash to identify visual deception (like button coloring and layout interference) that text-only models miss.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors