flags to struct

This commit is contained in:
noname
2023-06-09 08:13:56 -04:00
parent 04a7ba1357
commit 29b746ee80
32 changed files with 507 additions and 457 deletions
+10 -9
View File
@@ -5,9 +5,10 @@ import (
"encoding/hex"
"errors"
"fmt"
"github.com/shadow1ng/fscan/common"
"strings"
"time"
"github.com/shadow1ng/fscan/common"
)
var (
@@ -23,11 +24,11 @@ var (
trans2SessionSetupRequest, _ = hex.DecodeString(AesDecrypt(trans2SessionSetupRequest_enc, key))
)
func MS17010(info *common.HostInfo) error {
if common.IsBrute {
func MS17010(info common.HostInfo, flags common.Flags) error {
if flags.IsBrute {
return nil
}
err := MS17010Scan(info)
err := MS17010Scan(info, flags)
if err != nil {
errlog := fmt.Sprintf("[-] Ms17010 %v %v", info.Host, err)
common.LogError(errlog)
@@ -35,10 +36,10 @@ func MS17010(info *common.HostInfo) error {
return err
}
func MS17010Scan(info *common.HostInfo) error {
func MS17010Scan(info common.HostInfo, flags common.Flags) error {
ip := info.Host
// connecting to a host in LAN if reachable should be very quick
conn, err := common.WrapperTcpWithTimeout("tcp", ip+":445", time.Duration(common.Timeout)*time.Second)
conn, err := common.WrapperTcpWithTimeout("tcp", ip+":445", common.Socks5{Address: flags.Socks5Proxy}, time.Duration(flags.Timeout)*time.Second)
defer func() {
if conn != nil {
conn.Close()
@@ -48,7 +49,7 @@ func MS17010Scan(info *common.HostInfo) error {
//fmt.Printf("failed to connect to %s\n", ip)
return err
}
err = conn.SetDeadline(time.Now().Add(time.Duration(common.Timeout) * time.Second))
err = conn.SetDeadline(time.Now().Add(time.Duration(flags.Timeout) * time.Second))
if err != nil {
//fmt.Printf("failed to connect to %s\n", ip)
return err
@@ -137,8 +138,8 @@ func MS17010Scan(info *common.HostInfo) error {
result := fmt.Sprintf("[+] %s\tMS17-010\t(%s)", ip, os)
common.LogSuccess(result)
defer func() {
if common.SC != "" {
MS17010EXP(info)
if flags.SC != "" {
MS17010EXP(info, flags)
}
}()
// detect present of DOUBLEPULSAR SMB implant