From 338967bde468d72c44082956c28cdb5793ebd326 Mon Sep 17 00:00:00 2001 From: veo <38176360+veo@users.noreply.github.com> Date: Thu, 28 Apr 2022 15:03:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9F=9F=E5=90=8D=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=AD=A3=E5=B8=B8=E6=89=AB=E6=8F=8F=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8Clog4j=E6=89=AB=E6=8F=8FDNSLOG=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=9F=9F=E5=90=8D=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/naabu/v2/pkg/runner/targets.go | 8 +++++--- pocs_go/log4j/check.go | 8 ++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pkg/naabu/v2/pkg/runner/targets.go b/pkg/naabu/v2/pkg/runner/targets.go index a35e812d..dff45380 100644 --- a/pkg/naabu/v2/pkg/runner/targets.go +++ b/pkg/naabu/v2/pkg/runner/targets.go @@ -122,9 +122,11 @@ func (r *Runner) AddTarget(target string) error { gologger.Warning().Msgf("%s\n", err) } } else { - if u, err := url.Parse(target); err == nil { - Naabubuffer.Write([]byte(fmt.Sprintf("%s\n", fmt.Sprintf("%s://%s", u.Scheme, u.Host)))) - return nil + if strings.HasPrefix(target, "http://") || strings.HasPrefix(target, "https://") { + if u, err := url.Parse(target); err == nil { + Naabubuffer.Write([]byte(fmt.Sprintf("%s\n", fmt.Sprintf("%s://%s", u.Scheme, u.Host)))) + return nil + } } ips, err := r.resolveFQDN(target) if err != nil { diff --git a/pocs_go/log4j/check.go b/pocs_go/log4j/check.go index 0c66689d..66838c98 100644 --- a/pocs_go/log4j/check.go +++ b/pocs_go/log4j/check.go @@ -11,7 +11,11 @@ import ( func Check(u string, finalURL string) bool { if (pkg.CeyeApi != "" && pkg.CeyeDomain != "") || jndi.JndiAddress != "" { - randomstr := pkg.RandomStr() + "log4j" + var host = "null" + randomstr := pkg.RandomStr() + if ux, err := url.Parse(u); err == nil { + host = strings.Replace(ux.Host, ":", ".", -1) + } domainx, intputs := getinputurl(finalURL) domainx = append(domainx, u) intputs = append(intputs, "x") @@ -21,7 +25,7 @@ func Check(u string, finalURL string) bool { if jndi.JndiAddress != "" { uri = jndi.JndiAddress + "/" + randomstr + "/" } else if pkg.CeyeApi != "" && pkg.CeyeDomain != "" { - uri = randomstr + "." + pkg.CeyeDomain + uri = randomstr + "." + host + "." + pkg.CeyeDomain } payload = strings.Replace(payload, "dnslog-url", uri, -1) header := make(map[string]string)