risu 1.4.4 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/NEWS.markdown +14 -1
  2. data/README.markdown +23 -41
  3. data/TODO.markdown +48 -39
  4. data/lib/risu.rb +4 -9
  5. data/lib/risu/base.rb +15 -0
  6. data/lib/risu/base/prawn_templater.rb +37 -0
  7. data/lib/risu/{schema.rb → base/schema.rb} +34 -15
  8. data/lib/risu/base/template_base.rb +23 -0
  9. data/lib/risu/base/template_manager.rb +106 -0
  10. data/lib/risu/base/templater.rb +37 -0
  11. data/lib/risu/cli/application.rb +28 -8
  12. data/lib/risu/models.rb +1 -2
  13. data/lib/risu/models/host.rb +147 -23
  14. data/lib/risu/models/item.rb +131 -43
  15. data/lib/risu/models/plugin.rb +1 -1
  16. data/lib/risu/models/report.rb +11 -1
  17. data/lib/risu/models/serverpreference.rb +0 -2
  18. data/lib/risu/models/servicedescription.rb +10 -0
  19. data/lib/risu/parsers.rb +2 -3
  20. data/lib/risu/parsers/nessus/nessus_document.rb +69 -0
  21. data/lib/risu/parsers/nessus/nessus_sax_listener.rb +278 -0
  22. data/lib/risu/templates/assets.rb +45 -18
  23. data/lib/risu/templates/cover_sheet.rb +70 -42
  24. data/lib/risu/templates/exec_summary.rb +64 -45
  25. data/lib/risu/templates/executive_summary.rb +185 -161
  26. data/lib/risu/templates/finding_statistics.rb +44 -17
  27. data/lib/risu/templates/findings_host.rb +70 -46
  28. data/lib/risu/templates/findings_summary.rb +78 -54
  29. data/lib/risu/templates/findings_summary_with_pluginid.rb +80 -54
  30. data/lib/risu/templates/graphs.rb +46 -19
  31. data/lib/risu/templates/host_summary.rb +62 -39
  32. data/lib/risu/templates/ms_patch_summary.rb +59 -35
  33. data/lib/risu/templates/ms_update_summary.rb +59 -35
  34. data/lib/risu/templates/pci_compliance.rb +88 -64
  35. data/lib/risu/templates/technical_findings.rb +132 -106
  36. data/lib/risu/templates/template.rb +24 -0
  37. metadata +12 -6
  38. data/lib/risu/listener.rb +0 -274
  39. data/lib/risu/nessusdocument.rb +0 -66
  40. data/lib/risu/prawn_templater.rb +0 -38
@@ -1,66 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Risu
4
-
5
- # A Object to represet the Nessus xml file in memory
6
- #
7
- # @author Jacob Hammack <jacob.hammack@hammackj.com>
8
- class NessusDocument
9
-
10
- # Creates a instance of the NessusDocument class
11
- #
12
- def initialize document
13
- @document = document
14
- end
15
-
16
- # Checks the validness of a NessusDocument
17
- #
18
- # @return [Boolean] True if valid, False if invalid
19
- def valid?
20
- if File.exist?(@document)
21
- @parser = LibXML::XML::Parser.file @document
22
- doc = @parser.parse
23
-
24
- if doc.root.name == nil
25
- return false
26
- end
27
-
28
- if doc.root.name == "NessusClientData_v2"
29
- return true
30
- elsif doc.root.name == "NessusClientData"
31
- return false
32
- else
33
- return false
34
- end
35
- else
36
- return false
37
- end
38
- end
39
-
40
- # Invokes the SAX parser on the XML document
41
- #
42
- def parse
43
- @parser = LibXML::XML::SaxParser.file @document
44
- @parser.callbacks = NessusSaxListener.new
45
- @parser.parse
46
- end
47
-
48
- # Fixes the ip field if nil and replaces it with the name if its an ip
49
- #
50
- def fix_ips
51
- @hosts = Host.all
52
-
53
- @hosts.each do |host|
54
- if host.ip == nil
55
- begin
56
- ip = IPAddr.new host.name
57
- host.ip = ip.to_string
58
- host.save
59
- rescue ArgumentError => ae
60
- next
61
- end
62
- end
63
- end
64
- end
65
- end
66
- end
@@ -1,38 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Risu
4
-
5
- # Templater class for generating a report from a erb template
6
- #
7
- # @author Jacob Hammack
8
- class PrawnTemplater
9
- attr_accessor :template, :template_source, :findings, :output_file
10
-
11
- # Setups of the Templater class initalizing all of the variables
12
- #
13
- # @return [PrawnTemplater] New Instance
14
- def initialize(template, findings, output)
15
- @template = template
16
- @findings = findings
17
- @output_file = output
18
-
19
- @template_source = File.new(@template).read
20
- end
21
-
22
- # Generates a report based on the erb template
23
- #
24
- # @return [String] html output of the erb template
25
- def generate
26
- begin
27
- source = @template_source
28
- template = @template
29
- Prawn::Document.generate(@output_file, :margin => [75, 50, 75, 50]) do
30
- font_size 12
31
- eval source
32
- end
33
- rescue => e
34
- puts "Error: #{e.message} \n #{e.backtrace.join("\n\t")}\n"
35
- end
36
- end
37
- end
38
- end