The Intent-Aware Security System is an advanced API middleware prototype designed to protect legacy identity verification infrastructure (e.g., Aadhaar OTP systems) against modern threat vectors like credential stuffing, automated scraping, and SS7/SIM-swapping.
Unlike traditional platforms that rely strictly on credential validity, this project introduces a dual-layer defense architecture:
- Cryptographic Layer (ZKP): Utilizes client-side ECDSA P-256 signatures and strict challenge-response nonces to authenticate users mathematically, without transmitting private secrets across the network.
- Behavioral Layer (Machine Learning): Deploys an unsupervised
IsolationForestanomaly detection engine to evaluate the intent of a request (timing, location, velocity, and payload mass), instantly terminating perfectly-spoofed mimicry attacks where cryptographic keys are bypassed or disabled.
Ensure you have Python 3.8+ installed.
Install the required dependencies:
pip install -r requirements.txtGenerate synthetic traffic logs and train the anomaly detection model:
# Step 1: Generate Data
python generate_data.py
# Step 2: Train Model
python train_model.pyYou should see traffic_logs.csv and model.pkl appear in the data/ folder.
Simply run the included batch file to start everything:
start_system.batThis will launch the API Gateway and open all necessary interfaces in your browser.
For manual control, open two separate terminal windows:
Start the FastAPI server that processes verification requests.
python app.pyServer will start at http://127.0.0.1:8000
Launch the hacker simulation tool.
python attacker.pyUse the menu to launch attacks and watch them get blocked in real-time.
Dashboard Access: Open http://localhost:8000/dashboard/index.html in your browser.
config.py: Configuration settings (thresholds, file paths)generate_data.py: Creates synthetic training data for the modeltrain_model.py: Trains the Isolation Forest modelapp.py: The security middleware (FastAPI backend)attacker.py: The attack simulation toolcrypto_utils.py: Cryptographic utilities for Zero-Knowledge Proof (ZKP) authenticationtest_zkp_integration.py: Integration tests for the complete ZKP flowzkp_simulation.py: A simple command-line demonstration of Zero Knowledge Proofsstart_system.bat: Automated system launcher scriptrequirements.txt: Python package dependencies
The application serves multiple distinct frontend modules, organized by functional area:
Government portal simulation.
index.html: Main portal interfacezkp-client.js: Client-side ZKP library for key generation and cryptographic signingtimer-worker.js: Web worker for portal session timeoutsashoka_emblem.svg: Interface graphical asset
Hacker console interface simulation.
index.html: Automated attack simulation interface
Real-time security monitoring dashboard.
index.html: Main dashboard viewscript.js: Dashboard logic, charting, and real-time updatesstyle.css: Dashboard styling
Security architecture comparison UI (Legitimate vs. Attack scenarios).
index.html: Comparison interfacecompare.js: Comparison logic and animationsstyle.css: Comparison styling
Visual ZKP security demonstration.
index.html: Interactive ZKP demonstration showcasing security layers