lib/acunetix/report_item.rb in dradis-acunetix-3.22.0 vs lib/acunetix/report_item.rb in dradis-acunetix-4.0.0

- old
+ new

@@ -6,10 +6,12 @@ # the XML in attributes and nested tags. # # Instead of providing separate methods for each supported property we rely # on Ruby's #method_missing to do most of the work. class ReportItem + include Cleanup + attr_accessor :xml # Accepts an XML node from Nokogiri::XML. def initialize(xml_node) @xml = xml_node @@ -111,58 +113,17 @@ return nil end private - def cleanup_html(source) - result = source.dup - result.gsub!(/&quot;/, '"') - result.gsub!(/&amp;/, '&') - result.gsub!(/&lt;/, '<') - result.gsub!(/&gt;/, '>') - - result.gsub!(/<b>(.*?)<\/b>/) { "*#{$1.strip}*" } - result.gsub!(/<br\/>/, "\n") - result.gsub!(/<font.*?>(.*?)<\/font>/m, '\1') - result.gsub!(/<h2>(.*?)<\/h2>/) { "*#{$1.strip}*" } - result.gsub!(/<i>(.*?)<\/i>/, '\1') - result.gsub!(/<p>(.*?)<\/p>/, '\1') - result.gsub!(/<code><pre.*?>(.*?)<\/pre><\/code>/m){|m| "\n\nbc.. #{$1.strip}\n\np. \n" } - result.gsub!(/<pre.*?>(.*?)<\/pre>/m){|m| "\n\nbc.. #{$1.strip}\n\np. \n" } - result.gsub!(/<ul>(.*?)<\/ul>/m){"#{$1.strip}\n"} - - result.gsub!(/<li>(.*?)<\/li>/){"\n* #{$1.strip}"} - - result.gsub!(/<strong>(.*?)<\/strong>/) { "*#{$1.strip}*" } - result.gsub!(/<span.*?>(.*?)<\/span>/m){"#{$1.strip}\n"} - - result - end - - def cleanup_decimals(source) - result = source.dup - result.gsub!(/([0-9])\,([0-9])/, '\1.\2') - result - end - def references_list references = '' xml.xpath('./References/Reference').each do |xml_reference| references << xml_reference.at_xpath('./Database').text() references << "\n" references << xml_reference.at_xpath('./URL').text() references << "\n\n" end references end - - # Some of the values have embedded HTML conent that we need to strip - def tags_with_html_content - [:details, :description, :detailed_information, :impact, :recommendation] - end - - def tags_with_commas - [:cvss3_score, :cvss3_tempscore, :cvss3_envscore] - end - end end