Class: Ronin::UI::CLI::Commands::Hosts
- Inherits:
-
ResourcesCommand
- Object
- Thor::Group
- Ronin::UI::CLI::Command
- ModelCommand
- ResourcesCommand
- Ronin::UI::CLI::Commands::Hosts
- Defined in:
- lib/ronin/ui/cli/commands/hosts.rb
Overview
The ronin-hosts
command.
Instance Method Summary collapse
-
#execute ⇒ Object
Queries the HostName model.
-
#lookup(ip) ⇒ Object
protected
Looks up an IP address.
-
#print_resource(host) ⇒ Object
protected
Prints a host name.
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 HostName model.
67 68 69 70 71 72 73 |
# File 'lib/ronin/ui/cli/commands/hosts.rb', line 67 def execute if [:lookup] lookup [:lookup] else super end end |
#lookup(ip) ⇒ Object (protected)
Looks up an IP address.
85 86 87 88 89 90 91 92 93 |
# File 'lib/ronin/ui/cli/commands/hosts.rb', line 85 def lookup(ip) print_info "Looking up #{ip} ..." HostName.lookup(ip).each do |host| print_info " #{host}" end print_info "Looked up #{ip}" end |
#print_resource(host) ⇒ Object (protected)
Prints a host name.
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 138 139 140 141 |
# File 'lib/ronin/ui/cli/commands/hosts.rb', line 103 def print_resource(host) return super(host) unless .verbose? print_title host.address indent do if (org = host.organization) print_hash 'Organization' => org end if (last_scanned_at = host.last_scanned_at) print_hash 'Last Scanned' => last_scanned_at end unless host.ip_addresses.empty? print_array host.ip_addresses, :title => 'IP Addresses' end unless host.open_ports.empty? print_section 'Open Ports' do host.open_ports.each do |port| if port.service puts "#{port}\t#{port.service}" else puts port end end end end unless host.email_addresses.empty? print_array host.email_addresses, :title => 'Email Addresses' end unless host.urls.empty? print_array host.urls, :title => 'URLs' end end end |