Class: Ronin::Masscan::CLI::Commands::Dump Private
- Inherits:
-
Ronin::Masscan::CLI::Command
- Object
- Core::CLI::Command
- Ronin::Masscan::CLI::Command
- Ronin::Masscan::CLI::Commands::Dump
- Includes:
- FilteringOptions
- Defined in:
- lib/ronin/masscan/cli/commands/dump.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Dumps the scanned ports from masscan scan file(s).
Usage
ronin-masscan dump [options] MASSCAN_FILE [...]
Options
--print-ips Print all IP addresses
--print-hosts Print all hostnames
--print-ip-ports Print IP:PORT pairs. (Default)
--print-host-ports Print HOST:PORT pairs
--print-uris Print URIs
-P, --protocol tcp|udp Filters the targets by protocol
--ip IP Filters the targets by IP
--ip-range CIDR Filter the targets by IP range
-p, --ports {PORT | PORT1-PORT2},...
Filter targets by port number
-h, --help Print help information
Arguments
MASSCAN_FILE ... The masscan scan file(s) to parse
Examples
ronin-masscan dump --print-ip-ports masscan.bin
ronin-masscan dump --print-ip-ports --ports 22,80,443 masscan.bin
ronin-masscan dump --print-host-ports masscan.bin
ronin-masscan dump --print-hosts --with-port 22 masscan.bin
ronin-masscan dump --print-uris masscan.bin
Instance Attribute Summary
Attributes included from FilteringOptions
#ip_ranges, #ips, #ports, #protocols, #with_app_protocols, #with_payloads
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Dump
constructor
private
Initializes the command.
-
#print_ip(target) ⇒ Object
private
Prints the IPs for the target.
-
#print_ip_ports(target) ⇒ Object
private
Prints the
IP:PORT
pair for the target. -
#print_target(host) ⇒ Object
private
Prints the target.
-
#print_uri(target) ⇒ Object
private
Prints the URIs for the target.
-
#run(*masscan_files) ⇒ Object
private
Runs the
ronin-masscan dump
command.
Methods included from FilteringOptions
#filter_banner_records, #filter_records, #filter_records_by_app_protocol, #filter_records_by_ip, #filter_records_by_ip_range, #filter_records_by_payload, #filter_records_by_port, #filter_records_by_protocol, #filter_status_records, included
Constructor Details
#initialize(**kwargs) ⇒ Dump
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.
Initializes the command.
112 113 114 115 116 |
# File 'lib/ronin/masscan/cli/commands/dump.rb', line 112 def initialize(**kwargs) super(**kwargs) @mode = :ip_ports end |
Instance Method Details
#print_ip(target) ⇒ 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.
Prints the IPs for the target.
157 158 159 |
# File 'lib/ronin/masscan/cli/commands/dump.rb', line 157 def print_ip(target) puts target.ip end |
#print_ip_ports(target) ⇒ 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.
Prints the IP:PORT
pair for the target.
166 167 168 |
# File 'lib/ronin/masscan/cli/commands/dump.rb', line 166 def print_ip_ports(target) puts "#{target.ip}:#{target.port}" end |
#print_target(host) ⇒ 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.
Prints the target.
144 145 146 147 148 149 150 |
# File 'lib/ronin/masscan/cli/commands/dump.rb', line 144 def print_target(host) case @mode when :ips then print_ip(host) when :ip_ports then print_ip_ports(host) when :uris then print_uri(host) end end |
#print_uri(target) ⇒ 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.
Prints the URIs for the target.
175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/ronin/masscan/cli/commands/dump.rb', line 175 def print_uri(target) case target.port when 80 puts URI::HTTP.build( host: target.ip.to_s, port: target.port ) when 443 puts URI::HTTPS.build( host: target.ip.to_s, port: target.port ) end end |
#run(*masscan_files) ⇒ 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.
Runs the ronin-masscan dump
command.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/ronin/masscan/cli/commands/dump.rb', line 124 def run(*masscan_files) masscan_files.each do |masscan_file| output_file = begin ::Masscan::OutputFile.new(masscan_file) rescue ArgumentError => error print_error(error.) exit(1) end filter_records(output_file).each do |target| print_target(target) end end end |