Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ui/cli_findings.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def _navigate_grouped_finding(self, filepath: Path) -> None:
# Show response
if current_finding.get("response"):
response_text = current_finding["response"]
self.console.print(Panel(response_text, title="Response", style="green"))
self.console.print(Panel(response_text, title="Response", style="blue"))

# Show commands
self.console.print("\n[yellow]Commands:[/yellow]")
Expand Down
6 changes: 3 additions & 3 deletions src/ui/cli_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def _display_test_result(self, result: TestResult) -> None:

# Response with standardized color
formatted_response = f"[bold green]{result.response}[/bold green]"
self.console.print(Panel(formatted_response, title="Final Response", style="green"))
self.console.print(Panel(formatted_response, title="Final Response", style="blue"))

else:
# Single-turn display with standardized colors
Expand All @@ -325,7 +325,7 @@ def _display_test_result(self, result: TestResult) -> None:

# Response - always show full response
formatted_response = f"[bold green]{result.response}[/bold green]"
self.console.print(Panel(formatted_response, title="Response", style="green"))
self.console.print(Panel(formatted_response, title="Response", style="blue"))

# Display evidence if any
if result.evidence:
Expand Down Expand Up @@ -810,7 +810,7 @@ def _copy_response_to_clipboard(self) -> None:
if self.console:
self.console.print(f"[yellow]⚠️ Clipboard unavailable ({e})[/yellow]")
self.console.print("[yellow]Here is the response to copy manually:[/yellow]")
self.console.print(Panel(response_text, title="Response", style="green"))
self.console.print(Panel(response_text, title="Response", style="blue"))
else:
print(f"⚠️ Clipboard unavailable ({e})")
print("Here is the response to copy manually:")
Expand Down
50 changes: 32 additions & 18 deletions src/utils/live_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def show_response(self, progress: TestProgress, response: ModelResponse) -> None
Text(response_content, style="white"),
title=title,
title_align="left",
style="green",
style="blue",
padding=(1, 2),
)
self.console.print(response_panel)
Expand All @@ -421,35 +421,43 @@ def show_evaluation(self, progress: TestProgress, evaluation: EvaluationResult)
progress.current_step = "Evaluation complete"
progress.evaluation_done = True

# Vulnerability status
vuln_status = "🔴 YES" if evaluation.is_vulnerable else "🟢 NO"
confidence = f"{evaluation.confidence:.2f}"
# Build dynamic title with result and confidence
if evaluation.is_vulnerable:
title = f"🔴 Evaluated as VULNERABLE (confidence: {evaluation.confidence:.2f})"
panel_style = "red"
else:
title = f"✅ Evaluated as NOT vulnerable (confidence: {evaluation.confidence:.2f})"
panel_style = "green"

if self.console:
# Create evaluation table
eval_table = Table(show_header=False, box=None, padding=(0, 1))
eval_table.add_column("Field", style="cyan bold")
eval_table.add_column("Value")

eval_table.add_row("Vulnerable:", vuln_status)
eval_table.add_row("Confidence:", confidence)
# Create simplified content - only evidence and reasoning
content_parts = []

if evaluation.evidence:
evidence_text = "\n".join(f"• {e}" for e in evaluation.evidence)
eval_table.add_row("Evidence:", evidence_text)
content_parts.append(f"Evidence:\n{evidence_text}")

if evaluation.reasoning:
eval_table.add_row("Reasoning:", evaluation.reasoning)
content_parts.append(f"Reasoning: {evaluation.reasoning}")

# If no evidence or reasoning, show a simple message
if not content_parts:
content_parts.append("No additional details available")

content = "\n\n".join(content_parts)

eval_panel = Panel(
eval_table, title="🔍 EVALUATION", title_align="left", style="blue", padding=(1, 2)
Text(content, style="white"),
title=title,
title_align="left",
style=panel_style,
padding=(0, 1),
)
self.console.print(eval_panel)

else:
print("\n🔍 EVALUATION:")
print(f" Vulnerable: {vuln_status}")
print(f" Confidence: {confidence}")
# Fallback for non-Rich terminals
print(f"\n{title}:")

if evaluation.evidence:
print(" Evidence:")
Expand All @@ -459,6 +467,9 @@ def show_evaluation(self, progress: TestProgress, evaluation: EvaluationResult)
if evaluation.reasoning:
print(f" Reasoning: {evaluation.reasoning}")

if not evaluation.evidence and not evaluation.reasoning:
print(" No additional details available")

def complete_test(self, progress: TestProgress, evaluation: EvaluationResult) -> None:
"""Mark test as complete"""
total_time = time.time() - progress.start_time
Expand Down Expand Up @@ -607,6 +618,9 @@ def show_vulnerability_summary(self, test_id: str, repetitions: list[dict[str, A

vulnerability_rate = (vulnerable_runs / total_runs) * 100

# Dynamic color based on vulnerability results
summary_style = "red" if vulnerable_runs > 0 else "green"

if self.console:
summary_table = Table(show_header=False, box=None, padding=(0, 1))
summary_table.add_column("Field", style="cyan bold")
Expand All @@ -623,7 +637,7 @@ def show_vulnerability_summary(self, test_id: str, repetitions: list[dict[str, A
summary_table,
title=f"📊 Vulnerability Summary for {test_id}",
title_align="left",
style="blue",
style=summary_style,
padding=(1, 2),
)
self.console.print(summary_panel)
Expand Down