Class: Prenus::Output::Circosout
- Defined in:
- lib/output/circosout.rb
Instance Method Summary collapse
-
#initialize(events, hosts, options) ⇒ Object
constructor
Initialises the Circosout class into an object.
-
#run ⇒ Object
Run the Circosout class - this will generate a simple table file, which can be used by circos’ tableviewer tool.
Constructor Details
#initialize(events, hosts, options) ⇒ Object
Initialises the Circosout class into an object
32 33 34 |
# File 'lib/output/circosout.rb', line 32 def initialize(events,hosts,) super end |
Instance Method Details
#run ⇒ Object
Run the Circosout class - this will generate a simple table file, which can be used by circos’ tableviewer tool
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 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/output/circosout.rb', line 45 def run # File.open(@options[:outputdir] + "/prenus.circos", 'w') do |f| included_events = [] line = "data\t" @events.each_with_index do |(k,v),index| unless @options[:filter].nil? next unless @options[:filter].include?(k.to_s) end # The graphs were getting too mental, so I hard coded to ignore everything except High and Critical findings next if v[:severity].to_i < @options[:severity].to_i included_events << k line += k.to_s line += "\t" unless index == @events.count - 1 end #f.puts line @oFile.syswrite line + "\n" @hosts.each_with_index do |(k,v),index| line = @hosts[k][:ip].to_s + "\t" atleastone = false included_events.each_with_index do |ev,index2| got_value = false @events.each do |evkey,evval| if evkey == ev evval[:ports].each do |p,hs| next if got_value == true if hs[:hosts].has_key?(k) line += "1" line += "\t" unless index2 == included_events.count - 1 got_value = true atleastone = true else line += "0" line += "\t" unless index2 == included_events.count - 1 got_value = true end end end end end #f.puts line unless atleastone == false @oFile.syswrite line + "\n" unless atleastone == false end # end end |