From 2d10162749b592e71eff760fa36b3f692a081b0c Mon Sep 17 00:00:00 2001 From: SleepingBag945 <794087777@qq.com> Date: Mon, 28 Aug 2023 03:58:19 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dfindnet=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E4=B8=BB=E6=9C=BA=E5=90=8D=E4=B9=B1=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plugins/findnet.go | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/Plugins/findnet.go b/Plugins/findnet.go index 5c1e1b7..7ba16ca 100644 --- a/Plugins/findnet.go +++ b/Plugins/findnet.go @@ -5,6 +5,7 @@ import ( "encoding/hex" "fmt" "github.com/shadow1ng/fscan/common" + "strconv" "strings" "time" ) @@ -66,12 +67,54 @@ func FindnetScan(info *common.HostInfo) error { err = read(text, info.Host) return err } + +func HexUnicodeStringToString(src string) string { + sText := "" + if len(src)%4 != 0 { + src += src[:len(src)-len(src)%4] + } + for i := 0; i < len(src); i = i + 4 { + sText += "\\u" + src[i+2:i+4] + src[i:i+2] + } + + textUnquoted := sText + sUnicodev := strings.Split(textUnquoted, "\\u") + var context string + for _, v := range sUnicodev { + if len(v) < 1 { + continue + } + temp, err := strconv.ParseInt(v, 16, 32) + if err != nil { + return "" + } + context += fmt.Sprintf("%c", temp) + } + return context +} + func read(text []byte, host string) error { encodedStr := hex.EncodeToString(text) + + hn := "" + for i := 0; i < len(encodedStr)-4; i = i + 4 { + if encodedStr[i:i+4] == "0000" { + break + } + hn += encodedStr[i : i+4] + } + + var name string + name = HexUnicodeStringToString(hn) + hostnames := strings.Replace(encodedStr, "0700", "", -1) hostname := strings.Split(hostnames, "000000") result := "[*] NetInfo:\n[*]" + host - for i := 0; i < len(hostname); i++ { + if name != "" { + result += "\n [->]" + name + } + + for i := 1; i < len(hostname); i++ { hostname[i] = strings.Replace(hostname[i], "00", "", -1) host, err := hex.DecodeString(hostname[i]) if err != nil { From 9f12983f34cf0e1ee66bde46b27b772690179770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=B1=E8=88=9E=E8=80=85?= Date: Mon, 13 Nov 2023 10:02:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dfindnet=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E4=B8=BB=E6=9C=BA=E5=90=8D=E4=B9=B1=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plugins/findnet.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/findnet.go b/Plugins/findnet.go index 7ba16ca..2d8d0c5 100644 --- a/Plugins/findnet.go +++ b/Plugins/findnet.go @@ -113,8 +113,8 @@ func read(text []byte, host string) error { if name != "" { result += "\n [->]" + name } - - for i := 1; i < len(hostname); i++ { + hostname = hostname[1:] + for i := 0; i < len(hostname); i++ { hostname[i] = strings.Replace(hostname[i], "00", "", -1) host, err := hex.DecodeString(hostname[i]) if err != nil {