siphai-core 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. siphai_core-0.1.0/.env.example +67 -0
  2. siphai_core-0.1.0/.github/pull_request_template.md +38 -0
  3. siphai_core-0.1.0/.gitignore +62 -0
  4. siphai_core-0.1.0/.serena/.gitignore +2 -0
  5. siphai_core-0.1.0/.serena/project.local.yml +5 -0
  6. siphai_core-0.1.0/.serena/project.yml +133 -0
  7. siphai_core-0.1.0/AGENTS.md +10 -0
  8. siphai_core-0.1.0/PKG-INFO +202 -0
  9. siphai_core-0.1.0/PROJECT_PLAN.md +532 -0
  10. siphai_core-0.1.0/README.md +170 -0
  11. siphai_core-0.1.0/TESTING.md +155 -0
  12. siphai_core-0.1.0/degraded_fix.patch +96 -0
  13. siphai_core-0.1.0/docs/ENRICHMENT_PIPELINE.md +205 -0
  14. siphai_core-0.1.0/docs/PHASE_1_2_ENDPOINTS.md +74 -0
  15. siphai_core-0.1.0/docs/PHASE_1_2_TODO.md +233 -0
  16. siphai_core-0.1.0/docs/PHASE_1_CODE_GUIDE.md +221 -0
  17. siphai_core-0.1.0/docs/enrichment.md +157 -0
  18. siphai_core-0.1.0/docs/superpowers/notes/2026-08-22-enrichment-services-notes.md +168 -0
  19. siphai_core-0.1.0/docs/superpowers/plans/2026-08-15-enrichment-service.md +1289 -0
  20. siphai_core-0.1.0/docs/superpowers/plans/2026-11-25-issue-22-integration-tests-readme.md +186 -0
  21. siphai_core-0.1.0/docs/superpowers/specs/2026-08-15-enrichment-service-design.md +145 -0
  22. siphai_core-0.1.0/docs/superpowers/specs/2026-08-22-enrichment-services-design.md +115 -0
  23. siphai_core-0.1.0/pr_body.md +75 -0
  24. siphai_core-0.1.0/pyproject.toml +93 -0
  25. siphai_core-0.1.0/scripts/test_alert_schema.py +68 -0
  26. siphai_core-0.1.0/scripts/test_case_provider.py +70 -0
  27. siphai_core-0.1.0/src/siphai_core/__init__.py +21 -0
  28. siphai_core-0.1.0/src/siphai_core/agent/__init__.py +0 -0
  29. siphai_core-0.1.0/src/siphai_core/agent/memory/__init__.py +0 -0
  30. siphai_core-0.1.0/src/siphai_core/agent/prompts/__init__.py +0 -0
  31. siphai_core-0.1.0/src/siphai_core/agent/tools/__init__.py +0 -0
  32. siphai_core-0.1.0/src/siphai_core/core/__init__.py +0 -0
  33. siphai_core-0.1.0/src/siphai_core/core/config/__init__.py +0 -0
  34. siphai_core-0.1.0/src/siphai_core/core/config/settings.py +82 -0
  35. siphai_core-0.1.0/src/siphai_core/core/interfaces/__init__.py +0 -0
  36. siphai_core-0.1.0/src/siphai_core/core/interfaces/alert_provider.py +148 -0
  37. siphai_core-0.1.0/src/siphai_core/core/interfaces/case_provider.py +275 -0
  38. siphai_core-0.1.0/src/siphai_core/core/interfaces/notification_provider.py +16 -0
  39. siphai_core-0.1.0/src/siphai_core/core/logging_config.py +82 -0
  40. siphai_core-0.1.0/src/siphai_core/core/models/__init__.py +0 -0
  41. siphai_core-0.1.0/src/siphai_core/core/models/schemas.py +370 -0
  42. siphai_core-0.1.0/src/siphai_core/core/services/__init__.py +0 -0
  43. siphai_core-0.1.0/src/siphai_core/core/services/aggregator.py +484 -0
  44. siphai_core-0.1.0/src/siphai_core/integrations/__init__.py +0 -0
  45. siphai_core-0.1.0/src/siphai_core/integrations/elasticsearch/__init__.py +0 -0
  46. siphai_core-0.1.0/src/siphai_core/integrations/elasticsearch/service.py +294 -0
  47. siphai_core-0.1.0/src/siphai_core/integrations/external/__init__.py +0 -0
  48. siphai_core-0.1.0/src/siphai_core/integrations/external/abuseipdb.py +97 -0
  49. siphai_core-0.1.0/src/siphai_core/integrations/external/cache.py +102 -0
  50. siphai_core-0.1.0/src/siphai_core/integrations/external/enrichment.py +365 -0
  51. siphai_core-0.1.0/src/siphai_core/integrations/external/greynoise.py +76 -0
  52. siphai_core-0.1.0/src/siphai_core/integrations/external/rate_limiter.py +96 -0
  53. siphai_core-0.1.0/src/siphai_core/integrations/external/virustotal.py +106 -0
  54. siphai_core-0.1.0/src/siphai_core/integrations/slack/__init__.py +0 -0
  55. siphai_core-0.1.0/src/siphai_core/integrations/telegram/__init__.py +0 -0
  56. siphai_core-0.1.0/src/siphai_core/integrations/telegram/service.py +111 -0
  57. siphai_core-0.1.0/src/siphai_core/integrations/wazuh/__init__.py +0 -0
  58. siphai_core-0.1.0/src/siphai_core/mcp/__init__.py +0 -0
  59. siphai_core-0.1.0/src/siphai_core/mcp/handlers/__init__.py +0 -0
  60. siphai_core-0.1.0/src/siphai_core/mcp/handlers/errors.py +7 -0
  61. siphai_core-0.1.0/src/siphai_core/mcp/server.py +46 -0
  62. siphai_core-0.1.0/src/siphai_core/mcp/tools/__init__.py +0 -0
  63. siphai_core-0.1.0/src/siphai_core/mcp/tools/health_check.py +28 -0
  64. siphai_core-0.1.0/src/siphai_core/utils/__init__.py +0 -0
  65. siphai_core-0.1.0/test_conn.py +33 -0
  66. siphai_core-0.1.0/tests/__init__.py +0 -0
  67. siphai_core-0.1.0/tests/agent/__init__.py +0 -0
  68. siphai_core-0.1.0/tests/api/__init__.py +0 -0
  69. siphai_core-0.1.0/tests/core/__init__.py +0 -0
  70. siphai_core-0.1.0/tests/core/interfaces/__init__.py +0 -0
  71. siphai_core-0.1.0/tests/core/interfaces/conftest.py +10 -0
  72. siphai_core-0.1.0/tests/core/interfaces/test_alert_provider.py +174 -0
  73. siphai_core-0.1.0/tests/core/interfaces/test_case_provider.py +392 -0
  74. siphai_core-0.1.0/tests/core/services/__init__.py +0 -0
  75. siphai_core-0.1.0/tests/core/services/test_aggregator.py +322 -0
  76. siphai_core-0.1.0/tests/core/test_elasticsearch_service.py +382 -0
  77. siphai_core-0.1.0/tests/core/test_logging.py +168 -0
  78. siphai_core-0.1.0/tests/core/test_logging_integration.py +83 -0
  79. siphai_core-0.1.0/tests/core/test_schemas.py +217 -0
  80. siphai_core-0.1.0/tests/core/test_settings.py +27 -0
  81. siphai_core-0.1.0/tests/integrations/__init__.py +0 -0
  82. siphai_core-0.1.0/tests/integrations/elasticsearch/__init__.py +0 -0
  83. siphai_core-0.1.0/tests/integrations/elasticsearch/test_aggregator_integration.py +200 -0
  84. siphai_core-0.1.0/tests/integrations/elasticsearch/test_service_api_key.py +62 -0
  85. siphai_core-0.1.0/tests/integrations/external/__init__.py +0 -0
  86. siphai_core-0.1.0/tests/integrations/external/conftest.py +17 -0
  87. siphai_core-0.1.0/tests/integrations/external/test_abuseipdb.py +140 -0
  88. siphai_core-0.1.0/tests/integrations/external/test_cache.py +51 -0
  89. siphai_core-0.1.0/tests/integrations/external/test_enrichment.py +518 -0
  90. siphai_core-0.1.0/tests/integrations/external/test_greynoise.py +111 -0
  91. siphai_core-0.1.0/tests/integrations/external/test_live.py +100 -0
  92. siphai_core-0.1.0/tests/integrations/external/test_rate_limiter.py +100 -0
  93. siphai_core-0.1.0/tests/integrations/external/test_virustotal.py +142 -0
  94. siphai_core-0.1.0/tests/integrations/telegram/__init__.py +0 -0
  95. siphai_core-0.1.0/tests/integrations/telegram/conftest.py +10 -0
  96. siphai_core-0.1.0/tests/integrations/telegram/test_telegram_service.py +300 -0
  97. siphai_core-0.1.0/tests/mcp/__init__.py +0 -0
  98. siphai_core-0.1.0/tests/mcp/test_health_check_integration.py +49 -0
  99. siphai_core-0.1.0/tests/mcp/test_server.py +10 -0
  100. siphai_core-0.1.0/tests/test_package.py +10 -0
  101. siphai_core-0.1.0/uv.lock +3616 -0
@@ -0,0 +1,67 @@
1
+ # ==========================================
2
+ # AI-SOC Project Environment Configuration
3
+ # ==========================================
4
+
5
+ # Application
6
+ APP_NAME=ai-soc-triage
7
+ DEBUG=true
8
+ LOG_LEVEL=INFO
9
+ # structlog renderer: json | console (bos = DEBUG'a göre)
10
+ LOG_FORMAT=
11
+
12
+ # Elasticsearch
13
+ ELASTICSEARCH_HOST=http://localhost:9200
14
+ ELASTICSEARCH_USERNAME=elastic
15
+ ELASTICSEARCH_PASSWORD=changeme
16
+ ELASTICSEARCH_CA_CERTS=
17
+ # Verilirse USERNAME/PASSWORD yerine bu kullanılır
18
+ ELASTICSEARCH_API_KEY=
19
+ # Case yazımı için named user (restricted index) — basic auth
20
+ ELASTICSEARCH_CASE_USERNAME=
21
+ ELASTICSEARCH_CASE_PASSWORD=
22
+ # Case oluştururken created_by.profile_uid olarak yazılan kullanıcı profili (opsiyonel)
23
+ ELASTICSEARCH_PROFILE_UID=
24
+
25
+ # Redis
26
+ REDIS_URL=redis://localhost:6379/0
27
+ REDIS_CACHE_TTL=86400 # 24 hours in seconds
28
+
29
+ # External APIs (Phase 2)
30
+ VIRUSTOTAL_API_KEY=
31
+ ABUSEIPDB_API_KEY=
32
+ GREYNOISE_API_KEY=
33
+
34
+ # OpenAI (Phase 4)
35
+ OPENAI_API_KEY=
36
+ OPENAI_MODEL=gpt-4o
37
+
38
+ # Telegram (Phase 1)
39
+ TELEGRAM_BOT_TOKEN=
40
+ TELEGRAM_CHAT_ID=
41
+
42
+ # MCP (Phase 3)
43
+ MCP_TRANSPORT=stdio # stdio | http
44
+ MCP_SERVER_PORT=8000
45
+
46
+ # REST (eski — kaldırıldı, sadece geriye dönük)
47
+ REST_API_HOST=0.0.0.0
48
+ REST_API_PORT=8001
49
+
50
+ # Security
51
+ JWT_SECRET_KEY=change-me-in-production
52
+ JWT_ALGORITHM=HS256
53
+ WEBHOOK_SECRET=
54
+
55
+ # Retry / Rate
56
+ MAX_RETRIES=3
57
+ REQUEST_TIMEOUT=30
58
+ RATE_LIMIT_REQUESTS=100
59
+ RATE_LIMIT_WINDOW=60 # seconds
60
+
61
+ # Aggregation
62
+ AGGREGATION_ENABLED=true
63
+ AGGREGATION_DEDUP_WINDOW_SECONDS=300 # 5 dk
64
+ AGGREGATION_TIME_WINDOW_SECONDS=900 # 15 dk
65
+ AGGREGATION_CORRELATION_WINDOW_SECONDS=3600 # 1 saat
66
+ AGGREGATION_MAX_ALERTS_PER_GROUP=100
67
+ AGGREGATION_POLL_INTERVAL_SECONDS=30
@@ -0,0 +1,38 @@
1
+ # PR: [Başlık]
2
+
3
+ ## 🔗 İlgili Issue'lar
4
+ - Closes #XX: [Issue başlığı]
5
+
6
+ ## 📋 Özet
7
+ [1-2 cümle ile ne yapıldı]
8
+
9
+ ## ✅ Tamamlanan Görevler
10
+ - [ ] Görev 1
11
+ - [ ] Görev 2
12
+
13
+ ## 🏗️ Mimari
14
+ [Mimari açıklama, varsa diagram]
15
+
16
+ ## 📁 Değişen Dosyalar
17
+ | Dosya | Değişiklik |
18
+ |-------|------------|
19
+ | `path/to/file.py` | Açıklama |
20
+
21
+ ## 🔍 Test Durumu
22
+ ```bash
23
+ # Komut
24
+ uv run pytest tests/
25
+
26
+ # Sonuç:
27
+ # ...
28
+ ⚠️ Dikkat Edilecek Noktalar
29
+ - Dikkat edilmesi gereken madde 1
30
+ - Dikkat edilmesi gereken madde 2
31
+ 📌 Sıradaki Görevler
32
+ Görev Kim
33
+ Görev @kullanici
34
+ 👀 Review Checklist
35
+ - Kod mantığı anlaşıldı
36
+ - Testler başarılı
37
+ - Migration/geri alma planı düşünüldü
38
+ - Sıradaki görevler net mi?
@@ -0,0 +1,62 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+
28
+ # Environment
29
+ .env
30
+ .env.local
31
+ .env.production
32
+ .env.bak*
33
+
34
+ # IDE
35
+ .vscode/
36
+ .idea/
37
+ *.swp
38
+ *.swo
39
+ *~
40
+
41
+ # Testing
42
+ .pytest_cache/
43
+ .coverage
44
+ htmlcov/
45
+ .xml
46
+
47
+ # Docker
48
+ docker-compose.yml
49
+ docker-compose.override.yml
50
+ Dockerfile.*
51
+
52
+ # OS
53
+ .DS_Store
54
+ Thumbs.db
55
+
56
+ # Logs
57
+ *.log
58
+ logs/
59
+
60
+ # Claude Code config (local-only, not pushed to repo)
61
+ .claude/
62
+ CLAUDE.md
@@ -0,0 +1,2 @@
1
+ /cache
2
+ /project.local.yml
@@ -0,0 +1,5 @@
1
+ # This file allows you to locally override settings in project.yml for development purposes.
2
+ #
3
+ # Use the same keys as in project.yml here. Any setting you specify will override the corresponding
4
+ # setting in project.yml, allowing you to customise the configuration for your local development environment
5
+ # without affecting the project configuration in project.yml (which is intended to be versioned).
@@ -0,0 +1,133 @@
1
+ # the name by which the project can be referenced within Serena
2
+ project_name: "core"
3
+
4
+
5
+ # list of languages for which language servers are started; choose from:
6
+ # al angular ansible bash clojure
7
+ # cpp cpp_ccls crystal csharp csharp_omnisharp
8
+ # dart elixir elm erlang fortran
9
+ # fsharp go groovy haskell haxe
10
+ # hlsl html java json julia
11
+ # kotlin lean4 lua luau markdown
12
+ # matlab msl nix ocaml pascal
13
+ # perl php php_phpactor powershell python
14
+ # python_jedi python_ty r rego ruby
15
+ # ruby_solargraph rust scala scss solidity
16
+ # svelte swift systemverilog terraform toml
17
+ # typescript typescript_vts vue yaml zig
18
+ # (This list may be outdated. For the current list, see values of Language enum here:
19
+ # https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
20
+ # For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
21
+ # Note:
22
+ # - For C, use cpp
23
+ # - For JavaScript, use typescript
24
+ # - For Angular projects, use angular (subsumes typescript+html; requires `npm install` in the project root)
25
+ # - For Svelte projects, use svelte (subsumes typescript/javascript for .svelte projects; requires npm)
26
+ # - For SCSS / Sass / plain CSS, use scss (some-sass-language-server handles all three)
27
+ # - For Free Pascal/Lazarus, use pascal
28
+ # Special requirements:
29
+ # Some languages require additional setup/installations.
30
+ # See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
31
+ # When using multiple languages, the first language server that supports a given file will be used for that file.
32
+ # The first language is the default language and the respective language server will be used as a fallback.
33
+ # Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
34
+ languages:
35
+ - python
36
+
37
+ # the encoding used by text files in the project
38
+ # For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
39
+ encoding: "utf-8"
40
+
41
+ # line ending convention to use when writing source files.
42
+ # Possible values: unset (use global setting), "lf", "crlf", or "native" (platform default)
43
+ # This does not affect Serena's own files (e.g. memories and configuration files), which always use native line endings.
44
+ line_ending:
45
+
46
+ # The language backend to use for this project.
47
+ # If not set, the global setting from serena_config.yml is used.
48
+ # Valid values: LSP, JetBrains
49
+ # Note: the backend is fixed at startup. If a project with a different backend
50
+ # is activated post-init, an error will be returned.
51
+ language_backend:
52
+
53
+ # whether to use project's .gitignore files to ignore files
54
+ ignore_all_files_in_gitignore: true
55
+
56
+ # advanced configuration option allowing to configure language server-specific options.
57
+ # Maps the language key to the options.
58
+ # Have a look at the docstring of the constructors of the LS implementations within solidlsp (e.g., for C# or PHP) to see which options are available.
59
+ # No documentation on options means no options are available.
60
+ ls_specific_settings: {}
61
+
62
+ # list of additional workspace folder paths for cross-package reference support (e.g. in monorepos).
63
+ # Paths can be absolute or relative to the project root.
64
+ # Each folder is registered as an LSP workspace folder, enabling language servers to discover
65
+ # symbols and references across package boundaries.
66
+ # Currently supported for: TypeScript.
67
+ # Example:
68
+ # additional_workspace_folders:
69
+ # - ../sibling-package
70
+ # - ../shared-lib
71
+ additional_workspace_folders: []
72
+
73
+ # list of additional paths to ignore in this project.
74
+ # Same syntax as gitignore, so you can use * and **.
75
+ # Note: global ignored_paths from serena_config.yml are also applied additively.
76
+ ignored_paths: []
77
+
78
+ # whether the project is in read-only mode
79
+ # If set to true, all editing tools will be disabled and attempts to use them will result in an error
80
+ # Added on 2025-04-18
81
+ read_only: false
82
+
83
+ # list of tool names to exclude.
84
+ # This extends the existing exclusions (e.g. from the global configuration)
85
+ # Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
86
+ excluded_tools: []
87
+
88
+ # list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default).
89
+ # This extends the existing inclusions (e.g. from the global configuration).
90
+ # Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
91
+ included_optional_tools: []
92
+
93
+ # fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
94
+ # This cannot be combined with non-empty excluded_tools or included_optional_tools.
95
+ # Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
96
+ fixed_tools: []
97
+
98
+ # list of mode names that are to be activated by default, overriding the setting in the global configuration.
99
+ # The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
100
+ # If the setting is undefined/empty, the default_modes from the global configuration (serena_config.yml) apply.
101
+ # Otherwise, this overrides the setting from the global configuration (serena_config.yml).
102
+ # Therefore, you can set this to [] if you do not want the default modes defined in the global config to apply
103
+ # for this project.
104
+ # This setting can, in turn, be overridden by CLI parameters (--mode).
105
+ # See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
106
+ default_modes:
107
+
108
+ # list of mode names to be activated additionally for this project, e.g. ["query-projects"]
109
+ # The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
110
+ # See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
111
+ added_modes:
112
+
113
+ # initial prompt for the project. It will always be given to the LLM upon activating the project
114
+ # (contrary to the memories, which are loaded on demand).
115
+ initial_prompt: ""
116
+
117
+ # time budget (seconds) per tool call for the retrieval of additional symbol information
118
+ # such as docstrings or parameter information.
119
+ # This overrides the corresponding setting in the global configuration; see the documentation there.
120
+ # If null or missing, use the setting from the global configuration.
121
+ symbol_info_budget:
122
+
123
+ # list of regex patterns which, when matched, mark a memory entry as read‑only.
124
+ # Extends the list from the global configuration, merging the two lists.
125
+ read_only_memory_patterns: []
126
+
127
+ # list of regex patterns for memories to completely ignore.
128
+ # Matching memories will not appear in list_memories or activate_project output
129
+ # and cannot be accessed via read_memory or write_memory.
130
+ # To access ignored memory files, use the read_file tool on the raw file path.
131
+ # Extends the list from the global configuration, merging the two lists.
132
+ # Example: ["_archive/.*", "_episodes/.*"]
133
+ ignored_memory_patterns: []
@@ -0,0 +1,10 @@
1
+ # AI-SOC Project — Agent Notları
2
+
3
+ ## Test Kuralları
4
+ - Testler **pytest** ile yazılır (`tests/` altına). Mock için `httpx.MockTransport`, async için `pytest-asyncio` kullanılır (pyproject'te `asyncio_mode = "auto"` hazır).
5
+ - Test komutu: `uv run pytest tests/ -v`
6
+
7
+ ## Proje Konvansiyonları
8
+ - Servisler exception fırlatmaz; hata durumunda `{"source": ..., "error": ...}` dict'i döner.
9
+ - Loglama: `structlog.get_logger()` inline çağrılar.
10
+ - Lint/tip kontrolü: `uv run ruff check .` ve `uv run mypy <dosya>`
@@ -0,0 +1,202 @@
1
+ Metadata-Version: 2.5
2
+ Name: siphai-core
3
+ Version: 0.1.0
4
+ Summary: SiphAI Core — AI-Managed SOC Triage Alert System
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: aiocache>=0.12
7
+ Requires-Dist: aiolimiter>=1.1
8
+ Requires-Dist: elasticsearch<9.0,>=8.0
9
+ Requires-Dist: fastapi>=0.110
10
+ Requires-Dist: httpx>=0.25
11
+ Requires-Dist: langchain-core>=0.3
12
+ Requires-Dist: langchain-openai>=0.2
13
+ Requires-Dist: langchain>=0.3
14
+ Requires-Dist: mcp>=1.0
15
+ Requires-Dist: pydantic-settings>=2.0
16
+ Requires-Dist: pydantic>=2.0
17
+ Requires-Dist: python-dotenv>=1.0
18
+ Requires-Dist: python-telegram-bot>=21.0
19
+ Requires-Dist: redis>=5.0
20
+ Requires-Dist: structlog>=24.0
21
+ Requires-Dist: tenacity>=8.2
22
+ Requires-Dist: uvicorn[standard]>=0.29
23
+ Requires-Dist: vt-py>=0.18
24
+ Provides-Extra: dev
25
+ Requires-Dist: mypy>=1.10; extra == 'dev'
26
+ Requires-Dist: pre-commit>=3.7; extra == 'dev'
27
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
28
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
29
+ Requires-Dist: pytest>=8.0; extra == 'dev'
30
+ Requires-Dist: ruff>=0.4; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # AI-SOC Triage Alert System
34
+
35
+ ## Kurulum (uv + brew)
36
+
37
+ ### 1. Brew (macOS + Linux)
38
+
39
+ ```bash
40
+ # macOS
41
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
42
+
43
+ # Linux
44
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
45
+ eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
46
+ ```
47
+
48
+ ### 2. uv Kurulumu
49
+
50
+ ```bash
51
+ # macOS
52
+ brew install uv
53
+
54
+ # Linux
55
+ brew install uv
56
+ ```
57
+
58
+ ### 3. Redis (Phase 2)
59
+
60
+ ```bash
61
+ brew install redis
62
+
63
+ # Servisi başlat
64
+ brew services start redis
65
+
66
+ # Manuel başlat
67
+ redis-server
68
+ ```
69
+
70
+ ### 4. Proje Kurulumu
71
+
72
+ ```bash
73
+ # Projeye git
74
+ cd ai-soc-project
75
+
76
+ # Virtual env oluştur ve dependencies kur
77
+ uv sync
78
+
79
+ # Virtual env'i aktif et
80
+ source .venv/bin/activate
81
+
82
+ # .env dosyasını oluştur
83
+ cp .env.example .env
84
+ # .env dosyasını düzenle (aşağıdaki tablo)
85
+ ```
86
+
87
+ ### 4.1 `.env` Değişkenleri
88
+
89
+ | Grup | Değişken | Açıklama |
90
+ |------|----------|----------|
91
+ | **Core** | `APP_NAME` | Uygulama adı |
92
+ | | `DEBUG` | Hata ayıklama (dev) |
93
+ | | `LOG_LEVEL` | `DEBUG`/`INFO`/`WARNING`/`ERROR`/`CRITICAL` |
94
+ | | `LOG_FORMAT` | `json`/`console` (yoksa `DEBUG`'a göre) |
95
+ | **Elasticsearch** | `ELASTICSEARCH_HOST` | Cluster URL |
96
+ | | `ELASTICSEARCH_USERNAME` / `ELASTICSEARCH_PASSWORD` | Basic auth |
97
+ | | `ELASTICSEARCH_API_KEY` | API key (varsa) |
98
+ | | `ELASTICSEARCH_CA_CERTS` | TLS CA (varsa → `verify_certs=True`) |
99
+ | | `ELASTICSEARCH_CASE_USERNAME` / `ELASTICSEARCH_CASE_PASSWORD` | Case yazımı için named user |
100
+ | | `ELASTICSEARCH_PROFILE_UID` | `created_by.profile_uid` |
101
+ | **Telegram** | `TELEGRAM_BOT_TOKEN` / `TELEGRAM_CHAT_ID` | Faz 1 |
102
+ | **Dış API** | `VIRUSTOTAL_API_KEY` | VirusTotal |
103
+ | | `ABUSEIPDB_API_KEY` | AbuseIPDB |
104
+ | | `GREYNOISE_API_KEY` | GreyNoise (boş = anonim kota) |
105
+ | | `OPENAI_API_KEY` / `OPENAI_MODEL` | Faz 4 agent |
106
+ | **MCP** | `MCP_TRANSPORT` | `stdio`/`http` |
107
+ | | `MCP_SERVER_PORT` | http transport portu |
108
+ | **Redis** | `REDIS_URL` | cache |
109
+ | | `REDIS_CACHE_TTL` | saniye |
110
+ | **Security** | `JWT_SECRET_KEY` / `JWT_ALGORITHM` | — |
111
+ | | `WEBHOOK_SECRET` | — |
112
+ | **Retry/Rate** | `MAX_RETRIES` / `REQUEST_TIMEOUT` | ES |
113
+ | | `RATE_LIMIT_REQUESTS` / `RATE_LIMIT_WINDOW` | — |
114
+ | **Aggregation** | `AGGREGATION_ENABLED` | gruplama açık/kapalı |
115
+ | | `AGGREGATION_DEDUP_WINDOW_SECONDS` / `AGGREGATION_TIME_WINDOW_SECONDS` | — |
116
+ | | `AGGREGATION_CORRELATION_WINDOW_SECONDS` / `AGGREGATION_MAX_ALERTS_PER_GROUP` | — |
117
+ | | `AGGREGATION_POLL_INTERVAL_SECONDS` | poller aralığı |
118
+
119
+ > `rest_api_host`/`rest_api_port` yalnızca eski REST için — kaldırılmış durumda, README'de listelenmez.
120
+
121
+ ### 5. Çalıştırma
122
+
123
+ REST (FastAPI) **kaldırıldı** — entry point **MCP server**'dır (Faz 3). Transport/port
124
+ `Settings.mcp_transport` (`stdio` | `http`) ve `mcp_server_port` ile ayarlanır.
125
+
126
+ ```bash
127
+ # MCP server (stdio)
128
+ uv run python -m src.mcp.server
129
+
130
+ # MCP server (http) — MCP_TRANSPORT=http ise
131
+ MCP_TRANSPORT=http uv run python -m src.mcp.server
132
+
133
+ # veya aktif venv ile
134
+ python -m src.mcp.server
135
+ ```
136
+
137
+ > MCP server entry point'i Faz 3'te tamamlanacak; şu an `src/mcp/` iskelettir.
138
+
139
+ ### 6. Test
140
+
141
+ ```bash
142
+ uv run pytest
143
+ uv run pytest --cov=src
144
+ ```
145
+
146
+ ### 7. Lint & Type Check
147
+
148
+ ```bash
149
+ uv run ruff check .
150
+ uv run ruff format .
151
+ uv run mypy src/
152
+ ```
153
+
154
+ ## Komutlar Özeti
155
+
156
+ | Komut | Açıklama |
157
+ |-------|----------|
158
+ | `uv sync` | Dependencies kur (pyproject.toml'dan) |
159
+ | `uv run <command>` | Virtual env içinde komut çalıştır |
160
+ | `uv add <package>` | Yeni dependency ekle |
161
+ | `uv remove <package>` | Dependency kaldır |
162
+ | `uv pip list` | Kurulu paketleri listele |
163
+ | `uv run python -m src.mcp.server` | MCP server başlat (Faz 3) |
164
+ | `brew services start redis` | Redis'i başlat |
165
+ | `brew services stop redis` | Redis'i durdur |
166
+
167
+ ## Proje Yapısı
168
+
169
+ ```
170
+ ai-soc-project/
171
+ ├── src/
172
+ │ ├── core/
173
+ │ │ ├── config/settings.py
174
+ │ │ ├── config/logging_config.py # merkezi structlog (JSON/console, censor)
175
+ │ │ ├── models/schemas.py
176
+ │ │ ├── interfaces/ # case_provider, alert_provider
177
+ │ │ └── services/ # aggregator.py (alert gruplama)
178
+ │ ├── integrations/
179
+ │ │ ├── elasticsearch/service.py # ES + case_client (OCC)
180
+ │ │ ├── telegram/service.py
181
+ │ │ └── external/ # virustotal, abuseipdb, greynoise,
182
+ │ │ │ # cache, rate_limiter, enrichment
183
+ │ ├── mcp/ # Faz 3 — MCP server/tools (iskelet)
184
+ │ └── agent/ # Faz 4 — LangChain agent
185
+ ├── tests/
186
+ │ ├── core/
187
+ │ └── integrations/
188
+ ├── docs/
189
+ ├── pyproject.toml
190
+ ├── .env.example
191
+ └── docker-compose.yml
192
+ ```
193
+
194
+ ## Fazlar
195
+
196
+ | Faz | Açıklama | Süre |
197
+ |-----|----------|------|
198
+ | Phase 1 | Alert → Telegram | 1 hafta |
199
+ | Phase 2 | Case + Enrichment + **MCP** (REST iptal) | 2 hafta |
200
+ | Phase 3 | MCP Server | 2 hafta |
201
+ | Phase 4 | AI Agent (LangChain) | 2-3 hafta |
202
+ | Phase 5 | Slack + Wazuh + Deployment | İsteğe bağlı |