Module: Ronin::Masscan::Converters::CSV Private
- Defined in:
- lib/ronin/masscan/converters/csv.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Handles converting masscan scan files into CSV.
Constant Summary collapse
- HEADER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
CSV rows header.
%w[type status.status status.protocol status.port status.reason status.ttl status.ip status.timestamp banner.protocol banner.port banner.ip banner.timestamp banner.app_protocol banner.payload]
Class Method Summary collapse
- .banner_record_to_row(banner) ⇒ Object private
-
.convert(masscan_file, output) ⇒ Object
private
Converts the masscan scan file to CSV.
-
.masscan_file_to_csv(masscan_file, output) ⇒ Object
private
Converts a masscan scan file to CSV.
-
.masscan_file_to_rows(masscan_file) {|row| ... } ⇒ Object
private
Converts an opened masscan scan file to a series of rows.
- .record_to_row(record) ⇒ Object private
- .status_record_to_row(status) ⇒ Object private
Class Method Details
.banner_record_to_row(banner) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
102 103 104 |
# File 'lib/ronin/masscan/converters/csv.rb', line 102 def self.() ['banner', nil, nil, nil, nil, nil, nil, nil, .protocol, .port, .ip, ., .app_protocol, .payload] end |
.convert(masscan_file, output) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Converts the masscan scan file to CSV.
42 43 44 |
# File 'lib/ronin/masscan/converters/csv.rb', line 42 def self.convert(masscan_file,output) masscan_file_to_csv(masscan_file,output) end |
.masscan_file_to_csv(masscan_file, output) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Converts a masscan scan file to CSV.
56 57 58 59 60 61 62 |
# File 'lib/ronin/masscan/converters/csv.rb', line 56 def self.masscan_file_to_csv(masscan_file,output) masscan_file_to_rows(masscan_file) do |row| output << ::CSV.generate_line(row) end return output end |
.masscan_file_to_rows(masscan_file) {|row| ... } ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Converts an opened masscan scan file to a series of rows.
79 80 81 82 83 84 85 |
# File 'lib/ronin/masscan/converters/csv.rb', line 79 def self.masscan_file_to_rows(masscan_file) yield HEADER masscan_file.each do |record| yield record_to_row(record) end end |
.record_to_row(record) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/ronin/masscan/converters/csv.rb', line 87 def self.record_to_row(record) case record when ::Masscan::Status status_record_to_row(record) when ::Masscan::Banner (record) else raise(NotImplementedError,"unable to convert masscan record: #{record.inspect}") end end |
.status_record_to_row(status) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
98 99 100 |
# File 'lib/ronin/masscan/converters/csv.rb', line 98 def self.status_record_to_row(status) ['status', status.status, status.protocol, status.port, status.reason.join(','), status.ttl, status.ip, status.] end |