Skip to content

armgit / strix

Public Imported from GitHub
0

Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.

feat(tui): list the run's targets in the sidebar stats panel

Ianb68cdb8edc35
diff --git a/strix/interface/tui/internal/app/panels_test.go b/strix/interface/tui/internal/app/panels_test.go
index 0e783e9e..3a2ef61c 100644
--- a/strix/interface/tui/internal/app/panels_test.go
+++ b/strix/interface/tui/internal/app/panels_test.go
@@ -355,3 +355,17 @@ func TestLonePanelHasNoControls(t *testing.T) {
t.Fatalf("controls should return once a second panel exists")
}
}
+
+func TestStatsPanelListsTargets(t *testing.T) {
+ m := panelsModel(t)
+ m.snapshot.Targets = []string{"https://example.com", "./app"}
+ m.snapshot.TargetCount = 2
+ m.resizeViewport()
+ _, sidebarWidth, _, _ := m.layout()
+ view := ansi.Strip(m.sidebarView(sidebarWidth, m.height))
+ for _, want := range []string{"Targets 2", "▸ https://example.com", "▸ ./app"} {
+ if !strings.Contains(view, want) {
+ t.Fatalf("sidebar missing %q:\n%s", want, view)
+ }
+ }
+}
diff --git a/strix/interface/tui/internal/app/setup.go b/strix/interface/tui/internal/app/setup.go
index 89e5cb24..24ed7473 100644
--- a/strix/interface/tui/internal/app/setup.go
+++ b/strix/interface/tui/internal/app/setup.go
@@ -421,7 +421,7 @@ func (m Model) setupComposer(width int) string {
inner := max(1, width-4)
body := m.highlightInputSelection(m.input.View())
body += "\n\n" + m.setupSummaryView(inner)
- if targets := m.setupTargetsView(inner); targets != "" {
+ if targets := m.targetsView(inner); targets != "" {
body += "\n" + targets
}
return lipgloss.NewStyle().Width(max(1, width-2)).Padding(0, 1).
@@ -454,8 +454,8 @@ func (m Model) setupSummaryView(width int) string {
return truncate(strings.Join(chips, render.Dim().Render(" · ")), max(1, width))
}
-// setupTargetsView lists what the scan is pointed at, once anything is queued.
-func (m Model) setupTargetsView(width int) string {
+// targetsView lists what the scan is pointed at, once anything is queued.
+func (m Model) targetsView(width int) string {
if len(m.snapshot.Targets) == 0 {
return ""
}
diff --git a/strix/interface/tui/internal/app/view.go b/strix/interface/tui/internal/app/view.go
index a723919e..ade70f1b 100644
--- a/strix/interface/tui/internal/app/view.go
+++ b/strix/interface/tui/internal/app/view.go
@@ -694,6 +694,12 @@ func (m Model) statsView() string {
b.WriteString(w.Render(fmt.Sprintf(" · $%.2f", cost)))
}
}
+ if targets := m.targetsView(m.sidebarInnerWidth()); targets != "" {
+ if b.Len() > 0 {
+ b.WriteString("\n")
+ }
+ b.WriteString(targets)
+ }
if caido := m.snapshot.CaidoURL; caido != "" {
if b.Len() > 0 {
b.WriteString("\n")