-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
39 lines (32 loc) · 1.21 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
package main
import (
"gopkg.in/alecthomas/kingpin.v2"
"os"
)
const apiurl = "https://www.virustotal.com/vtapi/v2/"
var (
app = kingpin.New("virusgotal", "A CLI VirusTotal client built with Go")
filescan = app.Command("file", "File scanning mode")
filename = filescan.Arg("FILE", "File to scan").Required().String()
forceFile = filescan.Flag("force", "rescan file").Bool()
waitFile = filescan.Flag("wait", "wait for results").Bool()
jsonFile = filescan.Flag("json", "export results to JSON").Bool()
urlscan = app.Command("url", "URL scanning mode")
urlname = urlscan.Arg("URL", "URL to scan").Required().String()
forceUrl = urlscan.Flag("force", "rescan URL").Bool()
waitUrl = urlscan.Flag("wait", "wait for results").Bool()
jsonUrl = urlscan.Flag("json", "export results to JSON").Bool()
hashscan = app.Command("hash", "Search files by hash")
hash = hashscan.Arg("HASH", "SHA1/SHA256/MD5 hash").Required().String()
jsonHash = hashscan.Flag("json", "export results to JSON").Bool()
)
func main() {
switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case filescan.FullCommand():
scanFile(*filename)
case urlscan.FullCommand():
scanUrl(*urlname)
case hashscan.FullCommand():
searchHash(*hash)
}
}