Class: Ronin::Recon::OutputFormats::Dir
- Inherits:
-
Core::OutputFormats::OutputDir
- Object
- Core::OutputFormats::OutputDir
- Ronin::Recon::OutputFormats::Dir
- Defined in:
- lib/ronin/recon/output_formats/dir.rb
Overview
Represents an output directory.
Constant Summary collapse
- VALUE_FILE_NAMES =
Mapping of value classes to file names.
{ Values::Domain => 'domains.txt', Values::Mailserver => 'mailservers.txt', Values::Nameserver => 'nameservers.txt', Values::Host => 'hosts.txt', Values::Wildcard => 'wildcards.txt', Values::IP => 'ips.txt', Values::IPRange => 'ip_ranges.txt', Values::OpenPort => 'open_ports.txt', Values::Cert => 'certs.txt', Values::EmailAddress => 'email_addresses.txt', Values::URL => 'urls.txt', Values::Website => 'websites.txt' }
Instance Attribute Summary collapse
-
#files ⇒ Hash{Class<Value> => File}
readonly
The opened filenames and files within the output directory.
Instance Method Summary collapse
-
#<<(value) ⇒ Object
Writes a new value to it's specific file.
-
#close ⇒ Object
Closes the output files.
-
#initialize(path) ⇒ Dir
constructor
Initializes the list output format.
Constructor Details
#initialize(path) ⇒ Dir
Initializes the list output format.
61 62 63 64 65 66 67 |
# File 'lib/ronin/recon/output_formats/dir.rb', line 61 def initialize(path) super(path) @files = VALUE_FILE_NAMES.transform_values do |file_name| File.open(File.join(@path,file_name),'w') end end |
Instance Attribute Details
#files ⇒ Hash{Class<Value> => File} (readonly)
The opened filenames and files within the output directory.
37 38 39 |
# File 'lib/ronin/recon/output_formats/dir.rb', line 37 def files @files end |
Instance Method Details
#<<(value) ⇒ Object
Writes a new value to it's specific file.
75 76 77 78 79 80 81 82 |
# File 'lib/ronin/recon/output_formats/dir.rb', line 75 def <<(value) file = @files.fetch(value.class) do raise(NotImplementedError,"unsupported value class: #{value.inspect}") end file.puts(value) file.flush end |
#close ⇒ Object
Closes the output files.
87 88 89 |
# File 'lib/ronin/recon/output_formats/dir.rb', line 87 def close @files.each_value(&:close) end |