diff --git a/Plugins/rdp.go b/Plugins/rdp.go index 694d295..2754a9a 100644 --- a/Plugins/rdp.go +++ b/Plugins/rdp.go @@ -3,13 +3,6 @@ package Plugins import ( "errors" "fmt" - "log" - "os" - "strconv" - "strings" - "sync" - "time" - "github.com/shadow1ng/fscan/common" "github.com/tomatome/grdp/core" "github.com/tomatome/grdp/glog" @@ -20,6 +13,12 @@ import ( "github.com/tomatome/grdp/protocol/t125" "github.com/tomatome/grdp/protocol/tpkt" "github.com/tomatome/grdp/protocol/x224" + "log" + "os" + "strconv" + "strings" + "sync" + "time" ) type Brutelist struct { @@ -27,13 +26,11 @@ type Brutelist struct { pass string } -var sock5Proxy common.Socks5 = common.Socks5{Address: ""} - -func RdpScan(info common.HostInfo, flags common.Flags) (tmperr error) { - if flags.IsBrute { +func RdpScan(info *common.HostInfo) (tmperr error) { + if common.IsBrute { return } - sock5Proxy = common.Socks5{Address: flags.Socks5Proxy} + var wg sync.WaitGroup var signal bool var num = 0 @@ -49,9 +46,9 @@ func RdpScan(info common.HostInfo, flags common.Flags) (tmperr error) { } } - for i := 0; i < flags.BruteThread; i++ { + for i := 0; i < common.BruteThread; i++ { wg.Add(1) - go worker(info.Host, flags.Domain, port, &wg, brlist, &signal, &num, all, &mutex, flags.Timeout) + go worker(info.Host, common.Domain, port, &wg, brlist, &signal, &num, all, &mutex, common.Timeout) } close(brlist) @@ -110,14 +107,13 @@ func RdpConn(ip, domain, user, password string, port int, timeout int64) (bool, } type Client struct { - Host string // ip:port - proxy common.Socks5 - tpkt *tpkt.TPKT - x224 *x224.X224 - mcs *t125.MCSClient - sec *sec.Client - pdu *pdu.Client - vnc *rfb.RFB + Host string // ip:port + tpkt *tpkt.TPKT + x224 *x224.X224 + mcs *t125.MCSClient + sec *sec.Client + pdu *pdu.Client + vnc *rfb.RFB } func NewClient(host string, logLevel glog.LEVEL) *Client { @@ -129,12 +125,8 @@ func NewClient(host string, logLevel glog.LEVEL) *Client { } } -func (g *Client) setProxy(proxy common.Socks5) { - g.proxy = proxy -} - func (g *Client) Login(domain, user, pwd string, timeout int64) error { - conn, err := common.WrapperTcpWithTimeout("tcp", g.Host, sock5Proxy, time.Duration(timeout)*time.Second) + conn, err := common.WrapperTcpWithTimeout("tcp", g.Host, time.Duration(timeout)*time.Second) defer func() { if conn != nil { conn.Close()