From d46898642810d292930a41d14477dfb19382949b Mon Sep 17 00:00:00 2001 From: shadow1ng Date: Thu, 7 Jan 2021 13:13:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=9A=E4=B8=AA=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=AE=A4=E8=AF=81=E6=88=90=E5=8A=9F=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82=E7=84=B6=E5=90=8E=E7=94=B1=E4=BA=8Esmb?= =?UTF-8?q?=E8=AF=AF=E6=8A=A5=E7=8E=87=E8=BE=83=E9=AB=98=EF=BC=8C=E5=B0=86?= =?UTF-8?q?=E4=BC=9A=E9=BB=98=E8=AE=A4=E4=B8=8D=E5=BC=80=E5=90=AF=E4=BA=86?= =?UTF-8?q?=EF=BC=8C=E5=BE=85=E5=8A=A0=E5=85=A5smb=E6=8C=87=E7=BA=B9?= =?UTF-8?q?=E5=90=8E=E5=86=8D=E5=BC=80=E5=90=AF=EF=BC=8C=E4=BD=86=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5-m=20smb=E7=94=A8=E4=BA=8E=E5=8F=A3=E4=BB=A4=E7=A2=B0?= =?UTF-8?q?=E6=92=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plugins/scanner.go | 7 +++---- Plugins/smb.go | 17 ++++++++--------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Plugins/scanner.go b/Plugins/scanner.go index 528373d..9c35250 100644 --- a/Plugins/scanner.go +++ b/Plugins/scanner.go @@ -33,15 +33,14 @@ func Scan(info common.HostInfo) { for _, targetIP := range AlivePorts { info.Host, info.Ports = strings.Split(targetIP, ":")[0], strings.Split(targetIP, ":")[1] if info.Scantype == "all" { - if IsContain(severports, info.Ports) { - AddScan(info.Ports, info, ch, &wg) - } else if info.Ports == "445" { //scan more vul + if info.Ports == "445" { //scan more vul AddScan("1000001", info, ch, &wg) AddScan("1000002", info, ch, &wg) + } else if IsContain(severports, info.Ports) { + AddScan(info.Ports, info, ch, &wg) } else { AddScan("1000003", info, ch, &wg) //webtitle } - } else { port, _ := common.PortlistBack[info.Scantype] scantype := strconv.Itoa(port) diff --git a/Plugins/smb.go b/Plugins/smb.go index 83634dc..6307b02 100644 --- a/Plugins/smb.go +++ b/Plugins/smb.go @@ -14,6 +14,13 @@ func SmbScan(info *common.HostInfo) (tmperr error) { pass = strings.Replace(pass, "{user}", user, -1) flag, err := doWithTimeOut(info, user, pass) if flag == true && err == nil { + var result string + if info.Domain != "" { + result = fmt.Sprintf("SMB:%v:%v:%v\\%v %v", info.Host, info.Ports, info.Domain, user, pass) + } else { + result = fmt.Sprintf("SMB:%v:%v:%v %v", info.Host, info.Ports, user, pass) + } + common.LogSuccess(result) return err } else { tmperr = err @@ -25,7 +32,7 @@ func SmbScan(info *common.HostInfo) (tmperr error) { func SmblConn(info *common.HostInfo, user string, pass string, Domain string, signal chan struct{}) (flag bool, err error) { flag = false - Host, Port, Username, Password := info.Host, common.PORTList["smb"], user, pass + Host, Username, Password := info.Host, user, pass options := smb.Options{ Host: Host, Port: 445, @@ -39,13 +46,6 @@ func SmblConn(info *common.HostInfo, user string, pass string, Domain string, si if err == nil { session.Close() if session.IsAuthenticated { - var result string - if Domain != "" { - result = fmt.Sprintf("SMB:%v:%v:%v\\%v %v", Host, Port, Domain, Username, Password) - } else { - result = fmt.Sprintf("SMB:%v:%v:%v %v", Host, Port, Username, Password) - } - common.LogSuccess(result) flag = true } } @@ -64,5 +64,4 @@ func doWithTimeOut(info *common.HostInfo, user string, pass string) (flag bool, case <-time.After(time.Duration(info.Timeout) * time.Second): return false, err } - }