From fddfd08d01716e684f8a7e32e3ad02a1d3056190 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:22:32 +0800 Subject: [PATCH] Update CVE-2020-0796.go --- Plugins/CVE-2020-0796.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/Plugins/CVE-2020-0796.go b/Plugins/CVE-2020-0796.go index 5eb7cb0..3123f1c 100644 --- a/Plugins/CVE-2020-0796.go +++ b/Plugins/CVE-2020-0796.go @@ -94,18 +94,18 @@ const ( "\x00\x00\x00\x00" ) -func SmbGhost(info common.HostInfo, flags common.Flags) error { - if flags.IsBrute { +func SmbGhost(info *common.HostInfo) error { + if common.IsBrute { return nil } - err := SmbGhostScan(info, flags) + err := SmbGhostScan(info) return err } -func SmbGhostScan(info common.HostInfo, flags common.Flags) error { - ip, port, timeout := info.Host, 445, time.Duration(flags.Timeout)*time.Second +func SmbGhostScan(info *common.HostInfo) error { + ip, port, timeout := info.Host, 445, time.Duration(common.Timeout)*time.Second addr := fmt.Sprintf("%s:%v", info.Host, port) - conn, err := common.WrapperTcpWithTimeout("tcp", addr, common.Socks5{Address: flags.Socks5Proxy}, timeout) + conn, err := common.WrapperTcpWithTimeout("tcp", addr, timeout) defer func() { if conn != nil { conn.Close() @@ -119,15 +119,12 @@ func SmbGhostScan(info common.HostInfo, flags common.Flags) error { return err } buff := make([]byte, 1024) - - _ = conn.SetReadDeadline(time.Now().Add(timeout)) - + err = conn.SetReadDeadline(time.Now().Add(timeout)) n, err := conn.Read(buff) if err != nil { return err } - - if bytes.Contains(buff[:n], []byte("Public")) { + if bytes.Contains(buff[:n], []byte("Public")) == true { result := fmt.Sprintf("[+] %v CVE-2020-0796 SmbGhost Vulnerable", ip) common.LogSuccess(result)