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)
|
||||
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]
|
||||
json_item[key] = [json_item[key]] if json_item[key].class != Array
|
||||
references[key] = json_item[key]
|
||||
|
||||
@@ -22,12 +22,15 @@ class Vulnerability
|
||||
end
|
||||
|
||||
def url_secunia(id)
|
||||
"http://secunia.com/advisories/#{id}"
|
||||
"https://secunia.com/advisories/#{id}"
|
||||
end
|
||||
|
||||
def url_exploitdb(id)
|
||||
"http://www.exploit-db.com/exploits/#{id}/"
|
||||
end
|
||||
|
||||
def url_id(id)
|
||||
"https://CHANGE_ME_BEFORE_MERGE/vulnerability/#{id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,6 +37,7 @@ describe Vulnerability do
|
||||
}
|
||||
|
||||
expected_refs = {
|
||||
'id' => ['3911'],
|
||||
'url' => ['Ref 1,Ref 2'],
|
||||
'cve' => ['2011-001'],
|
||||
'secunia' => ['secunia'],
|
||||
@@ -51,4 +52,4 @@ describe Vulnerability do
|
||||
its(:fixed_in) { should == '1.0'}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,6 +14,7 @@ describe WpItem do
|
||||
let(:vulns_file) { MODELS_FIXTURES + '/wp_item/vulnerable/items_vulns.json' }
|
||||
let(:identifier) { 'neo' }
|
||||
let(:expected_refs) { {
|
||||
'id' => [2993],
|
||||
'url' => ['Ref 1,Ref 2'],
|
||||
'cve' => ['2011-001'],
|
||||
'secunia' => ['secunia'],
|
||||
@@ -167,4 +168,4 @@ describe WpItem do
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,6 +8,7 @@ describe WpPlugin do
|
||||
let(:options) { { name: 'white-rabbit' } }
|
||||
let(:vulns_file) { MODELS_FIXTURES + '/wp_plugin/vulnerable/plugins_vulns.json' }
|
||||
let(:expected_refs) { {
|
||||
'id' => [2993],
|
||||
'url' => ['Ref 1,Ref 2'],
|
||||
'cve' => ['2011-001'],
|
||||
'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/' }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,6 +9,7 @@ describe WpTheme do
|
||||
let(:options) { { name: 'the-oracle' } }
|
||||
let(:vulns_file) { MODELS_FIXTURES + '/wp_theme/vulnerable/themes_vulns.json' }
|
||||
let(:expected_refs) { {
|
||||
'id' => [2993],
|
||||
'url' => ['Ref 1,Ref 2'],
|
||||
'cve' => ['2011-001'],
|
||||
'secunia' => ['secunia'],
|
||||
@@ -32,4 +33,4 @@ describe WpTheme do
|
||||
its(:uri) { is_expected.to eq uri.merge(theme_path) }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,6 +8,7 @@ describe WpVersion do
|
||||
let(:options) { { number: '3.2' } }
|
||||
let(:vulns_file) { MODELS_FIXTURES + '/wp_version/vulnerable/versions_vulns.json' }
|
||||
let(:expected_refs) { {
|
||||
'id' => [2993],
|
||||
'url' => ['Ref 1,Ref 2'],
|
||||
'cve' => ['2011-001'],
|
||||
'secunia' => ['secunia'],
|
||||
@@ -28,4 +29,4 @@ describe WpVersion do
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user