Solution

AI Security Suite

AI-based network and host intrusion detection and a malware scanner, extended in v1.1 with real-time pre-emptive defense, a monitoring UI and reports — one CLI, one config file, one logs folder.

Overview

Components

Version documented: manual v1.1 / software aisec 1.1.0. Python tool suite with a single CLI (main.py, also aisec).

ComponentWhat it doesTechnology
NIDS
(network intrusion detection)
pcap files or live capture → bidirectional flows → 33 NSL-KDD-compatible + 20 extended features → 4-model ensemble vote → JSONL alerts with an attack-type hintScapy, Isolation Forest, Random Forest, LightGBM, PyTorch Autoencoder
HIDS
(host log anomaly detection)
auth.log / syslog parsing → message templates, rarity and per-IP time-window features (26) → anomalous-line detectionRegex parsers, Isolation Forest
Malware scanner — staticPE header / sections / entropy / imports / strings (55 features) → XGBoost probability with SHAP contributions, YARA rulespefile, yara-python, XGBoost
Malware scanner — dynamicCuckoo/CAPE sandbox behavior reports (JSON, 39 features) → classification. The file is never executedscikit-learn Random Forest
VirusTotal integrationSHA-256 hash reputation lookup (no upload), cache and rate limit, skipped automatically without a keyVirusTotal API v3
Real-time defense (v1.1)Input sources → detectors → policy → safety gate → responses, all auditedaisec defend
Monitoring UI & reports (v1.1)Local web dashboard and daily/weekly/custom reportsaisec ui, aisec report
Capabilities

What each part does

NIDS — network intrusion detection

Turns packets into flows and scores them with several models, so no single model decides alone.

  • pcap + live capture
  • 53 flow features
  • Majority vote
  • Reads pcap files (streaming) or a live interface (Scapy AsyncSniffer, optional BPF filter).
  • Builds bidirectional flows with TCP state summary (SF / S0 / REJ / RST / OTH) and a 30 s inactivity timeout.
  • Window features over the last 2 seconds and last 100 connections — the same meaning as NSL-KDD count / srv_count / serror_rate.
  • Each model scores “bigger = riskier”; an alert fires when at least min_votes models agree (default: majority).
  • Alerts carry severity (high = all models agree), an attack-type hint (SYN flood, port scan, host sweep, UDP flood, brute force, statistical anomaly) and key feature values.

HIDS — host log anomaly detection

Learns what normal auth.log / syslog looks like on your host and flags what is new or bursty.

  • auth.log / syslog
  • 26 features
  • Isolation Forest
  • Features include time of day (sin/cos), message-template rarity, 13 security keywords and per-IP 60-second window counts of events, failures and tried accounts.
  • Threshold = 99th percentile of normal training-log scores (configurable).
  • Each alert lists its top contributing features, e.g. ip_fail_window → brute force.
  • Train on a period you believe attack-free; days to weeks of logs are recommended.

Malware scanner

Static, rule-based, reputation and behavior signals combined into one explainable verdict — without ever running the file.

  • PE · XGBoost · SHAP
  • YARA
  • VirusTotal (hash only)
  • Static ML on 55 PE features; SHAP values show which features pushed the score up or down.
  • YARA rules from a folder (7 example rules included: EICAR, UPX, high entropy, injection APIs, ransom strings, encoded PowerShell, unsigned).
  • Dynamic analysis reads only the report.json produced by an external sandbox (Cuckoo/CAPE).
  • Overall score = max(signal × weight); ≥ 0.8 malicious, ≥ 0.5 suspicious, otherwise clean. “Clean” means no evidence found — not a guarantee.
  • Only PE files are ML-analyzed; scripts, documents and ELF get YARA and VirusTotal only.

Real-time pre-emptive defense

v1.1 adds an engine that receives threats, decides by policy and responds — with the brakes on by default.

  • 5 input sources
  • 6 response types
  • Dry-run default
  • Inputs: scapy sniffing, pcap replay, /proc/net/tcp poller, auth.log tail, file watch (watchdog) feeding the existing malware scanner.
  • Responses: IP block (nft / iptables / netsh, TTL, allowlist), rate limit, file quarantine, process kill and account lock (both off by default), alert.
  • Policy examples: port scan 75 → immediate block; user enumeration 40 → alert only; SSH brute force 80; SYN flood 90; malicious file 100.
  • Distributed or spoofed SYN floods are alert-only (syn_flood_target) so victims are not blocked by mistake.
  • Operations: list-blocks, unblock, rollback, gc, restore, verify-audit, self-test, simulate.

Monitoring UI & reports

See what the engine saw and did — and hand a readable report to management or auditors.

  • Local web UI
  • HTML · JSON · CSV · DOCX
  • Dashboard built with the Python standard library only: no CDN, fonts or scripts from outside; refreshes every 5 s.
  • Tiles, 60-minute trend, events by kind, top attacker IPs, risk scores, block list, quarantined files, recent events and audit records.
  • Bound to 127.0.0.1 by default; any other address requires a token. Release/restore buttons need --allow-actions.
  • Reports: daily, weekly (7 days) or custom period; HTML is self-contained with the audit-chain status; CSV neutralizes formula injection.
Architecture

v1.1 real-time defense architecture

Redrawn from the manual’s architecture figure. Blue dashed arrows are read-only; the dashboard’s release and restore buttons are the only write path and need their own gate.

AI Security Suite v1.1 architectureInput sources feed detectors, which feed a policy engine and a safety gate. Approved actions go to responders. Everything is written to a logs folder that the monitoring UI and reports read.1 Input sources2 Detection3 Policy & safety gate4 ResponseLive packet sniffingscapy · root / CAP_NET_RAWPacketDetectorport scan · SYN / UDP floodIP blocknft / iptables / netsh · TTL · allowlistpcap replaytest / post-incidentNIDS / HIDS ML adapterstrained models (optional)Rate limitweaker than a block/proc/net/tcp pollerLinux · non-rootConnMonitorconnections per remote IPFile quarantinemove, not delete · hash + path keptauth.log tailSSH / login eventsAuthLogDetectorbrute force · account enumerationKill process / lock accountOFF by defaultFile watchwatchdog (polling fallback)FileScanGateexisting malware scannerAlertconsole · JSONL · syslog · webhookPolicyEngineRisk score accumulation(half-life decay)Alert 30 / block 70 thresholdsAllowlist checkMax concurrent blocksSafety gateDefault: dry-run(decisions are recorded only)--enforce ANDenforcement.allow: truelogs_dir (default <install>/logs) — one place for all datadefense/events · alerts · audit.jsonl (SHA-256 hash chain) · blocks.json · status.json · quarantine/ · reports/ · ui/access.jsonlRotation (max_bytes · backups) + retention (retention_days)aisec ui (monitor)127.0.0.1 · token · CSRF · offline SVG dashboardaisec reportdaily / weekly / custom · HTML · JSON · CSV · DOCXread-only

Scroll sideways to see the whole diagram.

  • Input sources
  • Detection
  • Policy
  • Safety gate
  • Response
  • Observation
Design principles

Built to be defensive, explainable and offline-capable

Defense only

No attack functions. Demo pcaps are written to files and never transmitted. Automatic response is dry-run by default behind a double gate.

Non-execution

The malware scanner only reads bytes. Dynamic analysis consumes JSON reports from an external sandbox.

Works offline

NSL-KDD download falls back to synthetic data, VirusTotal is skipped without a key, tests pass without a network.

Train–detect consistency

The synthetic generator and the real packet parser share the same FlowRecord aggregation path to minimise feature mismatch.

Explainability

Attack-type hints and key features (NIDS), contributing features (HIDS), SHAP values (static ML) and evidence (dynamic).

Ops-friendly

JSON Lines alerts and JSON results can be ingested by SIEMs such as Splunk or Elastic; exit codes (0 / 1 / 2) fit automation.

Requirements

System requirements

ItemRecommended / verifiedNotes
OSLinux x86_64 (verified: Debian family)Windows / macOS can analyze pcaps and scan files; live capture needs Npcap and privileges. Real blocking was verified on Linux only.
Python3.10+ (verified: 3.13.5)Virtual environment recommended
Memory4 GB+ (about 1.5 GB for a full NSL-KDD training)8 GB+ recommended for full CIC-IDS2017
DiskAbout 2 GB (venv with PyTorch CPU ≈ 1.8 GB)Datasets are extra
PrivilegesLive capture: root or CAP_NET_RAW · real blocking: root or CAP_NET_ADMINpcap analysis, scans, log/file watching, UI and reports run as a normal user
Firewallnftables or iptables (Linux)If neither exists the engine runs in dry-run; macOS has no firewall backend
Screens

Dashboard and report

Screenshots taken from the product documentation. Both were produced with demo data.

Monitoring dashboard in enforce mode with a fake firewall: 12 detected events, 9 actions, 8 blocks, 1 quarantined file, trend chart, event kinds, attacker IPs, risk scores, block list and quarantined file.
Dashboard with documentation demo data: synthetic attacks and a fake firewall (no real firewall was changed). UI language is Korean.
Daily HTML report: summary tiles, hourly trend, events by kind, actions by type and result, top source IPs and a table of performed actions.
Part of a daily HTML report generated from the same demo data. Report language is Korean.
Know the limits

What the suite does not do

Talk to us about your environment

Tell us about your network, hosts and constraints. We will propose a dry-run-first pilot plan — no obligation.