Class: Ronin::Exploits::HTTP

Inherits:
RemoteTCP show all
Includes:
Network::Mixins::HTTP
Defined in:
lib/ronin/exploits/http.rb

Overview

An Exploit class that represents exploits against HTTP servers.

Direct Known Subclasses

Web

Constant Summary collapse

DEFAULT_PORT =

Default port to connect to

80

Instance Attribute Summary

Attributes inherited from Exploit

#encoders, #helpers, #raw_payload, #restricted_chars, #target

Attributes included from Payloads::HasPayload

#payload

Instance Method Summary collapse

Methods inherited from RemoteTCP

#deploy!, #test!

Methods included from Model::HasDefaultPort

included

Methods inherited from Exploit

#advisory, advisory, #arch, #build!, #build_payload!, #deploy!, #encode_payload, #encode_payload!, #evacuate!, #exploit!, #helper, #initialize, #os, #payload=, #restrict, #software, #targeting, #targeting_arch, targeting_arch, #targeting_os, targeting_os, #targeting_software, targeting_software, #use_target!

Methods included from Tests

#is_restricted?, #test_arch!, #test_os!, #test_restricted!, #test_software!, #test_target!

Methods included from PostExploitation::Mixin

#fs, #post_exploitation, #process, #resources, #shell

Methods included from Payloads::HasPayload

#default_payload, #initialize, #method_missing, #payload_class, #respond_to?, #use_payload!, #use_payload_from!

Constructor Details

This class inherits a constructor from Ronin::Exploits::Exploit

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ronin::Payloads::HasPayload

Instance Method Details

#url_for(path, query_params = {}) ⇒ URI::HTTP

Constructs a URL for the given path.

Examples:

url_for '/path'
# => #<URI::HTTP:0x00000000cf53a0 URL:http://example.com/path>

with a query-string

url_for '/path?q=1'
# => #<URI::HTTP:0x00000000cf53a0 URL:http://example.com/path?q=1>

with query-params.

url_for '/path', q: 1
# => #<URI::HTTP:0x00000000cf53a0 URL:http://example.com/path?q=1>

Parameters:

  • path (String)

    The path for the new URL.

  • query_params (Hash) (defaults to: {})

    Additional query parameters for the URL.

Returns:

  • (URI::HTTP)

    The new URL.


68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/ronin/exploits/http.rb', line 68

def url_for(path,query_params={})
  require_params :host

  path, query = path.split('?',2)

  url = ::URI::HTTP.build(
    host:  self.host,
    port:  self.port,
    path:  path,
    query: query
  )

  if self.url_prefix
    # add tue url prefix
    url.path = File.join('',self.url_prefix,url.path)
  end

  # add additional query params
  url.query_params.merge!(query_params)

  return url
end