forensic-ai #4
File diff suppressed because one or more lines are too long
239
src/config/prompts.ts
Normal file
239
src/config/prompts.ts
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
// src/config/prompts.ts - Centralized German prompts for AI pipeline
|
||||||
|
|
||||||
|
export const AI_PROMPTS = {
|
||||||
|
|
||||||
|
// Main tool selection prompt
|
||||||
|
toolSelection: (mode: string, userQuery: string, selectionMethod: string, maxSelectedItems: number) => {
|
||||||
|
const modeInstruction = mode === 'workflow'
|
||||||
|
? 'Der Benutzer möchte einen UMFASSENDEN WORKFLOW mit mehreren Tools/Methoden über verschiedene Phasen. Wählen Sie 15-25 Tools aus, die den vollständigen Untersuchungslebenszyklus abdecken.'
|
||||||
|
: 'Der Benutzer möchte SPEZIFISCHE TOOLS/METHODEN, die ihr konkretes Problem direkt lösen. Wählen Sie 3-8 Tools aus, die am relevantesten und effektivsten sind.';
|
||||||
|
|
||||||
|
return `Sie sind ein DFIR-Experte mit Zugang zur kompletten forensischen Tool-Datenbank. Sie müssen die relevantesten Tools und Konzepte für diese spezifische Anfrage auswählen.
|
||||||
|
|
||||||
|
AUSWAHLMETHODE: ${selectionMethod}
|
||||||
|
${selectionMethod === 'embeddings_candidates' ?
|
||||||
|
'Diese Tools wurden durch Vektor-Ähnlichkeit vorgefiltert, sie sind bereits relevant. Ihre Aufgabe ist es, die BESTEN aus diesem relevanten Set auszuwählen.' :
|
||||||
|
'Sie haben Zugang zur vollständigen Tool-Datenbank. Wählen Sie die relevantesten Tools für die Anfrage aus.'}
|
||||||
|
|
||||||
|
${modeInstruction}
|
||||||
|
|
||||||
|
BENUTZER-ANFRAGE: "${userQuery}"
|
||||||
|
|
||||||
|
KRITISCHE AUSWAHLPRINZIPIEN:
|
||||||
|
1. **KONTEXT ÜBER POPULARITÄT**: Verwenden Sie nicht automatisch "berühmte" Tools wie Volatility, Wireshark oder Autopsy nur weil sie bekannt sind. Wählen Sie basierend auf den SPEZIFISCHEN Szenario-Anforderungen.
|
||||||
|
|
||||||
|
2. **METHODOLOGIE vs SOFTWARE**:
|
||||||
|
- Für SCHNELLE/DRINGENDE Szenarien → Priorisieren Sie METHODEN und schnelle Antwort-Ansätze
|
||||||
|
- Für ZEITKRITISCHE Vorfälle → Wählen Sie Triage-Methoden über tiefe Analyse-Tools
|
||||||
|
- Für UMFASSENDE Analysen → Dann betrachten Sie detaillierte Software-Tools
|
||||||
|
- METHODEN (Typ: "method") sind oft besser als SOFTWARE für prozedurale Anleitung
|
||||||
|
|
||||||
|
3. **SZENARIO-SPEZIFISCHE LOGIK**:
|
||||||
|
- "Schnell/Quick/Dringend/Triage" Szenarien → Rapid Incident Response und Triage METHODE > Volatility
|
||||||
|
- "Industrial/SCADA/ICS" Szenarien → Spezialisierte ICS-Tools > generische Netzwerk-Tools
|
||||||
|
- "Mobile/Android/iOS" Szenarien → Mobile-spezifische Tools > Desktop-Forensik-Tools
|
||||||
|
- "Speicher-Analyse dringend benötigt" → Schnelle Speicher-Tools/Methoden > umfassende Volatility-Analyse
|
||||||
|
|
||||||
|
ANALYSE-ANWEISUNGEN:
|
||||||
|
1. Lesen Sie die VOLLSTÄNDIGE Beschreibung jedes Tools/Konzepts
|
||||||
|
2. Berücksichtigen Sie ALLE Tags, Plattformen, verwandte Tools und Metadaten
|
||||||
|
3. **PASSENDE DRINGLICHKEIT**: Schnelle Szenarien brauchen schnelle Methoden, nicht tiefe Analyse-Tools
|
||||||
|
4. **PASSENDE SPEZIFITÄT**: Spezialisierte Szenarien brauchen spezialisierte Tools, nicht generische
|
||||||
|
5. **BERÜCKSICHTIGEN SIE DEN TYP**: Methoden bieten prozedurale Anleitung, Software bietet technische Fähigkeiten
|
||||||
|
|
||||||
|
Wählen Sie die relevantesten Elemente aus (max ${maxSelectedItems} insgesamt).
|
||||||
|
|
||||||
|
Antworten Sie NUR mit diesem JSON-Format:
|
||||||
|
{
|
||||||
|
"selectedTools": ["Tool Name 1", "Tool Name 2", ...],
|
||||||
|
"selectedConcepts": ["Konzept Name 1", "Konzept Name 2", ...],
|
||||||
|
"reasoning": "Detaillierte Erklärung, warum diese spezifischen Tools für diese Anfrage ausgewählt wurden, und warum bestimmte populäre Tools NICHT ausgewählt wurden, falls sie für den Szenario-Kontext ungeeignet waren"
|
||||||
|
}`;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Scenario analysis prompt
|
||||||
|
scenarioAnalysis: (isWorkflow: boolean, userQuery: string) => {
|
||||||
|
const analysisType = isWorkflow ? 'forensische Szenario' : 'technische Problem';
|
||||||
|
const considerations = isWorkflow ?
|
||||||
|
`- Angriffsvektoren und Bedrohungsmodellierung nach MITRE ATT&CK
|
||||||
|
- Betroffene Systeme und kritische Infrastrukturen
|
||||||
|
- Zeitkritische Faktoren und Beweiserhaltung
|
||||||
|
- Forensische Artefakte und Datenquellen` :
|
||||||
|
`- Spezifische forensische Herausforderungen
|
||||||
|
- Verfügbare Datenquellen und deren Integrität
|
||||||
|
- Methodische Anforderungen für rechtssichere Analyse`;
|
||||||
|
|
||||||
|
return `Sie sind ein erfahrener DFIR-Experte. Analysieren Sie das folgende ${analysisType}.
|
||||||
|
|
||||||
|
${isWorkflow ? 'FORENSISCHES SZENARIO' : 'TECHNISCHES PROBLEM'}: "${userQuery}"
|
||||||
|
|
||||||
|
Führen Sie eine systematische ${isWorkflow ? 'Szenario-Analyse' : 'Problem-Analyse'} durch und berücksichtigen Sie dabei:
|
||||||
|
|
||||||
|
${considerations}
|
||||||
|
|
||||||
|
WICHTIG: Antworten Sie NUR in fließendem deutschen Text ohne Listen, Aufzählungen oder Markdown-Formatierung. Maximum 150 Wörter.`;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Investigation approach prompt
|
||||||
|
investigationApproach: (isWorkflow: boolean, userQuery: string) => {
|
||||||
|
const approachType = isWorkflow ? 'Untersuchungsansatz' : 'Lösungsansatz';
|
||||||
|
const considerations = isWorkflow ?
|
||||||
|
`- Triage-Prioritäten nach forensischer Dringlichkeit
|
||||||
|
- Phasenabfolge nach NIST-Methodik
|
||||||
|
- Kontaminationsvermeidung und forensische Isolierung` :
|
||||||
|
`- Methodik-Auswahl nach wissenschaftlichen Kriterien
|
||||||
|
- Validierung und Verifizierung der gewählten Ansätze
|
||||||
|
- Integration in bestehende forensische Workflows`;
|
||||||
|
|
||||||
|
return `Basierend auf der Analyse entwickeln Sie einen fundierten ${approachType} nach NIST SP 800-86 Methodik.
|
||||||
|
|
||||||
|
${isWorkflow ? 'SZENARIO' : 'PROBLEM'}: "${userQuery}"
|
||||||
|
|
||||||
|
Entwickeln Sie einen systematischen ${approachType} unter Berücksichtigung von:
|
||||||
|
|
||||||
|
${considerations}
|
||||||
|
|
||||||
|
WICHTIG: Antworten Sie NUR in fließendem deutschen Text ohne Listen oder Markdown. Maximum 150 Wörter.`;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Critical considerations prompt
|
||||||
|
criticalConsiderations: (isWorkflow: boolean, userQuery: string) => {
|
||||||
|
const considerationType = isWorkflow ? 'kritische forensische Überlegungen' : 'wichtige methodische Voraussetzungen';
|
||||||
|
const aspects = isWorkflow ?
|
||||||
|
`- Time-sensitive evidence preservation
|
||||||
|
- Chain of custody requirements und rechtliche Verwertbarkeit
|
||||||
|
- Incident containment vs. evidence preservation Dilemma
|
||||||
|
- Privacy- und Compliance-Anforderungen` :
|
||||||
|
`- Tool-Validierung und Nachvollziehbarkeit
|
||||||
|
- False positive/negative Risiken bei der gewählten Methodik
|
||||||
|
- Qualifikationsanforderungen für die Durchführung
|
||||||
|
- Dokumentations- und Reporting-Standards`;
|
||||||
|
|
||||||
|
return `Identifizieren Sie ${considerationType} für diesen Fall.
|
||||||
|
|
||||||
|
${isWorkflow ? 'SZENARIO' : 'PROBLEM'}: "${userQuery}"
|
||||||
|
|
||||||
|
Berücksichtigen Sie folgende forensische Aspekte:
|
||||||
|
|
||||||
|
${aspects}
|
||||||
|
|
||||||
|
WICHTIG: Antworten Sie NUR in fließendem deutschen Text ohne Listen oder Markdown. Maximum 120 Wörter.`;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Phase tool selection prompt
|
||||||
|
phaseToolSelection: (userQuery: string, phase: any, phaseTools: any[]) => {
|
||||||
|
return `Wählen Sie 2-3 Methoden/Tools für die Phase "${phase.name}" basierend auf objektiven, fallbezogenen Kriterien.
|
||||||
|
|
||||||
|
SZENARIO: "${userQuery}"
|
||||||
|
|
||||||
|
VERFÜGBARE TOOLS FÜR ${phase.name.toUpperCase()}:
|
||||||
|
${phaseTools.map((tool: any) => `- ${tool.name}: ${tool.description.slice(0, 100)}...`).join('\n')}
|
||||||
|
|
||||||
|
Wählen Sie Methoden/Tools nach forensischen Kriterien aus:
|
||||||
|
- Court admissibility und Chain of Custody Kompatibilität
|
||||||
|
- Integration in forensische Standard-Workflows
|
||||||
|
- Reproduzierbarkeit und Dokumentationsqualität
|
||||||
|
- Objektivität
|
||||||
|
|
||||||
|
Antworten Sie AUSSCHLIESSLICH mit diesem JSON-Format (kein zusätzlicher Text):
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"toolName": "Exakter Methoden/Tool-Name",
|
||||||
|
"priority": "high|medium|low",
|
||||||
|
"justification": "Objektive Begründung warum diese Methode/Tool für das spezifische Szenario besser geeignet ist"
|
||||||
|
}
|
||||||
|
]`;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Tool evaluation prompt
|
||||||
|
toolEvaluation: (userQuery: string, tool: any, rank: number) => {
|
||||||
|
return `Bewerten Sie diese Methode/Tool fallbezogen für das spezifische Problem nach forensischen Qualitätskriterien.
|
||||||
|
|
||||||
|
PROBLEM: "${userQuery}"
|
||||||
|
|
||||||
|
TOOL: ${tool.name}
|
||||||
|
BESCHREIBUNG: ${tool.description}
|
||||||
|
PLATTFORMEN: ${tool.platforms?.join(', ') || 'N/A'}
|
||||||
|
SKILL LEVEL: ${tool.skillLevel}
|
||||||
|
|
||||||
|
Bewerten Sie nach forensischen Standards und antworten Sie AUSSCHLIESSLICH mit diesem JSON-Format:
|
||||||
|
{
|
||||||
|
"suitability_score": "high|medium|low",
|
||||||
|
"detailed_explanation": "Detaillierte forensische Begründung warum diese Methode/Tool das Problem löst",
|
||||||
|
"implementation_approach": "Konkrete methodische Schritte zur korrekten Anwendung für dieses spezifische Problem",
|
||||||
|
"pros": ["Forensischer Vorteil 1", "Validierter Vorteil 2"],
|
||||||
|
"cons": ["Methodische Limitation 1", "Potenzielle Schwäche 2"],
|
||||||
|
"alternatives": "Alternative Ansätze falls diese Methode/Tool nicht optimal ist"
|
||||||
|
}`;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Background knowledge selection prompt
|
||||||
|
backgroundKnowledgeSelection: (userQuery: string, mode: string, selectedToolNames: string[], availableConcepts: any[]) => {
|
||||||
|
return `Wählen Sie relevante forensische Konzepte für das Verständnis der empfohlenen Methodik.
|
||||||
|
|
||||||
|
${mode === 'workflow' ? 'SZENARIO' : 'PROBLEM'}: "${userQuery}"
|
||||||
|
EMPFOHLENE TOOLS: ${selectedToolNames.join(', ')}
|
||||||
|
|
||||||
|
VERFÜGBARE KONZEPTE:
|
||||||
|
${availableConcepts.slice(0, 15).map((concept: any) => `- ${concept.name}: ${concept.description.slice(0, 80)}...`).join('\n')}
|
||||||
|
|
||||||
|
Wählen Sie 2-4 Konzepte aus, die für das Verständnis der forensischen Methodik essentiell sind.
|
||||||
|
|
||||||
|
Antworten Sie AUSSCHLIESSLICH mit diesem JSON-Format:
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"conceptName": "Exakter Konzept-Name",
|
||||||
|
"relevance": "Forensische Relevanz: Warum dieses Konzept für das Verständnis der Methodik kritisch ist"
|
||||||
|
}
|
||||||
|
]`;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Final recommendations prompt
|
||||||
|
finalRecommendations: (isWorkflow: boolean, userQuery: string, selectedToolNames: string[]) => {
|
||||||
|
const prompt = isWorkflow ?
|
||||||
|
`Erstellen Sie eine forensisch fundierte Workflow-Empfehlung basierend auf DFIR-Prinzipien.
|
||||||
|
|
||||||
|
SZENARIO: "${userQuery}"
|
||||||
|
AUSGEWÄHLTE TOOLS: ${selectedToolNames.join(', ') || 'Keine Tools ausgewählt'}
|
||||||
|
|
||||||
|
Erstellen Sie konkrete methodische Workflow-Schritte für dieses spezifische Szenario unter Berücksichtigung forensischer Best Practices, Objektivität und rechtlicher Verwertbarkeit.
|
||||||
|
|
||||||
|
WICHTIG: Antworten Sie NUR in fließendem deutschen Text ohne Listen oder Markdown. Maximum 120 Wörter.` :
|
||||||
|
|
||||||
|
`Erstellen Sie wichtige methodische Überlegungen für die korrekte Methoden-/Tool-Anwendung.
|
||||||
|
|
||||||
|
PROBLEM: "${userQuery}"
|
||||||
|
EMPFOHLENE TOOLS: ${selectedToolNames.join(', ') || 'Keine Methoden/Tools ausgewählt'}
|
||||||
|
|
||||||
|
Geben Sie kritische methodische Überlegungen, Validierungsanforderungen und Qualitätssicherungsmaßnahmen für die korrekte Anwendung der empfohlenen Methoden/Tools.
|
||||||
|
|
||||||
|
WICHTIG: Antworten Sie NUR in fließendem deutschen Text ohne Listen oder Markdown. Maximum 100 Wörter.`;
|
||||||
|
|
||||||
|
return prompt;
|
||||||
|
}
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
// Type-safe prompt function with proper overloads
|
||||||
|
export function getPrompt(key: 'toolSelection', mode: string, userQuery: string, selectionMethod: string, maxSelectedItems: number): string;
|
||||||
|
export function getPrompt(key: 'scenarioAnalysis', isWorkflow: boolean, userQuery: string): string;
|
||||||
|
export function getPrompt(key: 'investigationApproach', isWorkflow: boolean, userQuery: string): string;
|
||||||
|
export function getPrompt(key: 'criticalConsiderations', isWorkflow: boolean, userQuery: string): string;
|
||||||
|
export function getPrompt(key: 'phaseToolSelection', userQuery: string, phase: any, phaseTools: any[]): string;
|
||||||
|
export function getPrompt(key: 'toolEvaluation', userQuery: string, tool: any, rank: number): string;
|
||||||
|
export function getPrompt(key: 'backgroundKnowledgeSelection', userQuery: string, mode: string, selectedToolNames: string[], availableConcepts: any[]): string;
|
||||||
|
export function getPrompt(key: 'finalRecommendations', isWorkflow: boolean, userQuery: string, selectedToolNames: string[]): string;
|
||||||
|
export function getPrompt(promptKey: keyof typeof AI_PROMPTS, ...args: any[]): string {
|
||||||
|
try {
|
||||||
|
const promptFunction = AI_PROMPTS[promptKey];
|
||||||
|
if (typeof promptFunction === 'function') {
|
||||||
|
// Use type assertion since we've validated the function exists
|
||||||
|
return (promptFunction as (...args: any[]) => string)(...args);
|
||||||
|
} else {
|
||||||
|
console.error(`[PROMPTS] Invalid prompt key: ${promptKey}`);
|
||||||
|
return 'Error: Invalid prompt configuration';
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`[PROMPTS] Error generating prompt ${promptKey}:`, error);
|
||||||
|
return 'Error: Failed to generate prompt';
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { getCompressedToolsDataForAI } from './dataService.js';
|
import { getCompressedToolsDataForAI } from './dataService.js';
|
||||||
import { embeddingsService, type EmbeddingData } from './embeddings.js';
|
import { embeddingsService, type EmbeddingData } from './embeddings.js';
|
||||||
|
import { AI_PROMPTS, getPrompt } from '../config/prompts.js';
|
||||||
|
|
||||||
interface AIConfig {
|
interface AIConfig {
|
||||||
endpoint: string;
|
endpoint: string;
|
||||||
@ -329,10 +330,6 @@ class ImprovedMicroTaskAIPipeline {
|
|||||||
) {
|
) {
|
||||||
const selectionStart = Date.now();
|
const selectionStart = Date.now();
|
||||||
|
|
||||||
const modeInstruction = mode === 'workflow'
|
|
||||||
? 'The user wants a COMPREHENSIVE WORKFLOW with multiple tools/methods across different phases. Select 15-25 tools that cover the full investigation lifecycle.'
|
|
||||||
: 'The user wants SPECIFIC TOOLS/METHODS that directly solve their particular problem. Select 3-8 tools that are most relevant and effective.';
|
|
||||||
|
|
||||||
const toolsWithFullData = candidateTools.map((tool: any) => ({
|
const toolsWithFullData = candidateTools.map((tool: any) => ({
|
||||||
name: tool.name,
|
name: tool.name,
|
||||||
type: tool.type,
|
type: tool.type,
|
||||||
@ -362,69 +359,15 @@ class ImprovedMicroTaskAIPipeline {
|
|||||||
related_software: concept.related_software || []
|
related_software: concept.related_software || []
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const prompt = `You are a DFIR expert with access to the complete forensics tool database. You need to select the most relevant tools and concepts for this specific query.
|
// Generate the German prompt with tool data
|
||||||
|
const basePrompt = getPrompt('toolSelection', mode, userQuery, selectionMethod, this.maxSelectedItems);
|
||||||
|
const prompt = `${basePrompt}
|
||||||
|
|
||||||
SELECTION METHOD: ${selectionMethod}
|
VERFÜGBARE TOOLS (mit vollständigen Daten):
|
||||||
${selectionMethod === 'embeddings_candidates' ?
|
|
||||||
'These tools were pre-filtered by vector similarity, so they are already relevant. Your job is to select the BEST ones from this relevant set.' :
|
|
||||||
'You have access to the full tool database. Select the most relevant tools for the query.'}
|
|
||||||
|
|
||||||
${modeInstruction}
|
|
||||||
|
|
||||||
USER QUERY: "${userQuery}"
|
|
||||||
|
|
||||||
CRITICAL SELECTION PRINCIPLES:
|
|
||||||
1. **CONTEXT OVER POPULARITY**: Don't default to "famous" tools like Volatility, Wireshark, or Autopsy just because they're well-known. Choose based on SPECIFIC scenario needs.
|
|
||||||
|
|
||||||
2. **METHODOLOGY vs SOFTWARE**:
|
|
||||||
- For RAPID/URGENT scenarios → Prioritize METHODS and rapid response approaches
|
|
||||||
- For TIME-CRITICAL incidents → Choose triage methods over deep analysis tools
|
|
||||||
- For COMPREHENSIVE analysis → Then consider detailed software tools
|
|
||||||
- METHODS (type: "method") are often better than SOFTWARE for procedural guidance
|
|
||||||
|
|
||||||
3. **SCENARIO-SPECIFIC LOGIC**:
|
|
||||||
- "Rapid/Quick/Urgent/Triage" scenarios → Rapid Incident Response and Triage METHOD > Volatility
|
|
||||||
- "Industrial/SCADA/ICS" scenarios → Specialized ICS tools > generic network tools
|
|
||||||
- "Mobile/Android/iOS" scenarios → Mobile-specific tools > desktop forensics tools
|
|
||||||
- "Memory analysis needed urgently" → Quick memory tools/methods > comprehensive Volatility analysis
|
|
||||||
|
|
||||||
4. **AVOID TOOL BIAS**:
|
|
||||||
- Volatility is NOT always the answer for memory analysis
|
|
||||||
- Wireshark is NOT always the answer for network analysis
|
|
||||||
- Autopsy is NOT always the answer for disk analysis
|
|
||||||
- Consider lighter, faster, more appropriate alternatives
|
|
||||||
|
|
||||||
AVAILABLE TOOLS (with complete data):
|
|
||||||
${JSON.stringify(toolsWithFullData.slice(0, 30), null, 2)}
|
${JSON.stringify(toolsWithFullData.slice(0, 30), null, 2)}
|
||||||
|
|
||||||
AVAILABLE CONCEPTS (with complete data):
|
VERFÜGBARE KONZEPTE (mit vollständigen Daten):
|
||||||
${JSON.stringify(conceptsWithFullData.slice(0, 10), null, 2)}
|
${JSON.stringify(conceptsWithFullData.slice(0, 10), null, 2)}`;
|
||||||
|
|
||||||
ANALYSIS INSTRUCTIONS:
|
|
||||||
1. Read the FULL description of each tool/concept
|
|
||||||
2. Consider ALL tags, platforms, related tools, and metadata
|
|
||||||
3. **MATCH URGENCY LEVEL**: Rapid scenarios need rapid methods, not deep analysis tools
|
|
||||||
4. **MATCH SPECIFICITY**: Specialized scenarios need specialized tools, not generic ones
|
|
||||||
5. **CONSIDER TYPE**: Methods provide procedural guidance, software provides technical capability
|
|
||||||
6. For SCADA/ICS queries: prioritize specialized ICS tools over generic network tools
|
|
||||||
7. For mobile queries: prioritize mobile-specific tools over desktop tools
|
|
||||||
8. For rapid/urgent queries: prioritize methodology and triage approaches
|
|
||||||
|
|
||||||
BIAS PREVENTION:
|
|
||||||
- If query mentions "rapid", "quick", "urgent", "triage" → Strongly favor METHODS over deep analysis SOFTWARE
|
|
||||||
- If query mentions specific technologies (SCADA, Android, etc.) → Strongly favor specialized tools
|
|
||||||
- Don't recommend Volatility unless deep memory analysis is specifically needed AND time allows
|
|
||||||
- Don't recommend generic tools when specialized ones are available
|
|
||||||
- Consider the SKILL LEVEL and TIME CONSTRAINTS implied by the query
|
|
||||||
|
|
||||||
Select the most relevant items (max ${this.maxSelectedItems} total).
|
|
||||||
|
|
||||||
Respond with ONLY this JSON format:
|
|
||||||
{
|
|
||||||
"selectedTools": ["Tool Name 1", "Tool Name 2", ...],
|
|
||||||
"selectedConcepts": ["Concept Name 1", "Concept Name 2", ...],
|
|
||||||
"reasoning": "Detailed explanation of why these specific tools were selected for this query, addressing why certain popular tools were NOT selected if they were inappropriate for the scenario context"
|
|
||||||
}`;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await this.callAI(prompt, 2500);
|
const response = await this.callAI(prompt, 2500);
|
||||||
@ -613,24 +556,7 @@ Respond with ONLY this JSON format:
|
|||||||
|
|
||||||
private async analyzeScenario(context: AnalysisContext): Promise<MicroTaskResult> {
|
private async analyzeScenario(context: AnalysisContext): Promise<MicroTaskResult> {
|
||||||
const isWorkflow = context.mode === 'workflow';
|
const isWorkflow = context.mode === 'workflow';
|
||||||
|
const prompt = getPrompt('scenarioAnalysis', isWorkflow, context.userQuery);
|
||||||
const prompt = `Sie sind ein erfahrener DFIR-Experte. Analysieren Sie das folgende ${isWorkflow ? 'forensische Szenario' : 'technische Problem'}.
|
|
||||||
|
|
||||||
${isWorkflow ? 'FORENSISCHES SZENARIO' : 'TECHNISCHES PROBLEM'}: "${context.userQuery}"
|
|
||||||
|
|
||||||
Führen Sie eine systematische ${isWorkflow ? 'Szenario-Analyse' : 'Problem-Analyse'} durch und berücksichtigen Sie dabei:
|
|
||||||
|
|
||||||
${isWorkflow ?
|
|
||||||
`- Angriffsvektoren und Bedrohungsmodellierung nach MITRE ATT&CK
|
|
||||||
- Betroffene Systeme und kritische Infrastrukturen
|
|
||||||
- Zeitkritische Faktoren und Beweiserhaltung
|
|
||||||
- Forensische Artefakte und Datenquellen` :
|
|
||||||
`- Spezifische forensische Herausforderungen
|
|
||||||
- Verfügbare Datenquellen und deren Integrität
|
|
||||||
- Methodische Anforderungen für rechtssichere Analyse`
|
|
||||||
}
|
|
||||||
|
|
||||||
WICHTIG: Antworten Sie NUR in fließendem deutschen Text ohne Listen, Aufzählungen oder Markdown-Formatierung. Maximum 150 Wörter.`;
|
|
||||||
|
|
||||||
const result = await this.callMicroTaskAI(prompt, context, 220);
|
const result = await this.callMicroTaskAI(prompt, context, 220);
|
||||||
|
|
||||||
@ -649,23 +575,7 @@ WICHTIG: Antworten Sie NUR in fließendem deutschen Text ohne Listen, Aufzählun
|
|||||||
|
|
||||||
private async generateApproach(context: AnalysisContext): Promise<MicroTaskResult> {
|
private async generateApproach(context: AnalysisContext): Promise<MicroTaskResult> {
|
||||||
const isWorkflow = context.mode === 'workflow';
|
const isWorkflow = context.mode === 'workflow';
|
||||||
|
const prompt = getPrompt('investigationApproach', isWorkflow, context.userQuery);
|
||||||
const prompt = `Basierend auf der Analyse entwickeln Sie einen fundierten ${isWorkflow ? 'Untersuchungsansatz' : 'Lösungsansatz'} nach NIST SP 800-86 Methodik.
|
|
||||||
|
|
||||||
${isWorkflow ? 'SZENARIO' : 'PROBLEM'}: "${context.userQuery}"
|
|
||||||
|
|
||||||
Entwickeln Sie einen systematischen ${isWorkflow ? 'Untersuchungsansatz' : 'Lösungsansatz'} unter Berücksichtigung von:
|
|
||||||
|
|
||||||
${isWorkflow ?
|
|
||||||
`- Triage-Prioritäten nach forensischer Dringlichkeit
|
|
||||||
- Phasenabfolge nach NIST-Methodik
|
|
||||||
- Kontaminationsvermeidung und forensische Isolierung` :
|
|
||||||
`- Methodik-Auswahl nach wissenschaftlichen Kriterien
|
|
||||||
- Validierung und Verifizierung der gewählten Ansätze
|
|
||||||
- Integration in bestehende forensische Workflows`
|
|
||||||
}
|
|
||||||
|
|
||||||
WICHTIG: Antworten Sie NUR in fließendem deutschen Text ohne Listen oder Markdown. Maximum 150 Wörter.`;
|
|
||||||
|
|
||||||
const result = await this.callMicroTaskAI(prompt, context, 220);
|
const result = await this.callMicroTaskAI(prompt, context, 220);
|
||||||
|
|
||||||
@ -679,25 +589,7 @@ WICHTIG: Antworten Sie NUR in fließendem deutschen Text ohne Listen oder Markdo
|
|||||||
|
|
||||||
private async generateCriticalConsiderations(context: AnalysisContext): Promise<MicroTaskResult> {
|
private async generateCriticalConsiderations(context: AnalysisContext): Promise<MicroTaskResult> {
|
||||||
const isWorkflow = context.mode === 'workflow';
|
const isWorkflow = context.mode === 'workflow';
|
||||||
|
const prompt = getPrompt('criticalConsiderations', isWorkflow, context.userQuery);
|
||||||
const prompt = `Identifizieren Sie ${isWorkflow ? 'kritische forensische Überlegungen' : 'wichtige methodische Voraussetzungen'} für diesen Fall.
|
|
||||||
|
|
||||||
${isWorkflow ? 'SZENARIO' : 'PROBLEM'}: "${context.userQuery}"
|
|
||||||
|
|
||||||
Berücksichtigen Sie folgende forensische Aspekte:
|
|
||||||
|
|
||||||
${isWorkflow ?
|
|
||||||
`- Time-sensitive evidence preservation
|
|
||||||
- Chain of custody requirements und rechtliche Verwertbarkeit
|
|
||||||
- Incident containment vs. evidence preservation Dilemma
|
|
||||||
- Privacy- und Compliance-Anforderungen` :
|
|
||||||
`- Tool-Validierung und Nachvollziehbarkeit
|
|
||||||
- False positive/negative Risiken bei der gewählten Methodik
|
|
||||||
- Qualifikationsanforderungen für die Durchführung
|
|
||||||
- Dokumentations- und Reporting-Standards`
|
|
||||||
}
|
|
||||||
|
|
||||||
WICHTIG: Antworten Sie NUR in fließendem deutschen Text ohne Listen oder Markdown. Maximum 120 Wörter.`;
|
|
||||||
|
|
||||||
const result = await this.callMicroTaskAI(prompt, context, 180);
|
const result = await this.callMicroTaskAI(prompt, context, 180);
|
||||||
|
|
||||||
@ -723,27 +615,7 @@ WICHTIG: Antworten Sie NUR in fließendem deutschen Text ohne Listen oder Markdo
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const prompt = `Wählen Sie 2-3 Methoden/Tools für die Phase "${phase.name}" basierend auf objektiven, fallbezogenen Kriterien.
|
const prompt = getPrompt('phaseToolSelection', context.userQuery, phase, phaseTools);
|
||||||
|
|
||||||
SZENARIO: "${context.userQuery}"
|
|
||||||
|
|
||||||
VERFÜGBARE TOOLS FÜR ${phase.name.toUpperCase()}:
|
|
||||||
${phaseTools.map((tool: any) => `- ${tool.name}: ${tool.description.slice(0, 100)}...`).join('\n')}
|
|
||||||
|
|
||||||
Wählen Sie Methoden/Tools nach forensischen Kriterien aus:
|
|
||||||
- Court admissibility und Chain of Custody Kompatibilität
|
|
||||||
- Integration in forensische Standard-Workflows
|
|
||||||
- Reproduzierbarkeit und Dokumentationsqualität
|
|
||||||
- Objektivität
|
|
||||||
|
|
||||||
Antworten Sie AUSSCHLIESSLICH mit diesem JSON-Format (kein zusätzlicher Text):
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"toolName": "Exakter Methoden/Tool-Name",
|
|
||||||
"priority": "high|medium|low",
|
|
||||||
"justification": "Objektive Begründung warum diese Methode/Tool für das spezifische Szenario besser geeignet ist"
|
|
||||||
}
|
|
||||||
]`;
|
|
||||||
|
|
||||||
const result = await this.callMicroTaskAI(prompt, context, 450);
|
const result = await this.callMicroTaskAI(prompt, context, 450);
|
||||||
|
|
||||||
@ -777,24 +649,7 @@ Antworten Sie AUSSCHLIESSLICH mit diesem JSON-Format (kein zusätzlicher Text):
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async evaluateSpecificTool(context: AnalysisContext, tool: any, rank: number): Promise<MicroTaskResult> {
|
private async evaluateSpecificTool(context: AnalysisContext, tool: any, rank: number): Promise<MicroTaskResult> {
|
||||||
const prompt = `Bewerten Sie diese Methode/Tool fallbezogen für das spezifische Problem nach forensischen Qualitätskriterien.
|
const prompt = getPrompt('toolEvaluation', context.userQuery, tool, rank);
|
||||||
|
|
||||||
PROBLEM: "${context.userQuery}"
|
|
||||||
|
|
||||||
TOOL: ${tool.name}
|
|
||||||
BESCHREIBUNG: ${tool.description}
|
|
||||||
PLATTFORMEN: ${tool.platforms?.join(', ') || 'N/A'}
|
|
||||||
SKILL LEVEL: ${tool.skillLevel}
|
|
||||||
|
|
||||||
Bewerten Sie nach forensischen Standards und antworten Sie AUSSCHLIESSLICH mit diesem JSON-Format:
|
|
||||||
{
|
|
||||||
"suitability_score": "high|medium|low",
|
|
||||||
"detailed_explanation": "Detaillierte forensische Begründung warum diese Methode/Tool das Problem löst",
|
|
||||||
"implementation_approach": "Konkrete methodische Schritte zur korrekten Anwendung für dieses spezifische Problem",
|
|
||||||
"pros": ["Forensischer Vorteil 1", "Validierter Vorteil 2"],
|
|
||||||
"cons": ["Methodische Limitation 1", "Potenzielle Schwäche 2"],
|
|
||||||
"alternatives": "Alternative Ansätze falls diese Methode/Tool nicht optimal ist"
|
|
||||||
}`;
|
|
||||||
|
|
||||||
const result = await this.callMicroTaskAI(prompt, context, 650);
|
const result = await this.callMicroTaskAI(prompt, context, 650);
|
||||||
|
|
||||||
@ -842,24 +697,7 @@ Bewerten Sie nach forensischen Standards und antworten Sie AUSSCHLIESSLICH mit d
|
|||||||
}
|
}
|
||||||
|
|
||||||
const selectedToolNames = context.selectedTools?.map(st => st.tool.name) || [];
|
const selectedToolNames = context.selectedTools?.map(st => st.tool.name) || [];
|
||||||
|
const prompt = getPrompt('backgroundKnowledgeSelection', context.userQuery, context.mode, selectedToolNames, availableConcepts);
|
||||||
const prompt = `Wählen Sie relevante forensische Konzepte für das Verständnis der empfohlenen Methodik.
|
|
||||||
|
|
||||||
${context.mode === 'workflow' ? 'SZENARIO' : 'PROBLEM'}: "${context.userQuery}"
|
|
||||||
EMPFOHLENE TOOLS: ${selectedToolNames.join(', ')}
|
|
||||||
|
|
||||||
VERFÜGBARE KONZEPTE:
|
|
||||||
${availableConcepts.slice(0, 15).map((concept: any) => `- ${concept.name}: ${concept.description.slice(0, 80)}...`).join('\n')}
|
|
||||||
|
|
||||||
Wählen Sie 2-4 Konzepte aus, die für das Verständnis der forensischen Methodik essentiell sind.
|
|
||||||
|
|
||||||
Antworten Sie AUSSCHLIESSLICH mit diesem JSON-Format:
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"conceptName": "Exakter Konzept-Name",
|
|
||||||
"relevance": "Forensische Relevanz: Warum dieses Konzept für das Verständnis der Methodik kritisch ist"
|
|
||||||
}
|
|
||||||
]`;
|
|
||||||
|
|
||||||
const result = await this.callMicroTaskAI(prompt, context, 400);
|
const result = await this.callMicroTaskAI(prompt, context, 400);
|
||||||
|
|
||||||
@ -889,26 +727,8 @@ Antworten Sie AUSSCHLIESSLICH mit diesem JSON-Format:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async generateFinalRecommendations(context: AnalysisContext): Promise<MicroTaskResult> {
|
private async generateFinalRecommendations(context: AnalysisContext): Promise<MicroTaskResult> {
|
||||||
const isWorkflow = context.mode === 'workflow';
|
const selectedToolNames = context.selectedTools?.map(st => st.tool.name) || [];
|
||||||
|
const prompt = getPrompt('finalRecommendations', context.mode === 'workflow', context.userQuery, selectedToolNames);
|
||||||
const prompt = isWorkflow ?
|
|
||||||
`Erstellen Sie eine forensisch fundierte Workflow-Empfehlung basierend auf DFIR-Prinzipien.
|
|
||||||
|
|
||||||
SZENARIO: "${context.userQuery}"
|
|
||||||
AUSGEWÄHLTE TOOLS: ${context.selectedTools?.map(st => st.tool.name).join(', ') || 'Keine Tools ausgewählt'}
|
|
||||||
|
|
||||||
Erstellen Sie konkrete methodische Workflow-Schritte für dieses spezifische Szenario unter Berücksichtigung forensischer Best Practices, Objektivität und rechtlicher Verwertbarkeit.
|
|
||||||
|
|
||||||
WICHTIG: Antworten Sie NUR in fließendem deutschen Text ohne Listen oder Markdown. Maximum 120 Wörter.` :
|
|
||||||
|
|
||||||
`Erstellen Sie wichtige methodische Überlegungen für die korrekte Methoden-/Tool-Anwendung.
|
|
||||||
|
|
||||||
PROBLEM: "${context.userQuery}"
|
|
||||||
EMPFOHLENE TOOLS: ${context.selectedTools?.map(st => st.tool.name).join(', ') || 'Keine Methoden/Tools ausgewählt'}
|
|
||||||
|
|
||||||
Geben Sie kritische methodische Überlegungen, Validierungsanforderungen und Qualitätssicherungsmaßnahmen für die korrekte Anwendung der empfohlenen Methoden/Tools.
|
|
||||||
|
|
||||||
WICHTIG: Antworten Sie NUR in fließendem deutschen Text ohne Listen oder Markdown. Maximum 100 Wörter.`;
|
|
||||||
|
|
||||||
const result = await this.callMicroTaskAI(prompt, context, 180);
|
const result = await this.callMicroTaskAI(prompt, context, 180);
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user