Skip to content

About

prototype

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SecureNet AI — Next-Gen NDR & Hybrid SOC Detection Platform

SecureNet AI is a high-performance Network Detection and Response (NDR) platform combining deterministic sliding-window signature rules with a real-time Isolation Forest Machine Learning anomaly detection engine.


🏗️ Architecture Overview

                          ┌────────────────────────────┐
                          │     Traffic Simulator      │
                          │   (Continuous Flow Stream) │
                          └─────────────┬──────────────┘
                                        │
                                        ▼
                          ┌────────────────────────────┐
                          │   NetworkFlowEvent Buffer  │
                          │    (5000-flow Ring Buffer) │
                          └─────────────┬──────────────┘
                                        │
                                        ▼
                          ┌────────────────────────────┐
                          │     Feature Extraction     │
                          │   (20-D Behavioral Vector) │
                          └─────────────┬──────────────┘
                                        │
                 ┌──────────────────────┴──────────────────────┐
                 │                                             │
                 ▼                                             ▼
  ┌─────────────────────────────┐               ┌─────────────────────────────┐
  │   Deterministic Rule Engine │               │   Isolation Forest ML Layer │
  │                             │               │                             │
  │ • Port Scan Recon           │               │ • 50 Isolation Trees (ψ=128)│
  │ • Credential Brute Force    │               │ • Unsupervised Partitioning │
  │ • Volumetric Botnet Flood   │               │ • Feature Z-Score Deviations│
  │ • Data Exfiltration         │               │ • Bounded 0–100 AI Score    │
  │ • Subnet Lateral Sweep      │               │ • Deterministic Explainers  │
  └──────────────┬──────────────┘               └──────────────┬──────────────┘
                 │                                             │
                 └──────────────────────┬──────────────────────┘
                                        │
                                        ▼
                          ┌────────────────────────────┐
                          │    Hybrid Risk Engine      │
                          │   (Correlation & Bonus)    │
                          └─────────────┬──────────────┘
                                        │
                                        ▼
                          ┌────────────────────────────┐
                          │        ThreatAlert         │
                          │ (Linked Packet Evidence)   │
                          └─────────────┬──────────────┘
                                        │
         ┌──────────────────────────────┼──────────────────────────────┐
         │                              │                              │
         ▼                              ▼                              ▼
┌──────────────────┐          ┌──────────────────┐           ┌──────────────────┐
│   Real-Time SSE  │          │   Resend Email   │           │ Dry-Run Safe EDR │
│  In-App Toasts   │          │ (High/Crit Batch)│           │  & Mitigation    │
└──────────────────┘          └──────────────────┘           └──────────────────┘

🤖 Machine Learning Layer Specifications

  • Algorithm: Isolation Forest Ensemble with Tree Sub-Space Isolation + Statistical Manifold Z-Score Deviations.
  • Model Version: isolation-forest-v1
  • Feature Version: v1.0.0
  • Training Baseline: 300 sliding-window samples generated from simulated enterprise normal background network traffic.
  • Model Artifact: Persisted at server/src/ml/artifacts/isolation-forest-v1.json.
  • Dimensions: 20 numerical behavioral features extracted across a 30-second rolling window.
  • Explainability: Factual top contributing behavioral deviations calculated from observed feature values vs. baseline statistics.

Extracted Feature Dimensions

  1. totalBytes — Total byte volume in window
  2. totalPackets — Total packet count in window
  3. bytesPerSecond — Average byte transfer rate
  4. packetsPerSecond — Average packet arrival velocity
  5. connectionCount — Total active flows/sessions
  6. uniqueSrcIps — Distinct source IP count
  7. uniqueDstIps — Distinct destination IP count
  8. uniqueSrcPorts — Distinct ephemeral source port count
  9. uniqueDstPorts — Distinct target port count
  10. dstPortDiversity — Target port entropy ratio
  11. avgPacketsPerFlow — Average packets per socket
  12. avgBytesPerFlow — Average payload size per flow
  13. tcpRatio — Proportion of TCP flows
  14. udpRatio — Proportion of UDP flows
  15. synRatio — Proportion of SYN connection attempts
  16. finRstRatio — Proportion of teardown / reset packets
  17. maxConnsPerSrc — Maximum flow concentration from single source
  18. maxConnsPerDst — Maximum flow concentration to single target
  19. maxDstPerSrc — Maximum hosts probed by single source
  20. maxPortsPerSrc — Maximum ports probed by single source

⚖️ Hybrid Risk Formula

$$ \text{Risk Score} = \begin{cases} \min\left(100, \text{round}(S_{\text{rule}} \times 0.60 + S_{\text{ml}} \times 0.30 + 10)\right) & \text{if } S_{\text{rule}} \ge 75 \land S_{\text{ml}} \ge 85 \quad (\text{HYBRID_CORRELATED}) \\ \max\left(S_{\text{rule}}, \text{round}(S_{\text{rule}} \times 0.85 + S_{\text{ml}} \times 0.15)\right) & \text{if } S_{\text{rule}} > 0 \land S_{\text{ml}} < 85 \quad (\text{RULE_SIGNATURE}) \\ S_{\text{ml}} & \text{if } S_{\text{rule}} = 0 \land S_{\text{ml}} \ge 85 \quad (\text{ML_ANOMALY}) \end{cases} $$


🧪 Running Verification Tests

To execute the 10-test comprehensive hybrid engine test suite:

cd server
npx tsx src/test-step7-comprehensive.ts

To retrain the Isolation Forest baseline model:

cd server
npx tsx src/ml/train.ts

To query the live ML engine status:

curl http://localhost:5000/api/ml/status

🚀 Development Setup

Backend (Port 5000)

cd server
npm install
npm run dev

Frontend (Port 3000)

npm install
npm run dev

About

prototype

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages