lib/ronin/ui/cli/commands/hosts.rb in ronin-1.0.0 vs lib/ronin/ui/cli/commands/hosts.rb in ronin-1.1.0.rc1
- old
+ new
@@ -15,23 +15,23 @@
#
# You should have received a copy of the GNU General Public License
# along with Ronin. If not, see <http://www.gnu.org/licenses/>.
#
-require 'ronin/ui/cli/model_command'
+require 'ronin/ui/cli/resources_command'
require 'ronin/host_name'
module Ronin
module UI
module CLI
module Commands
#
# The `ronin-hosts` command.
#
- class Hosts < ModelCommand
+ class Hosts < ResourcesCommand
- self.model = HostName
+ model HostName
query_option :with_ips, :type => :array,
:aliases => '-I',
:banner => 'IP [...]'
@@ -83,12 +83,10 @@
# The IP address to look up.
#
# @since 1.0.0
#
def lookup(ip)
- Database.setup
-
print_info "Looking up #{ip} ..."
HostName.lookup(ip).each do |host|
print_info " #{host}"
end
@@ -103,11 +101,9 @@
# The path to the file.
#
# @since 1.0.0
#
def import(path)
- Database.setup
-
File.open(path) do |file|
file.each_line do |line|
line.strip!
next if line.empty?