Merge branch 'vdb_intergration'
Conflicts: lib/common/models/vulnerability.rb spec/lib/common/models/vulnerability_spec.rb spec/lib/common/models/wp_item_spec.rb spec/lib/common/models/wp_plugin_spec.rb spec/lib/common/models/wp_theme_spec.rb spec/lib/common/models/wp_version_spec.rb
This commit is contained in:
@@ -43,7 +43,7 @@ class Vulnerability
|
|||||||
def self.load_from_json_item(json_item)
|
def self.load_from_json_item(json_item)
|
||||||
references = {}
|
references = {}
|
||||||
|
|
||||||
%w(url cve secunia osvdb metasploit exploitdb).each do |key|
|
%w(id url cve secunia osvdb metasploit exploitdb).each do |key|
|
||||||
if json_item[key]
|
if json_item[key]
|
||||||
json_item[key] = [json_item[key]] if json_item[key].class != Array
|
json_item[key] = [json_item[key]] if json_item[key].class != Array
|
||||||
references[key] = json_item[key]
|
references[key] = json_item[key]
|
||||||
|
|||||||
@@ -22,12 +22,15 @@ class Vulnerability
|
|||||||
end
|
end
|
||||||
|
|
||||||
def url_secunia(id)
|
def url_secunia(id)
|
||||||
"http://secunia.com/advisories/#{id}"
|
"https://secunia.com/advisories/#{id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def url_exploitdb(id)
|
def url_exploitdb(id)
|
||||||
"http://www.exploit-db.com/exploits/#{id}/"
|
"http://www.exploit-db.com/exploits/#{id}/"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def url_id(id)
|
||||||
|
"https://CHANGE_ME_BEFORE_MERGE/vulnerability/#{id}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ describe Vulnerability do
|
|||||||
}
|
}
|
||||||
|
|
||||||
expected_refs = {
|
expected_refs = {
|
||||||
|
'id' => ['3911'],
|
||||||
'url' => ['Ref 1,Ref 2'],
|
'url' => ['Ref 1,Ref 2'],
|
||||||
'cve' => ['2011-001'],
|
'cve' => ['2011-001'],
|
||||||
'secunia' => ['secunia'],
|
'secunia' => ['secunia'],
|
||||||
@@ -51,4 +52,4 @@ describe Vulnerability do
|
|||||||
its(:fixed_in) { should == '1.0'}
|
its(:fixed_in) { should == '1.0'}
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ describe WpItem do
|
|||||||
let(:vulns_file) { MODELS_FIXTURES + '/wp_item/vulnerable/items_vulns.json' }
|
let(:vulns_file) { MODELS_FIXTURES + '/wp_item/vulnerable/items_vulns.json' }
|
||||||
let(:identifier) { 'neo' }
|
let(:identifier) { 'neo' }
|
||||||
let(:expected_refs) { {
|
let(:expected_refs) { {
|
||||||
|
'id' => [2993],
|
||||||
'url' => ['Ref 1,Ref 2'],
|
'url' => ['Ref 1,Ref 2'],
|
||||||
'cve' => ['2011-001'],
|
'cve' => ['2011-001'],
|
||||||
'secunia' => ['secunia'],
|
'secunia' => ['secunia'],
|
||||||
@@ -167,4 +168,4 @@ describe WpItem do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ describe WpPlugin do
|
|||||||
let(:options) { { name: 'white-rabbit' } }
|
let(:options) { { name: 'white-rabbit' } }
|
||||||
let(:vulns_file) { MODELS_FIXTURES + '/wp_plugin/vulnerable/plugins_vulns.json' }
|
let(:vulns_file) { MODELS_FIXTURES + '/wp_plugin/vulnerable/plugins_vulns.json' }
|
||||||
let(:expected_refs) { {
|
let(:expected_refs) { {
|
||||||
|
'id' => [2993],
|
||||||
'url' => ['Ref 1,Ref 2'],
|
'url' => ['Ref 1,Ref 2'],
|
||||||
'cve' => ['2011-001'],
|
'cve' => ['2011-001'],
|
||||||
'secunia' => ['secunia'],
|
'secunia' => ['secunia'],
|
||||||
@@ -26,4 +27,4 @@ describe WpPlugin do
|
|||||||
its('uri.to_s') { is_expected.to eq 'http://example.com/wp-content/plugins/plugin-name/' }
|
its('uri.to_s') { is_expected.to eq 'http://example.com/wp-content/plugins/plugin-name/' }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ describe WpTheme do
|
|||||||
let(:options) { { name: 'the-oracle' } }
|
let(:options) { { name: 'the-oracle' } }
|
||||||
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],
|
||||||
'url' => ['Ref 1,Ref 2'],
|
'url' => ['Ref 1,Ref 2'],
|
||||||
'cve' => ['2011-001'],
|
'cve' => ['2011-001'],
|
||||||
'secunia' => ['secunia'],
|
'secunia' => ['secunia'],
|
||||||
@@ -32,4 +33,4 @@ describe WpTheme do
|
|||||||
its(:uri) { is_expected.to eq uri.merge(theme_path) }
|
its(:uri) { is_expected.to eq uri.merge(theme_path) }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ describe WpVersion do
|
|||||||
let(:options) { { number: '3.2' } }
|
let(:options) { { number: '3.2' } }
|
||||||
let(:vulns_file) { MODELS_FIXTURES + '/wp_version/vulnerable/versions_vulns.json' }
|
let(:vulns_file) { MODELS_FIXTURES + '/wp_version/vulnerable/versions_vulns.json' }
|
||||||
let(:expected_refs) { {
|
let(:expected_refs) { {
|
||||||
|
'id' => [2993],
|
||||||
'url' => ['Ref 1,Ref 2'],
|
'url' => ['Ref 1,Ref 2'],
|
||||||
'cve' => ['2011-001'],
|
'cve' => ['2011-001'],
|
||||||
'secunia' => ['secunia'],
|
'secunia' => ['secunia'],
|
||||||
@@ -28,4 +29,4 @@ describe WpVersion do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user