From 30c4c320a6172b114d51f224ff0ccc1159889013 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Tue, 1 Oct 2024 14:20:14 +0200 Subject: [PATCH] misc: more compact zerogod.show --- modules/zerogod/zerogod_ipp_get_job_attributes.go | 2 +- modules/zerogod/zerogod_show.go | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/zerogod/zerogod_ipp_get_job_attributes.go b/modules/zerogod/zerogod_ipp_get_job_attributes.go index 842b4fbc..14f63201 100644 --- a/modules/zerogod/zerogod_ipp_get_job_attributes.go +++ b/modules/zerogod/zerogod_ipp_get_job_attributes.go @@ -67,7 +67,7 @@ func ippOnGetJobAttributes(ctx *HandlerContext, ipp_req *ipp.Request) { } ipp_resp.OperationAttributes["job-originating-user-name"] = []ipp.Attribute{ { - Value: "bettercap", // TODO: check if this must match the actual job user from a print operation + Value: "bettercap", Tag: ipp.TagName, }, } diff --git a/modules/zerogod/zerogod_show.go b/modules/zerogod/zerogod_show.go index 92140d14..3a47e020 100644 --- a/modules/zerogod/zerogod_show.go +++ b/modules/zerogod/zerogod_show.go @@ -30,11 +30,18 @@ func (mod *ZeroGod) show(filter string, withData bool) error { } for _, svc := range entry.Services { - fmt.Fprintf(mod.Session.Events.Stdout, " %s (%s) [%v / %v]:%s\n", + ip := "" + if len(svc.AddrIPv4) > 0 { + ip = svc.AddrIPv4[0].String() + } else if len(svc.AddrIPv6) > 0 { + ip = svc.AddrIPv6[0].String() + } else { + ip = svc.HostName + } + + fmt.Fprintf(mod.Session.Events.Stdout, " %s %s:%s\n", tui.Green(svc.ServiceInstanceName()), - tui.Dim(svc.HostName), - svc.AddrIPv4, - svc.AddrIPv6, + ip, tui.Red(fmt.Sprintf("%d", svc.Port)), )