From 3d18716f91979014b8054430cc62b95596b31648 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Wed, 15 Mar 2023 09:19:28 +0100 Subject: [PATCH] adding support for ufile (#357) --- pkg/output/fields.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/output/fields.go b/pkg/output/fields.go index 6b7c6217..1a6a9b34 100644 --- a/pkg/output/fields.go +++ b/pkg/output/fields.go @@ -22,6 +22,7 @@ var FieldNames = []string{ "qurl", "qpath", "file", + "ufile", "key", "value", "kv", @@ -160,6 +161,13 @@ func formatField(output *Result, fields string) []fieldOutput { svalue = append(svalue, fieldOutput{field: "file", value: basePath}) } } + case "ufile": + if parsed.Path != "" && parsed.Path != "/" { + basePath := path.Base(parsed.Path) + if strings.Contains(basePath, ".") { + svalue = append(svalue, fieldOutput{field: "ufile", value: parsed.String()}) + } + } case "udir": if parsed.Path != "" && parsed.Path != "/" { if strings.Contains(parsed.Path[1:], "/") { @@ -199,6 +207,11 @@ func getValueForField(output *Result, parsed *url.URL, hostname, rdn, rurl, fiel return rdn case "rurl": return rurl + case "ufile": + basePath := path.Base(parsed.Path) + if parsed.Path != "" && parsed.Path != "/" && strings.Contains(basePath, ".") { + return parsed.String() + } case "file": basePath := path.Base(parsed.Path) if parsed.Path != "" && parsed.Path != "/" && strings.Contains(basePath, ".") {