Add support for reading CVE data from MySQL.
This commit is contained in:
		@@ -49,6 +49,7 @@ type Config struct {
 | 
			
		||||
 | 
			
		||||
	HTTPProxy   string `valid:"url"`
 | 
			
		||||
	ResultsDir  string
 | 
			
		||||
	CveDBType   string
 | 
			
		||||
	CveDBPath   string
 | 
			
		||||
	CacheDBPath string
 | 
			
		||||
 | 
			
		||||
@@ -75,10 +76,23 @@ func (c Config) Validate() bool {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(c.CveDBPath) != 0 {
 | 
			
		||||
		if ok, _ := valid.IsFilePath(c.CveDBPath); !ok {
 | 
			
		||||
			errs = append(errs, fmt.Errorf(
 | 
			
		||||
				"SQLite3 DB(Cve Dictionary) path must be a *Absolute* file path. -cve-dictionary-dbpath: %s", c.CveDBPath))
 | 
			
		||||
	// If no valid DB type is set, default to sqlite3
 | 
			
		||||
	if c.CveDBType == "" {
 | 
			
		||||
		c.CveDBType = "sqlite3"
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if c.CveDBType != "sqlite3" && c.CveDBType != "mysql" {
 | 
			
		||||
		errs = append(errs, fmt.Errorf(
 | 
			
		||||
			"CVE DB type must be either 'sqlite3' or 'mysql'.  -cve-dictionary-dbtype: %s", c.CveDBType))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	if c.CveDBType == "sqlite3" {
 | 
			
		||||
		if len(c.CveDBPath) != 0 {
 | 
			
		||||
			if ok, _ := valid.IsFilePath(c.CveDBPath); !ok {
 | 
			
		||||
				errs = append(errs, fmt.Errorf(
 | 
			
		||||
					"SQLite3 DB(Cve Dictionary) path must be a *Absolute* file path. -cve-dictionary-dbpath: %s", c.CveDBPath))
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user