Class: Risu::Templates::TechnicalFindingsTemplate

Inherits:
Base::TemplateBase show all
Includes:
TemplateHelper
Defined in:
lib/risu/templates/technical_findings.rb

Instance Attribute Summary

Attributes inherited from Base::TemplateBase

#output, #template_info

Instance Method Summary collapse

Methods included from TemplateHelper

#default_credential_plugins, #default_credentials_appendix_section, #default_credentials_section, #definition, #has_default_credentials?, #heading1, #heading2, #heading3, #heading4, #heading5, #heading6, #item_count_by_plugin_id, #item_count_by_plugin_name, #new_page, #report_author, #report_classification, #report_subtitle, #report_title, #table, #text, #title

Methods included from ScanHelper

#authenticated_count, #scan_info_to_hash

Methods included from SharesTemplateHelper

#anon_ftp_count, #anon_ftp_section, #anon_smb_count, #anon_smb_query, #anon_smb_section, #shares_appendix_section, #shares_section, #shares_section_has_findings?

Methods included from GraphTemplateHelper

#other_os_graph_page, #risks_by_service_graph_page, #risks_by_severity_graph_page, #root_cause_graph_page, #windows_os_graph_page

Methods included from MalwareTemplateHelper

#conficker_appendix_section, #conficker_count, #conficker_section, #known_malicious_process_appendix_section, #known_malicious_process_count, #known_malicious_process_section, #malware_appendix_section, #malware_section

Methods included from HostTemplateHelper

#unsupported_os, #unsupported_os_appendix_section

Methods inherited from Base::TemplateBase

inherited

Constructor Details

#initializeTechnicalFindingsTemplate

Returns a new instance of TechnicalFindingsTemplate.



27
28
29
30
31
32
33
34
35
36
# File 'lib/risu/templates/technical_findings.rb', line 27

def initialize
  @template_info =
  {
    :name => "technical_findings",
    :author => "hammackj",
    :version => "0.0.9",
    :renderer => "PDF",
    :description => "Generates a Technical Findings Report"
  }
end

Instance Method Details



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/risu/templates/technical_findings.rb', line 38

def print_technical_findings(risks, text, color, last=false)
  if risks.length > 0
    title text, 18, color

    risks.each do |f|
      hosts = Item.where(:plugin_id => f.plugin_id).group(:host_id)
      plugin = Plugin.find_by_id(f.plugin_id)

      #references = Reference.where(:plugin_id => plugin.id).group(:value).order(:reference_name)

      output.font_size(16) do
        text "#{plugin.plugin_name}\n"
      end

      if hosts.length > 1
        text "Hosts (#{hosts.length})", :style => :bold
      else
        text "Host", :style => :bold
      end

      hostlist = Array.new
      hosts.each do |host|
        ho = Host.find_by_id(host.host_id)
        host_string = "#{ho.name}"
        host_string << " (#{ho.fqdn})" if ho.fqdn != nil
        hostlist << host_string
      end

      text hostlist.join(', ')

      definition "Plugin output", f.plugin_output
      definition "Description", plugin.description.gsub(/[ ]{2,}/, " ") if plugin.description != nil
      definition "Synopsis", plugin.synopsis
      definition "CVSS Base Score", plugin.cvss_base_score
      definition "Exploit Available", plugin.exploit_available? ? "Yes" : "No"
      definition "Solution", plugin.solution
      definition "References", plugin.references.reference_string, :inline_format => true

      plugin_url = "http://www.tenablesecurity.com/plugins/index.php?view=single&id=#{plugin.id}"
      definition "Nessus Plugin", plugin_url, :inline_format => true, :link => plugin_url

      text "\n"
    end

    @output.start_new_page if last == false
  end
end

#render(output) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/risu/templates/technical_findings.rb', line 86

def render output
  text Report.classification.upcase, :align => :center
  text "\n"

  report_title Report.title
  report_subtitle "Technical Findings"
  report_author "This report was prepared by\n#{Report.author}"
  text "\n\n\n"

  # If you uncomment the med/low change the true in high to false for a new page after it

  print_technical_findings(Item.critical_risks_unique, "Critical Findings", Risu::GRAPH_COLORS[0]) if Item.critical_risks_unique.to_a.size != 0
  print_technical_findings(Item.high_risks_unique, "High Findings", Risu::GRAPH_COLORS[1], true) if Item.high_risks_unique.to_a.size != 0
  #print_technical_findings(Item.medium_risks_unique, "Medium Findings", Risu::GRAPH_COLORS[2]) if Item.medium_risks_unique.to_a.size != 0
  #print_technical_findings(Item.low_risks_unique, "Low Findings", Risu::GRAPH_COLORS[3], true) if Item.low_risks_unique.to_a.size != 0

  output.number_pages "<page> of <total>", :at => [output.bounds.right - 75, 0], :width => 150, :page_filter => :all
end