-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
52 lines (43 loc) · 1.07 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
package main
import (
"flag"
"fmt"
"github.com/maride/afl-transmit/net"
"github.com/maride/afl-transmit/stats"
"github.com/maride/afl-transmit/watchdog"
"log"
)
var (
outputDirectory string
)
func main() {
// Register flags
watchdog.RegisterWatchdogFlags()
net.RegisterSenderFlags()
net.RegisterListenFlags()
net.RegisterCryptFlags()
stats.RegisterStatsFlags()
RegisterGlobalFlags()
flag.Parse()
// Read peers file
net.ReadPeers()
// Initialize crypto if desired
cryptErr := net.InitCrypt()
if cryptErr != nil {
fmt.Printf("Failed to initialize crypt function: %s", cryptErr)
return
}
// Start watchdog for local afl instances
go watchdog.WatchFuzzers(outputDirectory)
// Start stat printer
go stats.PrintStats()
// Listen for incoming connections
listenErr := net.Listen(outputDirectory)
if listenErr != nil {
log.Println(listenErr)
}
}
// Registers flags which are required by multiple modules and need to be handled here
func RegisterGlobalFlags() {
flag.StringVar(&outputDirectory, "fuzzer-directory", "", "The output directory of the fuzzer(s)")
}