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:
		
							
								
								
									
										6534
									
								
								integration/data/amazon_2.json
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										6534
									
								
								integration/data/amazon_2.json
									
									
									
									
									
										Executable file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										5634
									
								
								integration/data/centos_7.json
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5634
									
								
								integration/data/centos_7.json
									
									
									
									
									
										Executable file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										5631
									
								
								integration/data/debian_10.json
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5631
									
								
								integration/data/debian_10.json
									
									
									
									
									
										Executable file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										131
									
								
								integration/data/rails.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										131
									
								
								integration/data/rails.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,131 @@
 | 
			
		||||
{
 | 
			
		||||
    "jsonVersion": 4,
 | 
			
		||||
    "lang": "",
 | 
			
		||||
    "serverUUID": "",
 | 
			
		||||
    "serverName": "rails",
 | 
			
		||||
    "family": "pseudo",
 | 
			
		||||
    "release": "",
 | 
			
		||||
    "container": {
 | 
			
		||||
        "containerID": "",
 | 
			
		||||
        "name": "",
 | 
			
		||||
        "image": "",
 | 
			
		||||
        "type": "",
 | 
			
		||||
        "uuid": ""
 | 
			
		||||
    },
 | 
			
		||||
    "platform": {
 | 
			
		||||
        "name": "other",
 | 
			
		||||
        "instanceID": ""
 | 
			
		||||
    },
 | 
			
		||||
    "scannedAt": "2021-03-31T12:22:26.428630183+09:00",
 | 
			
		||||
    "scanMode": "fast mode",
 | 
			
		||||
    "scannedVersion": "v0.15.9",
 | 
			
		||||
    "scannedRevision": "build-20210331_121257_1a58c94",
 | 
			
		||||
    "scannedBy": "dev",
 | 
			
		||||
    "scannedVia": "pseudo",
 | 
			
		||||
    "scannedIpv4Addrs": [
 | 
			
		||||
        "172.19.0.1",
 | 
			
		||||
        "172.17.0.1",
 | 
			
		||||
        "172.27.0.1"
 | 
			
		||||
    ],
 | 
			
		||||
    "reportedAt": "0001-01-01T00:00:00Z",
 | 
			
		||||
    "reportedVersion": "",
 | 
			
		||||
    "reportedRevision": "",
 | 
			
		||||
    "reportedBy": "",
 | 
			
		||||
    "errors": [],
 | 
			
		||||
    "warnings": [],
 | 
			
		||||
    "scannedCves": {},
 | 
			
		||||
    "runningKernel": {
 | 
			
		||||
        "release": "",
 | 
			
		||||
        "version": "",
 | 
			
		||||
        "rebootRequired": false
 | 
			
		||||
    },
 | 
			
		||||
    "packages": {},
 | 
			
		||||
    "config": {
 | 
			
		||||
        "scan": {
 | 
			
		||||
            "logDir": "/var/log/vuls",
 | 
			
		||||
            "resultsDir": "/home/ubuntu/go/src/github.com/future-architect/vuls/results",
 | 
			
		||||
            "default": {
 | 
			
		||||
                "port": "22",
 | 
			
		||||
                "scanMode": [
 | 
			
		||||
                    "fast"
 | 
			
		||||
                ]
 | 
			
		||||
            },
 | 
			
		||||
            "servers": {
 | 
			
		||||
                "rails": {
 | 
			
		||||
                    "serverName": "rails",
 | 
			
		||||
                    "cpeNames": [
 | 
			
		||||
                        "cpe:/a:rubyonrails:ruby_on_rails:3.0.1"
 | 
			
		||||
                    ],
 | 
			
		||||
                    "scanMode": [
 | 
			
		||||
                        "fast"
 | 
			
		||||
                    ],
 | 
			
		||||
                    "type": "pseudo",
 | 
			
		||||
                    "wordpress": {}
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "cveDict": {
 | 
			
		||||
                "Name": "cveDict",
 | 
			
		||||
                "Type": "sqlite3",
 | 
			
		||||
                "SQLite3Path": "/home/ubuntu/go/src/github.com/kotakanbe/go-cve-dictionary/cve.sqlite3",
 | 
			
		||||
                "DebugSQL": false
 | 
			
		||||
            },
 | 
			
		||||
            "ovalDict": {
 | 
			
		||||
                "Name": "ovalDict",
 | 
			
		||||
                "Type": "sqlite3",
 | 
			
		||||
                "SQLite3Path": "/home/ubuntu/go/src/github.com/kotakanbe/goval-dictionary/oval.sqlite3",
 | 
			
		||||
                "DebugSQL": false
 | 
			
		||||
            },
 | 
			
		||||
            "gost": {
 | 
			
		||||
                "Name": "gost",
 | 
			
		||||
                "Type": "sqlite3",
 | 
			
		||||
                "SQLite3Path": "/home/ubuntu/go/src/github.com/future-architect/vuls/gost.sqlite3",
 | 
			
		||||
                "DebugSQL": false
 | 
			
		||||
            },
 | 
			
		||||
            "exploit": {
 | 
			
		||||
                "Name": "exploit",
 | 
			
		||||
                "Type": "sqlite3",
 | 
			
		||||
                "SQLite3Path": "/home/ubuntu/go/src/github.com/vulsio/go-exploitdb/go-exploitdb.sqlite3",
 | 
			
		||||
                "DebugSQL": false
 | 
			
		||||
            },
 | 
			
		||||
            "metasploit": {
 | 
			
		||||
                "Name": "metasploit",
 | 
			
		||||
                "Type": "sqlite3",
 | 
			
		||||
                "SQLite3Path": "/home/ubuntu/go/src/github.com/takuzoo3868/go-msfdb/go-msfdb.sqlite3",
 | 
			
		||||
                "DebugSQL": false
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        "report": {
 | 
			
		||||
            "default": {},
 | 
			
		||||
            "cveDict": {
 | 
			
		||||
                "Name": "",
 | 
			
		||||
                "Type": "",
 | 
			
		||||
                "SQLite3Path": "",
 | 
			
		||||
                "DebugSQL": false
 | 
			
		||||
            },
 | 
			
		||||
            "ovalDict": {
 | 
			
		||||
                "Name": "",
 | 
			
		||||
                "Type": "",
 | 
			
		||||
                "SQLite3Path": "",
 | 
			
		||||
                "DebugSQL": false
 | 
			
		||||
            },
 | 
			
		||||
            "gost": {
 | 
			
		||||
                "Name": "",
 | 
			
		||||
                "Type": "",
 | 
			
		||||
                "SQLite3Path": "",
 | 
			
		||||
                "DebugSQL": false
 | 
			
		||||
            },
 | 
			
		||||
            "exploit": {
 | 
			
		||||
                "Name": "",
 | 
			
		||||
                "Type": "",
 | 
			
		||||
                "SQLite3Path": "",
 | 
			
		||||
                "DebugSQL": false
 | 
			
		||||
            },
 | 
			
		||||
            "metasploit": {
 | 
			
		||||
                "Name": "",
 | 
			
		||||
                "Type": "",
 | 
			
		||||
                "SQLite3Path": "",
 | 
			
		||||
                "DebugSQL": false
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										5158
									
								
								integration/data/rhel_71.json
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5158
									
								
								integration/data/rhel_71.json
									
									
									
									
									
										Executable file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										6926
									
								
								integration/data/rhel_8.json
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										6926
									
								
								integration/data/rhel_8.json
									
									
									
									
									
										Executable file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										8609
									
								
								integration/data/ubuntu_1804.json
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										8609
									
								
								integration/data/ubuntu_1804.json
									
									
									
									
									
										Executable file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										8559
									
								
								integration/data/ubuntu_2004.json
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										8559
									
								
								integration/data/ubuntu_2004.json
									
									
									
									
									
										Executable file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										27
									
								
								integration/int-config.toml
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										27
									
								
								integration/int-config.toml
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
[cveDict]
 | 
			
		||||
  Type = "sqlite3"
 | 
			
		||||
  SQLite3Path = "/home/ubuntu/vulsctl/docker/cve.sqlite3"
 | 
			
		||||
 | 
			
		||||
[ovalDict]
 | 
			
		||||
  Type = "sqlite3"
 | 
			
		||||
  SQLite3Path = "/home/ubuntu/vulsctl/docker/oval.sqlite3"
 | 
			
		||||
 | 
			
		||||
[gost]
 | 
			
		||||
  Type = "sqlite3"
 | 
			
		||||
  SQLite3Path = "/home/ubuntu/vulsctl/docker/gost.sqlite3"
 | 
			
		||||
 | 
			
		||||
[exploit]
 | 
			
		||||
  Type = "sqlite3"
 | 
			
		||||
  SQLite3Path = "/home/ubuntu/vulsctl/docker/go-exploitdb.sqlite3"
 | 
			
		||||
 | 
			
		||||
[metasploit]
 | 
			
		||||
  type = "sqlite3"
 | 
			
		||||
  SQLite3Path = "/home/ubuntu/vulsctl/docker/go-msfdb.sqlite3"
 | 
			
		||||
 | 
			
		||||
[default]
 | 
			
		||||
 | 
			
		||||
[servers]
 | 
			
		||||
 | 
			
		||||
[servers.rails]
 | 
			
		||||
type = "pseudo"
 | 
			
		||||
cpeNames       = [ "cpe:/a:rubyonrails:ruby_on_rails:3.0.1" ]
 | 
			
		||||
							
								
								
									
										27
									
								
								integration/int-redis-config.toml
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										27
									
								
								integration/int-redis-config.toml
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
[cveDict]
 | 
			
		||||
Type = "redis"
 | 
			
		||||
Url = "redis://127.0.0.1/3"
 | 
			
		||||
 | 
			
		||||
[ovalDict]
 | 
			
		||||
  Type = "redis"
 | 
			
		||||
  Url = "redis://127.0.0.1/1"
 | 
			
		||||
 | 
			
		||||
[gost]
 | 
			
		||||
  Type = "redis"
 | 
			
		||||
  Url = "redis://127.0.0.1/2"
 | 
			
		||||
 | 
			
		||||
[exploit]
 | 
			
		||||
  Type = "redis"
 | 
			
		||||
  Url = "redis://127.0.0.1/4"
 | 
			
		||||
 | 
			
		||||
[metasploit]
 | 
			
		||||
  Type = "redis"
 | 
			
		||||
  Url = "redis://127.0.0.1/5"
 | 
			
		||||
 | 
			
		||||
[default]
 | 
			
		||||
 | 
			
		||||
[servers]
 | 
			
		||||
 | 
			
		||||
[servers.rails]
 | 
			
		||||
type = "pseudo"
 | 
			
		||||
cpeNames       = [ "cpe:/a:rubyonrails:ruby_on_rails:3.0.1" ]
 | 
			
		||||
		Reference in New Issue
	
	Block a user