-
Notifications
You must be signed in to change notification settings - Fork 0
/
scancmd.go
43 lines (35 loc) · 846 Bytes
/
scancmd.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
package main
import (
"context"
"flag"
"fmt"
"github.com/google/subcommands"
"github.com/malice-plugins/go-plugin-utils/utils"
)
type scanCmd struct {
}
func (p *scanCmd) Name() string {
return "scan"
}
func (p *scanCmd) Synopsis() string {
return "scan webshell in specific directory"
}
func (p *scanCmd) Usage() string {
return "scan <targetdir>"
}
func (p *scanCmd) SetFlags(f *flag.FlagSet) {
}
func (p *scanCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
dirs := flag.Args()
if len(dirs) == 0 {
fmt.Println("target dir is must")
return subcommands.ExitUsageError
}
var params []string
params = append(params, "scan")
params = append(params, dirs...)
ctx := context.TODO()
r,_ := utils.RunCommand(ctx, "hmb", params...)
fmt.Println(r)
return subcommands.ExitSuccess
}