fix: do not show empty zeroconf fields
Some checks failed
Build and Push Docker Images / docker (push) Has been cancelled
Linux tests / build (1.22.x, ubuntu-latest) (push) Has been cancelled
macOS tests / build (1.22.x, macos-latest) (push) Has been cancelled
Windows tests / build (1.22.x, windows-latest) (push) Has been cancelled

This commit is contained in:
evilsocket 2025-07-10 13:02:11 +02:00
commit aa819862eb

View file

@ -61,15 +61,24 @@ func (mod *ZeroGod) show(filter string, withData bool) error {
for _, field := range svc.Text { for _, field := range svc.Text {
if field = str.Trim(field); len(field) > 0 { if field = str.Trim(field); len(field) > 0 {
keyval := strings.SplitN(field, "=", 2) keyval := strings.SplitN(field, "=", 2)
rows = append(rows, []string{ key := str.Trim(keyval[0])
keyval[0], val := str.Trim(keyval[1])
keyval[1],
}) if key != "" || val != "" {
rows = append(rows, []string{
key,
val,
})
}
} }
} }
tui.Table(mod.Session.Events.Stdout, columns, rows) if len(rows) == 0 {
fmt.Fprintf(mod.Session.Events.Stdout, "\n") fmt.Fprintf(mod.Session.Events.Stdout, " %s\n", tui.Dim("no data"))
} else {
tui.Table(mod.Session.Events.Stdout, columns, rows)
fmt.Fprintf(mod.Session.Events.Stdout, "\n")
}
} else { } else {
fmt.Fprintf(mod.Session.Events.Stdout, " %s\n", tui.Dim("no data")) fmt.Fprintf(mod.Session.Events.Stdout, " %s\n", tui.Dim("no data"))