refactor: don't use global Config in private func (#1197)

* refactor: cve_client.go

* refactor: don't use global Config in private func

* remove import alias for config

* refactor: dbclient

* refactor: resultDir

* refactor: resultsDir

* refactor

* refactor: gost

* refactor: db client

* refactor: cveDB

* refactor: cvedb

* refactor: exploitDB

* refactor: remove detector/dbclient.go

* refactor: writer

* refactor: syslog writer

* refactor: ips

* refactor: ensureResultDir

* refactor: proxy

* fix(db): call CloseDB

* add integration test

* feat(report): sort array in json

* sort func for json diff

* add build-int to makefile

* add int-rds-redis to makefile

* fix: test case, makefile

* fix makefile

* show cve count after diff

* make diff

* diff -c

* sort exploits in json for diff

* sort metasploit, exploit
This commit is contained in:
Kota Kanbe
2021-04-01 13:36:24 +09:00
committed by GitHub
parent 0179f4299a
commit 9bfe0627ae
70 changed files with 48982 additions and 1274 deletions

View File

@@ -66,12 +66,14 @@ type osTypeInterface interface {
// Scanner has functions for scan
type Scanner struct {
ResultsDir string
TimeoutSec int
ScanTimeoutSec int
CacheDBPath string
Debug bool
LogDir string
Quiet bool
DetectIPS bool
Targets map[string]config.ServerInfo
}
@@ -91,8 +93,10 @@ func (s Scanner) Scan() error {
logging.Log.Info("Detecting Platforms... ")
s.detectPlatform()
logging.Log.Info("Detecting IPS identifiers... ")
s.detectIPS()
if s.DetectIPS {
logging.Log.Info("Detecting IPS identifiers... ")
s.detectIPS()
}
if err := s.execScan(); err != nil {
return xerrors.Errorf("Failed to scan. err: %w", err)
@@ -593,7 +597,7 @@ func (s Scanner) execScan() error {
}()
scannedAt := time.Now()
dir, err := EnsureResultDir(scannedAt)
dir, err := EnsureResultDir(s.ResultsDir, scannedAt)
if err != nil {
return err
}