
LLM을 사용하여 PDF, DOCX 및 TXT 문서에서 구조화된 사이버 위협 인텔리전스(CTI)를 추출합니다. MITRE ATT&CK 공격 흐름, 탐지 기회 및 포괄적인 엔터티-관계 그래프를 생성합니다.
대규모 언어 모델(LLM)과 고급 구조화 출력 기능을 사용하여 문서에서 사이버 위협 인텔리전스(CTI)를 추출하는 강력한 독립형 명령줄 도구입니다.
# Clone or download the standalone-tdo folder
cd standalone-tdo
# Create virtual environment (recommended)
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
이 도구는 .env 파일에서 로드된 환경 변수를 구성에 사용합니다:
# Copy the example configuration
cp env.example .env
# Edit .env with your settings
# Required variables:
GEMINI_API_KEY=your-google-ai-api-key-here
GEMINI_MODEL=gemini-2.5-flash
Gemini API 키 받기:
.env 파일에 복사하세요사용 가능한 모델:
gemini-2.5-flash-preview-05-20 (권장 - 빠르고 비용 효율적)gemini-2.5-pro-preview-06-05 (더 강력하지만 느림)# Process a single file with all features
python tdo_bulk.py report.pdf --flow --opps
# Process multiple files
python tdo_bulk.py file1.pdf file2.docx file3.txt
# Process all files in a directory with parallel workers
python tdo_bulk.py reports/ -j 4
# Generate comprehensive analysis with evaluation
python tdo_bulk.py report.pdf --flow --opps --eval-opps
usage: tdo_bulk.py [options] FILE [FILE ...]
Positional Arguments:
FILE One or more files or directories to process
Core Options:
-o, --output DIR Output directory (default: ./extracted_data)
--csv FILE Export summary to CSV file
-j, --jobs N Number of parallel workers (default: 1)
--retries N LLM retry count (default: 2)
--backoff SEC Exponential back-off base (default: 1.5)
Analysis Features:
--flow Generate Attack-Flow JSON
--opps Generate Threat Detection Opportunities
--eval-opps Evaluate detection opportunities quality
--debug-opps Show debug information for opportunity generation
Output Control:
-q, --quiet Minimal console output
-v, --verbose Debug-level logging
-h, --help Show help message and exit
# Basic CTI extraction
python tdo_bulk.py threat_report.pdf
# Full analysis with all features
python tdo_bulk.py apt_report.pdf --flow --opps --eval-opps
# Batch processing with parallel workers
python tdo_bulk.py reports_folder/ -j 8 --flow --opps
# Export results to CSV
python tdo_bulk.py *.pdf --csv results.csv
# Quiet mode for automation
python tdo_bulk.py reports/ -q -o /var/soc/cti --opps
처리된 각 파일에 대해 도구는 다음을 생성합니다:
{filename}_extracted.json: 포괄적인 스키마를 갖춘 구조화된 CTI 데이터{filename}_{timestamp}.md: 모든 분석이 포함된 사람이 읽을 수 있는 마크다운 보고서--flow 사용 시)--opps 사용 시)| 엔티티 유형 | 설명 | 주요 속성 |
|---|---|---|
| ThreatActor | 사이버 위협 그룹 | aliases, primary_motivation, first_seen |
| Tool | 합법적인 소프트웨어 | family, capabilities, kill_chain_phases |
| Malware | 악성 소프트웨어 | family, capabilities, first_seen, last_seen |
| Technique | MITRE ATT&CK 기법 | id (T1234), description, kill_chain_phases |
| Tactic | MITRE ATT&CK 전술 | id (TA0001), description |
| Infrastructure | IP, 도메인, URL | type, tags, first_seen, last_seen |
| Indicator | 파일 해시, 패턴 | value, pattern, valid_from, valid_until |
| Vulnerability | CVE 항목 | id, cvss_score, affected_software |
| Campaign | 명명된 공격 캠페인 | objective, status, first_seen |
| Identity | 대상 조직 | type, description |
| CourseOfAction | 완화 조치, 패치 | type, description |
| Source | 문서 출처 | filename, document_title, file_size_mb |
귀속 및 행위자 관계:
USES_TOOL, USES_TECHNIQUE, CONDUCTS, ATTRIBUTED_TO, TARGETS기술 관계:
TOOL_IMPLEMENTS_TECHNIQUE, HOSTS_ON, COMMUNICATES_WITH, VARIANT_OFDROPS, DOWNLOADS, INDICATES, OBSERVED_ON, EXPLOITS고급 관계:
MITIGATES, DETECTS, IS_SUBTECHNIQUE_OF, FLOW_CONTAINS_STEPFLOW_USED_BY_ACTOR, OBSERVES, SOURCED_FROM모든 관계는 confidence, source, first_seen, last_seen과 같은 속성을 지원합니다.
이 도구는 다음과 같은 증거 기반 탐지 기회를 생성합니다:
{
"id": "opp-001",
"name": "Detect PowerShell Process Injection",
"technique_id": "T1055",
"artefacts": ["powershell.exe with WriteProcessMemory calls"],
"behaviours": ["Process injection into legitimate processes"],
"rationale": "APT groups commonly use PowerShell for process injection",
"confidence": 0.8,
"source": "PowerShell used for process injection (T1055)",
"evidence": [
"• PowerShell executes WriteProcessMemory calls (line 45)",
"• Relationship: ThreatActor USES_TECHNIQUE T1055"
]
}
향상된 공격 흐름은 다음을 제공합니다:
{
"flow": {
"label": "AttackFlow",
"pk": "attack-flow--uuid",
"properties": {
"name": "APT29 Multi-stage Attack",
"description": "Sophisticated spear-phishing to data exfiltration flow"
}
},
"steps": [
{
"order": 1,
"entity": {"label": "Technique", "pk": "T1566.001"},
"description": "Spear-phishing attachment delivery",
"reason": "Initial access method cited in report section 2.1"
}
]
}
tdo_bulk.py)python-dotenv를 사용하여 .env 구성 로드tdo_bulk_runner.py)tdo_core/extractors/report_processor.py)tdo_core/detection/opportunity_generator.py)tdo_core/flows/attack_flow_synthesizer.py)tdo_core/report/md_export.py)tdo_core/llm/prompts.py)Document Input → Text Extraction → LLM Processing → Structured Output
↓ ↓ ↓ ↓
PDF/DOCX Clean Text Gemini API JSON + Fallback
↓ ↓ ↓ ↓
Multi-format Preprocessing Pydantic Schema Validation
↓ ↓ ↓ ↓
File Support Text Cleaning Structured Data CTI Graph
↓
Post-Processing
↓ ↓
Attack Flows Detection Opps
↓ ↓
Markdown Report Export