Module: Ronin::Exploits::Params::BaseURL

Defined in:
lib/ronin/exploits/params/base_url.rb

Overview

Adds the required base_url param to the exploit.

Since:

  • 1.0.0

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(exploit) ⇒ 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.

Adds the required base_url param to the exploit including Ronin::Exploits::Params::BaseURL.

Parameters:

Since:

  • 1.0.0



44
45
46
47
# File 'lib/ronin/exploits/params/base_url.rb', line 44

def self.included(exploit)
  exploit.param :base_url, URI, required: true,
                                desc: 'The base URL of the target'
end

Instance Method Details

#hostString

The targeted host.

Returns:

  • (String)

Since:

  • 1.0.0



54
55
56
# File 'lib/ronin/exploits/params/base_url.rb', line 54

def host
  params[:base_url].host
end

#portInteger

The targeted port.

Returns:

  • (Integer)

Since:

  • 1.0.0



63
64
65
# File 'lib/ronin/exploits/params/base_url.rb', line 63

def port
  params[:base_url].port
end

#url_for(path) ⇒ URI::HTTP, URI::HTTPS

Expands the URL or path into a fully qualified URL.

Parameters:

  • path (String)

    The URL or path to expand.

Returns:

  • (URI::HTTP, URI::HTTPS)

    If a URL is given, it will be returned as a URI::HTTP or URI::HTTPS object. If a path was given, it will be joined with the base_url param and a URI::HTTP or URI::HTTPS object will be returned.

Since:

  • 1.0.0



79
80
81
# File 'lib/ronin/exploits/params/base_url.rb', line 79

def url_for(path)
  params[:base_url].merge(path)
end