Implemented Erwan's feedback

This commit is contained in:
ethicalhack3r
2014-07-31 11:14:22 +02:00
parent 14be7dead5
commit 08dfa4cab2
5 changed files with 16 additions and 80 deletions

View File

@@ -143,28 +143,16 @@ class WpItems < Array
def vulnerable_targets_items(wp_target, item_class, vulns_file)
targets = []
json = json(vulns_file)
# xml = xml(vulns_file)
unless json.nil? || json == ''
json.each do |item|
targets << create_item(
item_class,
item.keys.inject,
wp_target,
vulns_file
)
end
[*json].each do |item|
targets << create_item(
item_class,
item.keys.inject,
wp_target,
vulns_file
)
end
# xml.xpath(item_xpath).each do |node|
# targets << create_item(
# item_class,
# node.attribute('name').text,
# wp_target,
# vulns_file
# )
# end
targets
end

View File

@@ -35,32 +35,6 @@ class Vulnerability
end
# :nocov:
# Create the Vulnerability from the xml_node
#
# @param [ Nokogiri::XML::Node ] xml_node
#
# @return [ Vulnerability ]
# def self.load_from_xml_node(xml_node)
# references = {}
# refs = xml_node.search('references')
# if refs
# references[:url] = refs.search('url').map(&:text)
# references[:cve] = refs.search('cve').map(&:text)
# references[:secunia] = refs.search('secunia').map(&:text)
# references[:osvdb] = refs.search('osvdb').map(&:text)
# references[:metasploit] = refs.search('metasploit').map(&:text)
# references[:exploitdb] = refs.search('exploitdb').map(&:text)
# end
# new(
# xml_node.search('title').text,
# xml_node.search('type').text,
# references,
# xml_node.search('fixed_in').text,
# )
# end
# Create the Vulnerability from the json_item
#
# @param [ Hash ] json_item
@@ -69,12 +43,9 @@ class Vulnerability
def self.load_from_json_item(json_item)
references = {}
references[:url] = json_item['references'].split(',') if json_item['references']
references[:cve] = json_item['cve'].split(',') if json_item['cve']
references[:secunia] = json_item['secunia'].split(',') if json_item['secunia']
references[:osvdb] = json_item['osvdb'].split(',') if json_item['osvdb']
references[:metasploit] = json_item['metasploit'].split(',') if json_item['metasploit']
references[:exploitdb] = json_item['exploitdb'].split(',') if json_item['exploitdb']
[:url, :cve, :secunia, :osvdb, :metasploit, :exploitdb].each do |key|
references[key] = json_item[key.to_s].split(',') if json_item[key.to_s]
end
new(
json_item['title'],

View File

@@ -9,7 +9,6 @@ class WpItem
#
# @return [ Vulnerabilities ]
def vulnerabilities
# xml = xml(vulns_file)
json = json(vulns_file)
vulnerabilities = Vulnerabilities.new
@@ -24,13 +23,6 @@ class WpItem
end
end
# xml.xpath(vulns_xpath).each do |node|
# vuln = Vulnerability.load_from_xml_node(node)
# if vulnerable_to?(vuln)
# vulnerabilities << vuln
# end
# end
vulnerabilities
end
@@ -55,4 +47,9 @@ class WpItem
end
end
# @return [ String ]
def identifier
@name
end
end

View File

@@ -11,15 +11,5 @@ class WpPlugin < WpItem
@vulns_file
end
# @return [ String ]
def identifier
@name
end
# # @return [ String ]
# def vulns_xpath
# "//plugin[@name='#{@name}']/vulnerability"
# end
end
end

View File

@@ -10,16 +10,6 @@ class WpTheme < WpItem
end
@vulns_file
end
# @return [ String ]
def identifier
@name
end
# @return [ String ]
# def vulns_xpath
# "//theme[@name='#{@name}']/vulnerability"
# end
end
end