Class: Ronin::CLI::Commands::Iprange Private
- Inherits:
-
ValueProcessorCommand
- Object
- Core::CLI::Command
- Ronin::CLI::Command
- ValueProcessorCommand
- Ronin::CLI::Commands::Iprange
- Defined in:
- lib/ronin/cli/commands/iprange.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.
Enumerates over the IP ranges.
Usage
ronin iprange [options] [IP_RANGE ... | --start IP --stop IP]
Options
-f, --file FILE Optional file to read values from
--start IP Starting IP address
--stop IP Stopping IP address
-s, --size Prints the size of the IP range
-h, --help Print help information
Arguments
[IP_RANGE ...] The IP Range to enumerate
Examples
ronin iprange 1.1.1.0/24 ronin iprange 1.1.1.* ronin iprange 1.1.2-4.10-50 ronin iprange --start 1.1.1.10 --stop 1.1.4.100 ronin iprange --file list.txt
Instance Attribute Summary
Attributes inherited from ValueProcessorCommand
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Iprange
constructor
private
Initializes the
ronin iprange
command. -
#process_ip_range(ip_range) ⇒ Object
private
Processes a parsed IP range object.
-
#process_value(string) ⇒ Object
private
Processes an IP range.
-
#run(*ip_ranges) ⇒ Object
private
Runs the
ronin iprange
command.
Methods inherited from ValueProcessorCommand
Constructor Details
#initialize(**kwargs) ⇒ Iprange
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 ronin iprange
command.
94 95 96 97 98 99 |
# File 'lib/ronin/cli/commands/iprange.rb', line 94 def initialize(**kwargs) super(**kwargs) @start = [] @stop = [] end |
Instance Method Details
#process_ip_range(ip_range) ⇒ 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.
Processes a parsed IP range object.
The IP range to process.
142 143 144 145 146 147 148 149 150 |
# File 'lib/ronin/cli/commands/iprange.rb', line 142 def process_ip_range(ip_range) if [:size] puts ip_range.size else ip_range.each do |ip| puts ip end end end |
#process_value(string) ⇒ 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.
Processes an IP range.
129 130 131 132 133 |
# File 'lib/ronin/cli/commands/iprange.rb', line 129 def process_value(string) range = Support::Network::IPRange.new(string) process_ip_range(range) end |
#run(*ip_ranges) ⇒ 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 iprange
command.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/ronin/cli/commands/iprange.rb', line 107 def run(*ip_ranges) if !@start.empty? && !@stop.empty? unless @start.length == @stop.length print_error "must specify an equal number of --start and --stop options" exit(-1) end @start.zip(@stop).each do |(start,stop)| range = Support::Network::IPRange::Range.new(start,stop) process_ip_range(range) end else super(*ip_ranges) end end |