-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
63 lines (56 loc) · 1.71 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
package main
import (
"flag"
"fmt"
"os"
"github.com/k-sau/bbrf-amass/pkg/bbrf"
"github.com/k-sau/bbrf-amass/pkg/core"
)
func main() {
filePath := flag.String("path", "", "Full path to amass json output.")
program := flag.String("p", "", "Program id. Required.")
help := flag.Bool("h", false, "Prints available flags")
service := flag.Bool("service", false, "Takes input from stdin in format of ip;port;service-name. Supports ipv6")
bbrfConfigFile := flag.String("bc", "~/.bbrf/config.json", "File path for bbrf config file. Default: ~/.bbrf/config.json")
wildcard := flag.Bool("wildcard", false, "Adds everything excepts domains which explicitly mentioned in out of scope.")
unresolved := flag.Bool("unresolved", false, "Takes domain names from stdin and adds it.")
flag.Parse()
if *help {
flag.Usage()
os.Exit(1)
}
if *program == "" {
fmt.Println("p is required")
flag.Usage()
os.Exit(1)
}
if !*service && *filePath == "" && !*unresolved {
fmt.Println("atleast one flag is required: service, path or unresolved")
flag.Usage()
os.Exit(1)
}
if *service && *filePath != "" {
fmt.Println(" Any one flag is required: service or path")
flag.Usage()
os.Exit(1)
}
if *unresolved && *filePath != "" {
fmt.Println("any one flag is required: unresolved or path")
flag.Usage()
os.Exit(1)
}
if *unresolved && *service {
fmt.Println("any one flag is required: unresolved or service")
flag.Usage()
os.Exit(1)
}
// Parse config file
core.ParseConfigFile(*bbrfConfigFile)
if *service {
bbrf.Initialize("service", *program, *wildcard)
} else if *filePath != "" {
core.Initialize(*filePath, *program, *wildcard)
} else if *unresolved {
bbrf.Initialize("unresolved", *program, *wildcard)
}
}