Class: Ronin::CLI::Commands::BannerGrab Private

Inherits:
ValueProcessorCommand show all
Includes:
HostAndPort
Defined in:
lib/ronin/cli/commands/banner_grab.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.

Fetches the banner from one or more TCP services.

Usage

ronin banner-grab [options] {HOST:PORT} ...

Options

-f, --file FILE                  Optional file to read values from
    --with-host-port             Print the service with each banner
-h, --help                       Print help information

Arguments

HOST:PORT ...                    A TCP service to fetch the banner from.

Since:

  • 2.0.0

Instance Attribute Summary

Attributes inherited from ValueProcessorCommand

#files

Instance Method Summary collapse

Methods included from HostAndPort

#host_and_port, #host_and_port_from_url

Methods inherited from ValueProcessorCommand

#initialize, #process_file, #run

Constructor Details

This class inherits a constructor from Ronin::CLI::ValueProcessorCommand

Instance Method Details

#process_value(service) ⇒ 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.

Grabs the banner for the service.

Parameters:

  • service (String)

    The HOST:PORT service pair.

Since:

  • 2.0.0



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/ronin/cli/commands/banner_grab.rb', line 67

def process_value(service)
  host, port = host_and_port(service)

  begin
    banner = Support::Network::TCP.banner(host,port)

    if options[:with_host_port]
      puts "#{service}: #{banner}"
    else
      puts banner
    end
  rescue StandardError => error
    print_error("#{service}: #{error.message}")
  end
end