-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathscan.go
89 lines (76 loc) · 1.7 KB
/
scan.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
85
86
87
88
89
package main
import (
"fmt"
"os"
"time"
log "github.com/Sirupsen/logrus"
"github.com/urfave/cli"
)
// Version stores the plugin's version
var Version string
// BuildTime stores the plugin's build time
var BuildTime string
var path string
const (
name = "bro"
category = "net"
)
func main() {
var elastic string
// cli.AppHelpTemplate = utils.AppHelpTemplate
app := cli.NewApp()
app.Name = "bro"
app.Author = "blacktop"
app.Email = "https://github.com/blacktop"
app.Version = Version + ", BuildTime: " + BuildTime
app.Compiled, _ = time.Parse("20060102", BuildTime)
app.Usage = "Malice Bro Plugin"
app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "verbose, V",
Usage: "verbose output",
},
cli.BoolFlag{
Name: "table, t",
Usage: "output as Markdown table",
},
cli.BoolFlag{
Name: "callback, c",
Usage: "POST results to Malice webhook",
EnvVar: "MALICE_ENDPOINT",
},
cli.BoolFlag{
Name: "proxy, x",
Usage: "proxy settings for Malice webhook endpoint",
EnvVar: "MALICE_PROXY",
},
cli.StringFlag{
Name: "elasitcsearch",
Value: "",
Usage: "elasitcsearch address for Malice to store results",
EnvVar: "MALICE_ELASTICSEARCH",
Destination: &elastic,
},
cli.IntFlag{
Name: "timeout",
Value: 60,
Usage: "malice plugin timeout (in seconds)",
EnvVar: "MALICE_TIMEOUT",
},
}
app.Action = func(c *cli.Context) error {
if c.Bool("verbose") {
log.SetLevel(log.DebugLevel)
}
if c.Args().Present() {
log.Info("NOT DONE YET (WIP)")
} else {
log.Fatal(fmt.Errorf("Please supply a file to scan with malice/clamav"))
}
return nil
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}