Class: Ronin::UI::CLI::Commands::IPs
- Inherits:
-
ResourcesCommand
- Object
- Thor::Group
- Ronin::UI::CLI::Command
- ModelCommand
- ResourcesCommand
- Ronin::UI::CLI::Commands::IPs
- Defined in:
- lib/ronin/ui/cli/commands/ips.rb
Overview
The ronin-ips
command.
Instance Method Summary collapse
-
#execute ⇒ Object
Queries the IPAddress model.
-
#lookup(host) ⇒ Object
protected
Looks up a host name.
-
#print_resource(ip) ⇒ Object
protected
Prints an IP Address.
Methods inherited from ResourcesCommand
Methods inherited from ModelCommand
each_query_option, model, #query, query_option, query_options, #setup
Methods inherited from Ronin::UI::CLI::Command
banner, command_name, #indent, inherited, #initialize, #print_array, #print_exception, #print_hash, #print_section, #print_title, #puts, run, #setup
Constructor Details
This class inherits a constructor from Ronin::UI::CLI::Command
Instance Method Details
#execute ⇒ Object
Queries the IPAddress model.
67 68 69 70 71 72 73 |
# File 'lib/ronin/ui/cli/commands/ips.rb', line 67 def execute if [:lookup] lookup [:lookup] else super end end |
#lookup(host) ⇒ Object (protected)
Looks up a host name.
85 86 87 88 89 90 91 92 93 |
# File 'lib/ronin/ui/cli/commands/ips.rb', line 85 def lookup(host) print_info "Looking up #{host} ..." IPAddress.lookup(host).each do |ip| print_info " #{ip}" end print_info "Looked up #{host}" end |
#print_resource(ip) ⇒ Object (protected)
Prints an IP Address.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/ronin/ui/cli/commands/ips.rb', line 103 def print_resource(ip) return super(ip) unless .verbose? print_title ip.address indent do if (org = ip.organization) print_hash 'Organization' => org end if (last_scanned_at = ip.last_scanned_at) print_hash 'Last Scanned' => last_scanned_at end unless ip.mac_addresses.empty? print_array ip.mac_addresses, :title => 'MAC Addresses' end unless ip.host_names.empty? print_array ip.host_names, :title => 'Hostnames' end unless ip.open_ports.empty? print_section 'Open Ports' do ip.open_ports.each do |port| if port.service puts "#{port}\t#{port.service}" else puts port end end end end end end |