lib/ronin/ui/cli/commands/hosts.rb in ronin-1.2.0 vs lib/ronin/ui/cli/commands/hosts.rb in ronin-1.3.0
- old
+ new
@@ -63,15 +63,13 @@
# Queries the {HostName} model.
#
# @since 1.0.0
#
def execute
- if options[:import]
- import options[:import]
- elsif options[:lookup]
+ if options[:lookup]
lookup options[:lookup]
- elsif options.list?
+ else
super
end
end
protected
@@ -93,35 +91,10 @@
print_info "Looked up #{ip}"
end
#
- # Imports host names from a file.
- #
- # @param [String] path
- # The path to the file.
- #
- # @since 1.0.0
- #
- def import(path)
- File.open(path) do |file|
- file.each_line do |line|
- line.strip!
- next if line.empty?
-
- host = HostName.new(:address => line)
-
- if host.save
- print_info "Imported #{host}"
- else
- print_error "Unable to import #{line.dump}."
- end
- end
- end
- end
-
- #
# Prints a host name.
#
# @param [HostName] host
# The host name to print.
#
@@ -132,14 +105,14 @@
print_title host.address
indent do
if (org = host.organization)
- print_hash('Organization' => org)
+ print_hash 'Organization' => org
end
if (last_scanned_at = host.last_scanned_at)
- print_hash('Last Scanned' => 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