Class: Ronin::Recon::OutputFormats::GraphvizFormat
- Inherits:
-
Core::OutputFormats::OutputFile
- Object
- Core::OutputFormats::OutputFile
- Ronin::Recon::OutputFormats::GraphvizFormat
- Includes:
- GraphFormat
- Defined in:
- lib/ronin/recon/output_formats/graphviz_format.rb
Overview
Represents a GraphViz output format.
Instance Attribute Summary collapse
-
#dot_file ⇒ Tempfile
readonly
The
.dot
output file. -
#dot_output ⇒ Dot
readonly
The DOT output format.
Instance Method Summary collapse
-
#<<(value) ⇒ Object
Writes a value to the GraphViz output stream as a node declaration.
-
#[]=(value, parent) ⇒ self
Appends a value and it's parent value to the GraphViz output stream.
-
#close ⇒ Object
Closes and generates the GraphViz output file.
-
#format ⇒ Symbol
abstract
The desired GraphViz output format.
-
#initialize(io) ⇒ GraphvizFormat
constructor
Initializes the GraphViz output format.
Constructor Details
#initialize(io) ⇒ GraphvizFormat
Initializes the GraphViz output format.
53 54 55 56 57 58 |
# File 'lib/ronin/recon/output_formats/graphviz_format.rb', line 53 def initialize(io) super(io) @dot_file = Tempfile.new(['ronin-recon',"#{format}"]) @dot_output = Dot.new(@dot_file) end |
Instance Attribute Details
#dot_file ⇒ Tempfile (readonly)
The .dot
output file.
40 41 42 |
# File 'lib/ronin/recon/output_formats/graphviz_format.rb', line 40 def dot_file @dot_file end |
#dot_output ⇒ Dot (readonly)
The DOT output format.
45 46 47 |
# File 'lib/ronin/recon/output_formats/graphviz_format.rb', line 45 def dot_output @dot_output end |
Instance Method Details
#<<(value) ⇒ Object
Writes a value to the GraphViz output stream as a node declaration.
78 79 80 |
# File 'lib/ronin/recon/output_formats/graphviz_format.rb', line 78 def <<(value) @dot_output << value end |
#[]=(value, parent) ⇒ self
Appends a value and it's parent value to the GraphViz output stream.
93 94 95 96 |
# File 'lib/ronin/recon/output_formats/graphviz_format.rb', line 93 def []=(value,parent) @dot_output[value] = parent return self end |
#close ⇒ Object
Closes and generates the GraphViz output file.
101 102 103 104 105 106 107 108 109 110 |
# File 'lib/ronin/recon/output_formats/graphviz_format.rb', line 101 def close @dot_output.close IO.popen(['dot',"-T#{format}",@dot_file.path]) do |dot_io| # relay the `dot` output to the output stream. @io.write(dot_io.readpartial(4096)) until dot_io.eof? end super end |
#format ⇒ Symbol
This method is abstract.
The desired GraphViz output format.
68 69 70 |
# File 'lib/ronin/recon/output_formats/graphviz_format.rb', line 68 def format raise(NotImplementedError,"#{self.class}#format was not defined!") end |