Skip to content

Commit 585253c

Browse files
committed
feat!(detector): relace go-msfdb with vuls2
Replace standalone go-msfdb FillWithMetasploit() with vuls2 EnrichVulnInfos pipeline. Metasploit data is now sourced from vuls-data-extracted-msf via BoltDB. - Extend enrich() to handle sourceTypes.Metasploit → vi.Metasploits - Remove detector/msf.go and all FillWithMetasploit() calls - Remove MetasploitConf from config and subcmds - Remove go-msfdb dependency (go.mod, dependabot.yml) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7961dee commit 585253c

18 files changed

Lines changed: 110 additions & 324 deletions

File tree

.github/dependabot.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ updates:
4444
- "github.com/vulsio/go-cti"
4545
- "github.com/vulsio/go-cve-dictionary"
4646
- "github.com/vulsio/go-exploitdb"
47-
- "github.com/vulsio/go-msfdb"
4847
- "github.com/vulsio/gost"
4948
trivy:
5049
patterns:
@@ -60,7 +59,6 @@ updates:
6059
- "github.com/vulsio/go-cti"
6160
- "github.com/vulsio/go-cve-dictionary"
6261
- "github.com/vulsio/go-exploitdb"
63-
- "github.com/vulsio/go-msfdb"
6462
- "github.com/vulsio/gost"
6563
- "github.com/aquasecurity/trivy"
6664
- "github.com/aquasecurity/trivy-db"

config/config.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ type Config struct {
3838
ScanOpts
3939

4040
// report
41-
CveDict GoCveDictConf `json:"cveDict,omitzero"`
42-
Gost GostConf `json:"gost,omitzero"`
43-
Exploit ExploitConf `json:"exploit,omitzero"`
44-
Metasploit MetasploitConf `json:"metasploit,omitzero"`
45-
Cti CtiConf `json:"cti,omitzero"`
46-
Vuls2 Vuls2Conf `json:"vuls2,omitzero"`
41+
CveDict GoCveDictConf `json:"cveDict,omitzero"`
42+
Gost GostConf `json:"gost,omitzero"`
43+
Exploit ExploitConf `json:"exploit,omitzero"`
44+
Cti CtiConf `json:"cti,omitzero"`
45+
Vuls2 Vuls2Conf `json:"vuls2,omitzero"`
4746

4847
Slack SlackConf `json:"-"`
4948
EMail SMTPConf `json:"-"`
@@ -190,7 +189,6 @@ func (c *Config) ValidateOnReport() bool {
190189
&Conf.CveDict,
191190
&Conf.Gost,
192191
&Conf.Exploit,
193-
&Conf.Metasploit,
194192
&Conf.Cti,
195193
} {
196194
if err := cnf.Validate(); err != nil {

config/tomlloader.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ func (c TOMLLoader) Load(pathToToml string) error {
4141
&Conf.CveDict,
4242
&Conf.Gost,
4343
&Conf.Exploit,
44-
&Conf.Metasploit,
4544
&Conf.Cti,
4645
} {
4746
cnf.Init()

config/vulnDictConf.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -227,33 +227,6 @@ func (cnf *GostConf) Init() {
227227
cnf.DebugSQL = Conf.DebugSQL
228228
}
229229

230-
// MetasploitConf is go-msfdb config
231-
type MetasploitConf struct {
232-
VulnDict
233-
}
234-
235-
const metasploitDBType = "METASPLOITDB_TYPE"
236-
const metasploitDBURL = "METASPLOITDB_URL"
237-
const metasploitDBPATH = "METASPLOITDB_SQLITE3_PATH"
238-
239-
// Init set options with the following priority.
240-
// 1. Environment variable
241-
// 2. config.toml
242-
func (cnf *MetasploitConf) Init() {
243-
cnf.Name = "metasploit"
244-
if os.Getenv(metasploitDBType) != "" {
245-
cnf.Type = os.Getenv(metasploitDBType)
246-
}
247-
if os.Getenv(metasploitDBURL) != "" {
248-
cnf.URL = os.Getenv(metasploitDBURL)
249-
}
250-
if os.Getenv(metasploitDBPATH) != "" {
251-
cnf.SQLite3Path = os.Getenv(metasploitDBPATH)
252-
}
253-
cnf.setDefault("go-msfdb.sqlite3")
254-
cnf.DebugSQL = Conf.DebugSQL
255-
}
256-
257230
// CtiConf is go-cti config
258231
type CtiConf struct {
259232
VulnDict

detector/detector.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,6 @@ func Detect(rs []models.ScanResult, dir string) ([]models.ScanResult, error) {
209209
}
210210
logging.Log.Infof("%s: %d PoC are detected", r.FormatServerName(), nExploitCve)
211211

212-
nMetasploitCve, err := FillWithMetasploit(&r, config.Conf.Metasploit, config.Conf.LogOpts)
213-
if err != nil {
214-
return nil, xerrors.Errorf("Failed to fill with metasploit: %w", err)
215-
}
216-
logging.Log.Infof("%s: %d exploits are detected", r.FormatServerName(), nMetasploitCve)
217-
218212
if err := FillWithCTI(&r, config.Conf.Cti, config.Conf.LogOpts); err != nil {
219213
return nil, xerrors.Errorf("Failed to fill with Cyber Threat Intelligences: %w", err)
220214
}

detector/msf.go

Lines changed: 0 additions & 250 deletions
This file was deleted.

detector/util.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func loadOneServerScanResult(jsonFile string) (*models.ScanResult, error) {
263263
}
264264

265265
// ValidateDBs checks if the databases are accessible and can be closed properly
266-
func ValidateDBs(cveConf config.GoCveDictConf, gostConf config.GostConf, exploitConf config.ExploitConf, metasploitConf config.MetasploitConf, ctiConf config.CtiConf, logOpts logging.LogOpts) error {
266+
func ValidateDBs(cveConf config.GoCveDictConf, gostConf config.GostConf, exploitConf config.ExploitConf, ctiConf config.CtiConf, logOpts logging.LogOpts) error {
267267
cvec, err := newGoCveDictClient(&cveConf, logOpts)
268268
if err != nil {
269269
return xerrors.Errorf("Failed to new CVE client. err: %w", err)
@@ -288,14 +288,6 @@ func ValidateDBs(cveConf config.GoCveDictConf, gostConf config.GostConf, exploit
288288
return xerrors.Errorf("Failed to close exploit DB. err: %w", err)
289289
}
290290

291-
metasploitc, err := newGoMetasploitDBClient(&metasploitConf, logOpts)
292-
if err != nil {
293-
return xerrors.Errorf("Failed to new metasploit client. err: %w", err)
294-
}
295-
if err := metasploitc.closeDB(); err != nil {
296-
return xerrors.Errorf("Failed to close metasploit DB. err: %w", err)
297-
}
298-
299291
ctic, err := newGoCTIDBClient(&ctiConf, logOpts)
300292
if err != nil {
301293
return xerrors.Errorf("Failed to new CTI client. err: %w", err)

0 commit comments

Comments
 (0)