Skip to content

bhargava562/block-safe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

28 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ก๏ธ BlockSafe

An Autonomous Cognitive Firewall & Threat Intelligence Engine

Python FastAPI React Docker Supabase Telegram

"Security today protects devices. Scams attack humans. BlockSafe protects the human decision layer."


๐Ÿ›‘ The Problem

Spam filters block links. Antivirus blocks malware. But neither stops a human from making an irreversible decision when manipulated by fear, urgency, or authority.

Scams succeed in the 30โ€“90 seconds of panic before a user realizes they are being deceived.

๐Ÿ’ก Our Solution: The Cognitive Firewall

BlockSafe is not a spam filter. It is an Autonomous Cognitive Firewall. It intervenes before the user acts, neutralizes the attacker through controlled honeypot engagement, and converts every attack into a high-fidelity intelligence dataset.

โœจ Key Features

  • ๐Ÿง  Cognitive Risk Engine: Detects psychological manipulation (urgency, fear, authority) rather than just keyword matching.
  • ๐Ÿ›‘ Pre-Action Intervention: Pauses outgoing risky messages and provides users with a calm, persuasive explanation of the threat.
  • ๐Ÿค– Autonomous Honeypot: Takes over the conversation from the user via our Telegram Bot, deploying delay tactics to extract threat intelligence from the scammer.
  • ๐Ÿ”— Conversation Continuity: Uses Supabase to maintain state, ensuring the AI remembers context throughout the engagement.
  • ๐Ÿ“Š Threat Intelligence Command Center: A React dashboard to monitor live attacks, network risk scores, and threat distribution.
  • ๐Ÿญ Dataset Generation Engine: Automatically formats neutralized honeypot engagements into ML-ready datasets (Threat Intel JSON & Fine-Tuning JSONL).

๐Ÿ—๏ธ System Architecture

BlockSafe is built using a highly decoupled, asynchronous microservice architecture, utilizing Groq's LPUs for sub-second inference with a high-availability fallback to DeepSeek.

---
id: 1536703f-d656-4a1a-8075-bba44db560a7
---
graph TD
    classDef user fill:#ff9999,stroke:#333,stroke-width:2px;
    classDef bot fill:#2CA5E0,stroke:#333,stroke-width:2px,color:#fff;
    classDef backend fill:#005571,stroke:#333,stroke-width:2px,color:#fff;
    classDef ai fill:#f9a826,stroke:#333,stroke-width:2px;
    classDef db fill:#3ECF8E,stroke:#333,stroke-width:2px;
    classDef frontend fill:#20232a,stroke:#333,stroke-width:2px,color:#61dafb;

    A[๐Ÿฆนโ€โ™‚๏ธ Scammer/Attacker]:::user -->|Sends Scam Message| B(๐Ÿ“ฑ Telegram Bot UI):::bot
    
    B -->|Shield Mode API Call| C{โš™๏ธ FastAPI Backend\nCognitive Risk Engine}:::backend
    
    C -->|High Risk Detected| D[๐Ÿง  LangGraph Swarm\nMulti-Agent Routing]:::ai
    D <-->|Primary Inference| G((๐Ÿš€ Groq: Llama-3.3-70B)):::ai
    D <-->|HA Fallback| DS((๐Ÿ‹ DeepSeek-V3)):::ai
    
    D -->|Extract & Update State| F[(๐Ÿ—„๏ธ Supabase DB)]:::db
    F -->|Conversation History| D
    
    B -->|User Clicks 'Engage Honeypot'| D
    D -->|AI Generated Delay Tactic| B
    B -->|Replies to Scammer| A
    
    F -->|Real-Time Analytics| H[๐Ÿ’ป React Admin Dashboard]:::frontend
    H -->|Export Button| I[๐Ÿ“„ Threat Intel JSONL]:::frontend
Loading

๐Ÿ› ๏ธ Tech Stack

  • Backend Engine: Python, FastAPI, LangGraph, LangChain
  • Primary AI Inference: Groq (llama-3.3-70b-versatile) for ultra-low latency.
  • Fallback AI Inference: DeepSeek (deepseek-chat) for high-availability redundancy.
  • State Management: Supabase (PostgreSQL)
  • Frontend Intervention: python-telegram-bot (Async API)
  • Command Center UI: React, Vite, Tailwind CSS, Recharts
  • Infrastructure: Docker & Docker Compose (Ready for Render Deployment)

๐Ÿš€ Running Locally (Dockerized Environment)

BlockSafe is fully containerized into three distinct microservices. You can spin up the entire ecosystem on your local machine using Docker.

1. Prerequisites

  • Docker Desktop installed and running.
  • A Telegram Bot Token (from @BotFather).
  • Supabase API URL and Service Role Key.
  • API Keys for Groq and DeepSeek.

2. Environment Setup

Clone the repository and set up your environment variables:

git clone [https://github.com/bhargava562/block-safe.git](https://github.com/bhargava562/block-safe.git)
cd block-safe

Create a .env file in the server/ directory using the provided template:

# โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ REQUIRED โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
API_AUTH_KEY=your-secure-api-key-here

# โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ AI API KEYS โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
GROQ_API_KEY=your-groq-api-key-here
DEEPSEEK_API_KEY=your-deepseek-api-key-here

# โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ SUPABASE (State) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
SUPABASE_URL=your-project-url.supabase.co
SUPABASE_SERVICE_KEY=your-service-role-key-here

# โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ MODEL NAMES โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
GROQ_MODEL=llama-3.3-70b-versatile
DEEPSEEK_MODEL=deepseek-chat

# โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ HONEYPOT Configuration โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
HONEYPOT_MAX_TURNS=5
HONEYPOT_CONFIDENCE_THRESHOLD=0.85

3. Spin Up the Containers

Run Docker Compose to build and start all three services (FastAPI, Telegram Bot, and React Dashboard):

docker-compose up --build

4. Access the Services

  • ๐ŸŒ FastAPI Swagger Docs: http://localhost:8000/docs
  • ๐Ÿ“ฑ Telegram Bot: Open Telegram and message your bot to trigger the Cognitive Firewall.
  • ๐Ÿ’ป Admin Dashboard: http://localhost:5173 (View live threats and export datasets).

๐Ÿ”ฎ What's Next (Upcoming Phase 2): The Future of BlockSafe

Our vision is to evolve BlockSafe from a conceptual Telegram demo into a ubiquitous, multi-channel cognitive firewall. Here is the roadmap for the next phase of development:

  • ๐Ÿ“ฑ Native OS-Level Integration: Transitioning from a bot interface to a background daemon/accessibility service (Android/iOS) that intercepts malicious notifications directly from WhatsApp, SMS, and native apps before the user even opens them.
  • ๐ŸŽ™๏ธ Multimodal Voice Shield: Integrating ultra-low-latency, on-device Whisper models to analyze live scam calls. BlockSafe will detect AI voice cloning, urgency manipulation, and authority impersonation in real-time, with the ability to inject an audio warning or autonomously take over the call.
  • ๐Ÿ“ง Enterprise Email Defense: Expanding the cognitive risk engine to parse inbound phishing emails. This includes injecting pre-action HTML intervention banners directly into the inbox and deploying automated honeypot email threads to exhaust the attacker's server infrastructure.
  • ๐ŸŒ Global Threat Intelligence Grid: Automating the export of our Scam Strategy Fingerprints (SSF) via webhooks directly to banking APIs, telecom providers (like Airtel/Jio), and regulatory bodies (e.g., CERT-In) to establish a collective, pre-emptive defense network.

๐Ÿ‘จโ€๐Ÿ’ป The Team

Built with โค๏ธ and โ˜• during a 24-hour hackathon by:

  • Bhargava A
  • Bhaargav K.C
  • Dinesh Karthik L
  • Hari Prasanth T.S

"We donโ€™t just block scams. We absorb them, waste their time, and turn their strategies into intelligence."

About

BlockSafe is an autonomous cognitive firewall protecting the human decision layer. Powered by Groq, it fingerprints text-based scam strategies in real time. Using pre-action Telegram interventions and AI honeypots, it neutralizes active threats and converts every scam attempt into structured intelligence for proactive defense.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors