forked from alphasoc/flightsim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
64 lines (49 loc) · 1.32 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
package main
import (
"flag"
"fmt"
"os"
"github.com/alphasoc/flightsim/cmd/run"
)
var Version = ""
var usage = `AlphaSOC Network Flight Simulator™ (https://github.com/alphasoc/flightsim)
flightsim is an application which generates malicious network traffic for security
teams to evaluate security controls (e.g. firewalls) and ensure that monitoring tools
are able to detect malicious traffic.
Usage:
flightsim <command> [arguments]
Available commands:
run Run all modules, or a particular module
version Prints the version number
Cheatsheet:
flightsim run Run all the modules
flightsim run c2 Simulate C2 traffic
flightsim run c2:trickbot Simulate C2 traffic for the TrickBot family
`
func main() {
cmdRoot := flag.NewFlagSet("flightsim", flag.ExitOnError)
cmdRoot.Usage = func() {
fmt.Fprintln(os.Stderr, usage)
}
cmdRoot.Parse(os.Args[1:])
if len(cmdRoot.Args()) == 0 {
cmdRoot.Usage()
os.Exit(1)
}
cmd, args := cmdRoot.Arg(0), cmdRoot.Args()[1:]
var err error
switch cmd {
case "run":
run.Version = Version
err = run.RunCmd(args)
case "version":
fmt.Printf("flightsim version %s\n", Version)
return
default:
err = fmt.Errorf("invalid command: %s", cmd)
}
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
}
}