Fixes #835
This commit is contained in:
@@ -12,6 +12,7 @@ class WpVersion < WpItem
|
|||||||
|
|
||||||
# The version number
|
# The version number
|
||||||
attr_accessor :number
|
attr_accessor :number
|
||||||
|
alias_method :version, :number # Needed to have the right behaviour in Vulnerable#vulnerable_to?
|
||||||
|
|
||||||
# @return [ Array ]
|
# @return [ Array ]
|
||||||
def allowed_options; super << :number << :found_from end
|
def allowed_options; super << :number << :found_from end
|
||||||
@@ -29,5 +30,4 @@ class WpVersion < WpItem
|
|||||||
a << node.text.to_s
|
a << node.text.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,12 +14,6 @@ class WpVersion < WpItem
|
|||||||
# @return [ String ]
|
# @return [ String ]
|
||||||
def identifier
|
def identifier
|
||||||
@number
|
@number
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [ String ]
|
|
||||||
# def vulns_xpath
|
|
||||||
# "//wordpress[@version='#{@number}']/vulnerability"
|
|
||||||
# end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,20 +4,6 @@ require 'spec_helper'
|
|||||||
|
|
||||||
describe WpVersion do
|
describe WpVersion do
|
||||||
it_behaves_like 'WpVersion::Vulnerable'
|
it_behaves_like 'WpVersion::Vulnerable'
|
||||||
it_behaves_like 'WpItem::Vulnerable' 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'],
|
|
||||||
'osvdb' => ['osvdb'],
|
|
||||||
'metasploit' => ['exploit/ex1'],
|
|
||||||
'exploitdb' => ['exploitdb']
|
|
||||||
} }
|
|
||||||
let(:expected_vulns) { Vulnerabilities.new << Vulnerability.new('Here I Am', 'SQLI', expected_refs) }
|
|
||||||
end
|
|
||||||
|
|
||||||
subject(:wp_version) { WpVersion.new(uri, options) }
|
subject(:wp_version) { WpVersion.new(uri, options) }
|
||||||
let(:uri) { URI.parse('http://example.com/') }
|
let(:uri) { URI.parse('http://example.com/') }
|
||||||
|
|||||||
Reference in New Issue
Block a user