forked from GitLab-Red-Team/gitrob
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
66 lines (57 loc) · 1.64 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 (
"fmt"
"os"
"time"
"gitrob/common"
"gitrob/core"
)
var (
sess *core.Session
err error
)
func main() {
if sess, err = core.NewSession(); err != nil {
fmt.Println(err)
os.Exit(1)
}
sess.Out.Info("%s\n\n", common.ASCIIBanner)
sess.Out.Important("%s v%s started at %s\n", common.Name, common.Version, sess.Stats.StartedAt.Format(time.RFC3339))
sess.Out.Important("Loaded %d file signatures and %d content signatures.\n", len(sess.Signatures.FileSignatures), len(sess.Signatures.ContentSignatures))
sess.Out.Important("Web interface available at http://%s:%d\n", *sess.Options.BindAddress, *sess.Options.Port)
if sess.Stats.Status == "finished" {
sess.Out.Important("Loaded session file: %s\n", *sess.Options.Load)
} else {
if len(sess.Options.Logins) == 0 {
host := func() string {
if sess.IsGithubSession {
return "Github organization"
} else {
return "GitLab group"
}
}()
sess.Out.Fatal("Please provide at least one %s or user\n", host)
}
core.GatherTargets(sess)
core.GatherRepositories(sess)
core.AnalyzeRepositories(sess)
sess.Finish()
if *sess.Options.Save != "" {
err := sess.SaveToFile(*sess.Options.Save)
if err != nil {
sess.Out.Error("Error saving session to %s: %s\n", *sess.Options.Save, err)
}
sess.Out.Important("Saved session to: %s\n\n", *sess.Options.Save)
}
}
core.PrintSessionStats(sess)
if !sess.IsGithubSession {
sess.Out.Error("%s", common.GitLabTanuki)
}
if !*sess.Options.ExitOnFinish {
sess.Out.Important("Press Ctrl+C to stop web server and exit.\n\n")
select {}
} else {
sess.Out.Important("Scan complete. Exiting.\n")
}
}