-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
66 lines (56 loc) · 1.25 KB
/
main.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
56
57
58
59
60
61
62
63
64
65
66
package main
import (
"crypto/tls"
"flag"
"log"
"strings"
"time"
"github.com/mrtdeh/testeps/pkg/core"
)
var (
dest, sources *string
dstport *int
inifity *bool
delay *int64
threads *int
showSources, editSources *bool
tlsConfig *tls.Config
SendDelay time.Duration
)
func main() {
err := core.LoadSetting()
if err != nil {
log.Fatal(err)
}
// switchs
dest = flag.String("h", "", "destination host/ip")
dstport = flag.Int("p", 0, "destination port")
sources = flag.String("s", "", "sources")
inifity = flag.Bool("i", false, "inifity mode")
delay = flag.Int64("d", 0, "delay for each turn in inifity mode (miliseconds)")
threads = flag.Int("t", 1, "threads count")
// commands
showSources = flag.Bool("show", false, "show sources list")
editSources = flag.Bool("edit", false, "edit sources")
flag.Parse()
if *showSources {
core.PrintSources()
return
}
if *editSources {
core.EditSources()
return
}
var incs []string
if *sources != "" {
incs = strings.Split(*sources, ",")
}
core.Run(core.Config{
DestinationIp: *dest,
DestinationPort: *dstport,
Sources: incs,
SendDelay: time.Duration(*delay) * time.Millisecond,
Inifity: *inifity,
ThreadsCount: *threads,
})
}