Implement Erwan's feedbaxk #853

This commit is contained in:
ethicalhack3r
2015-08-14 21:51:55 +02:00
parent 8727935cb2
commit 57f6206aee
8 changed files with 61 additions and 62 deletions

View File

@@ -9,14 +9,13 @@ class WpItem
# #
# @return [ Vulnerabilities ] # @return [ Vulnerabilities ]
def vulnerabilities def vulnerabilities
json = json(vulns_file).select { |item| !item['vulnerabilities'].empty? } json = json(vulns_file)
vulnerabilities = Vulnerabilities.new vulnerabilities = Vulnerabilities.new
json.each do |item| json.each do |item|
asset = item['version'][identifier] if item['version'] asset = item['version'] || item['name']
asset = item['name'][identifier] if item['name']
next unless asset next unless asset == identifier
item['vulnerabilities'].each do |vulnerability| item['vulnerabilities'].each do |vulnerability|
vulnerability = Vulnerability.load_from_json_item(vulnerability) vulnerability = Vulnerability.load_from_json_item(vulnerability)

View File

@@ -15,7 +15,7 @@ describe WpItem do
let(:identifier) { 'neo' } let(:identifier) { 'neo' }
let(:expected_refs) { { let(:expected_refs) { {
'id' => [2993], 'id' => [2993],
'url' => ['Ref 1,Ref 2'], 'url' => ['Ref 1', 'Ref 2'],
'cve' => ['2011-001'], 'cve' => ['2011-001'],
'secunia' => ['secunia'], 'secunia' => ['secunia'],
'osvdb' => ['osvdb'], 'osvdb' => ['osvdb'],

View File

@@ -9,7 +9,7 @@ describe WpPlugin do
let(:vulns_file) { MODELS_FIXTURES + '/wp_plugin/vulnerable/plugins.json' } let(:vulns_file) { MODELS_FIXTURES + '/wp_plugin/vulnerable/plugins.json' }
let(:expected_refs) { { let(:expected_refs) { {
'id' => [2993], 'id' => [2993],
'url' => ['Ref 1,Ref 2'], 'url' => ['Ref 1', 'Ref 2'],
'cve' => ['2011-001'], 'cve' => ['2011-001'],
'secunia' => ['secunia'], 'secunia' => ['secunia'],
'osvdb' => ['osvdb'], 'osvdb' => ['osvdb'],

View File

@@ -10,7 +10,7 @@ describe WpTheme do
let(:vulns_file) { MODELS_FIXTURES + '/wp_theme/vulnerable/themes_vulns.json' } let(:vulns_file) { MODELS_FIXTURES + '/wp_theme/vulnerable/themes_vulns.json' }
let(:expected_refs) { { let(:expected_refs) { {
'id' => [2993], 'id' => [2993],
'url' => ['Ref 1,Ref 2'], 'url' => ['Ref 1', 'Ref 2'],
'cve' => ['2011-001'], 'cve' => ['2011-001'],
'secunia' => ['secunia'], 'secunia' => ['secunia'],
'osvdb' => ['osvdb'], 'osvdb' => ['osvdb'],

View File

@@ -6,7 +6,7 @@
"id":2989, "id":2989,
"title":"Administrator-exploitable blind SQLi in WordPress 1.0 - 3.8.1", "title":"Administrator-exploitable blind SQLi in WordPress 1.0 - 3.8.1",
"references": { "references": {
"url":"https://security.dxw.com/advisories/sqli-in-wordpress-3-6-1/,http://www.example.com" "url": ["https://security.dxw.com/advisories/sqli-in-wordpress-3-6-1/" ,"http://www.example.com"]
}, },
"created_at":"2014-07-28T12:10:07.000Z", "created_at":"2014-07-28T12:10:07.000Z",
"updated_at":"2014-07-28T12:43:41.000Z" "updated_at":"2014-07-28T12:43:41.000Z"
@@ -20,12 +20,12 @@
"id":2993, "id":2993,
"title":"I'm the one", "title":"I'm the one",
"references": { "references": {
"url":"Ref 1,Ref 2", "url": ["Ref 1", "Ref 2"],
"osvdb":"osvdb", "osvdb": ["osvdb"],
"cve":"2011-001", "cve": ["2011-001"],
"secunia":"secunia", "secunia": ["secunia"],
"metasploit":"exploit/ex1", "metasploit": ["exploit/ex1"],
"exploitdb":"exploitdb" "exploitdb": ["exploitdb"]
}, },
"type":"XSS", "type":"XSS",
"fixed_in":"", "fixed_in":"",

View File

@@ -6,12 +6,12 @@
"id":2993, "id":2993,
"title":"I should not appear in the results", "title":"I should not appear in the results",
"references": { "references": {
"url":"Ref 1,Ref 2", "url": ["Ref 1","Ref 2"],
"osvdb":"osvdb", "osvdb": ["osvdb"],
"cve":"2011-001", "cve": ["2011-001"],
"secunia":"secunia", "secunia": ["secunia"],
"metasploit":"exploit/ex1", "metasploit": ["exploit/ex1"],
"exploitdb":"exploitdb" "exploitdb": ["exploitdb"]
}, },
"type":"XSS", "type":"XSS",
"fixed_in":"", "fixed_in":"",
@@ -22,12 +22,12 @@
"id":2989, "id":2989,
"title":"Neither do I", "title":"Neither do I",
"references": { "references": {
"url":"Ref 1,Ref 2", "url": ["Ref 1" ,"Ref 2"],
"osvdb":"osvdb", "osvdb": ["osvdb"],
"cve":"2011-001", "cve": ["2011-001"],
"secunia":"secunia", "secunia": ["secunia"],
"metasploit":"exploit/ex1", "metasploit": ["exploit/ex1"],
"exploitdb":"exploitdb" "exploitdb": ["exploitdb"]
}, },
"type":"XSS", "type":"XSS",
"fixed_in":"", "fixed_in":"",
@@ -43,12 +43,12 @@
"id":2993, "id":2993,
"title":"Follow me!", "title":"Follow me!",
"references": { "references": {
"url":"Ref 1,Ref 2", "url": ["Ref 1", "Ref 2"],
"osvdb":"osvdb", "osvdb": ["osvdb"],
"cve":"2011-001", "cve": ["2011-001"],
"secunia":"secunia", "secunia": ["secunia"],
"metasploit":"exploit/ex1", "metasploit": ["exploit/ex1"],
"exploitdb":"exploitdb" "exploitdb": ["exploitdb"]
}, },
"type":"REDIRECT", "type":"REDIRECT",
"fixed_in":"", "fixed_in":"",

View File

@@ -6,12 +6,12 @@
"id":2989, "id":2989,
"title":"I should not appear in the results", "title":"I should not appear in the results",
"references": { "references": {
"url":"Ref 1,Ref 2", "url": ["Ref 1", "Ref 2"],
"osvdb":"osvdb", "osvdb": ["osvdb"],
"cve":"2011-001", "cve": ["2011-001"],
"secunia":"secunia", "secunia": ["secunia"],
"metasploit":"exploit/ex1", "metasploit": ["exploit/ex1"],
"exploitdb":"exploitdb" "exploitdb": ["exploitdb"]
}, },
"type":"XSS", "type":"XSS",
"fixed_in":"", "fixed_in":"",
@@ -22,12 +22,12 @@
"id":2989, "id":2989,
"title":"Neither do I", "title":"Neither do I",
"references": { "references": {
"url":"Ref 1,Ref 2", "url": ["Ref 1", "Ref 2"],
"osvdb":"osvdb", "osvdb": ["osvdb"],
"cve":"2011-001", "cve": ["2011-001"],
"secunia":"secunia", "secunia": ["secunia"],
"metasploit":"exploit/ex1", "metasploit": ["exploit/ex1"],
"exploitdb":"exploitdb" "exploitdb": ["exploitdb"]
}, },
"type":"XSS", "type":"XSS",
"fixed_in":"", "fixed_in":"",
@@ -43,12 +43,12 @@
"id":2993, "id":2993,
"title":"I see you", "title":"I see you",
"references": { "references": {
"url":"Ref 1,Ref 2", "url": ["Ref 1", "Ref 2"],
"osvdb":"osvdb", "osvdb": ["osvdb"],
"cve":"2011-001", "cve": ["2011-001"],
"secunia":"secunia", "secunia": ["secunia"],
"metasploit":"exploit/ex1", "metasploit": ["exploit/ex1"],
"exploitdb":"exploitdb" "exploitdb": ["exploitdb"]
}, },
"type":"FPD", "type":"FPD",
"fixed_in":"", "fixed_in":"",

View File

@@ -6,12 +6,12 @@
"id":2989, "id":2989,
"title":"I should not appear in the results", "title":"I should not appear in the results",
"references": { "references": {
"url":"Ref 1,Ref 2", "url": ["Ref 1", "Ref 2"],
"osvdb":"osvdb", "osvdb": ["osvdb"],
"cve":"2011-001", "cve": ["2011-001"],
"secunia":"secunia", "secunia": ["secunia"],
"metasploit":"exploit/ex1", "metasploit": ["exploit/ex1"],
"exploitdb":"exploitdb" "exploitdb": ["exploitdb"]
}, },
"type":"XSS", "type":"XSS",
"fixed_in":"", "fixed_in":"",
@@ -27,12 +27,12 @@
"id":2993, "id":2993,
"title":"Here I Am", "title":"Here I Am",
"references": { "references": {
"url":"Ref 1,Ref 2", "url": ["Ref 1", "Ref 2"],
"osvdb":"osvdb", "osvdb": ["osvdb"],
"cve":"2011-001", "cve": ["2011-001"],
"secunia":"secunia", "secunia": ["secunia"],
"metasploit":"exploit/ex1", "metasploit": ["exploit/ex1"],
"exploitdb":"exploitdb" "exploitdb": ["exploitdb"]
}, },
"type":"SQLI", "type":"SQLI",
"fixed_in":"", "fixed_in":"",