-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
30 lines (26 loc) · 824 Bytes
/
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
package main
import (
"flag"
m "pacheck/modules"
)
func main() {
quietflag := flag.Bool("q", false, "quiet: Only prints the vulnerable package name and version")
cacheflag := flag.Bool("c", false, "cache: use the cached json from the last request")
updateflag := flag.Bool("u", false, "update: fetch the latest json, but don't scan packages")
flag.Parse()
if !m.PacmanInstalled() {
panic("[ERROR] Pacman not installed or not available!\nPlease make sure that everything is correctly set up.")
}
if *updateflag {
m.FetchJson()
return
}
vulnerabilities := m.GetVulnerabilities(*quietflag, *cacheflag)
packages := m.GetInstalledPackages()
for _, info := range packages {
isVuln, vulns := m.IsVulnerable(vulnerabilities, info)
if isVuln {
m.PrintVulnerablePackage(info, vulns, *quietflag)
}
}
}