-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
84 lines (72 loc) · 1.92 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package main
import (
"fmt"
"log"
"os"
"strconv"
"github.com/remiflavien1/recon-archy/selenium"
"github.com/urfave/cli/v2"
)
func main() {
// FLAG TARGET
var threads string
var company string
app := &cli.App{
Name: "ReconArchy",
Usage: "Crawl 1000 employees of a choosen company and build their organizational chart",
Commands: []*cli.Command{
{
Name: "crawl",
Usage: "crawl employees specific to a company",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "threads",
Value: "1",
Aliases: []string{"t"},
Usage: "Adjust number of crawling worker",
Destination: &threads,
},
&cli.StringFlag{
Name: "company",
Aliases: []string{"c"},
Usage: "Name of the target company",
Destination: &company,
},
}, // Crawl Command Flags
Action: func(c *cli.Context) error {
// ARGUMENT HANDLING (in one Action - for now there is only one commands and no subcommands)
if company == "" {
fmt.Println("Please choose a company to target")
os.Exit(0)
}
threadsInt, errConv := strconv.Atoi(threads)
if errConv != nil {
panic(errConv)
}
if threadsInt > 4 {
fmt.Printf("\nBy setting THREADS to %d, you will spawn %d WebDriver on your machine.", threadsInt, threadsInt)
fmt.Printf("\nI think she can not handle it.\nSetup THREAD to 4 at max the next time.")
threadsInt = 4
fmt.Printf("\nAuto - Setting THREADS to 4\n")
}
// MAIN - START PROGRAM
selenium.Start(company, threadsInt)
return nil
}, // Action
}, // Crawl command
{
Name: "analyse",
Usage: "Perform analysis on collected data.",
}, // Analyse command
{
Name: "build",
Usage: "Build organisational chart of the company",
},
}, // Command main
} // App
// Run apps cli
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}