Class: Ronin::Payloads::URLPayload

Inherits:
Payload
  • Object
show all
Defined in:
lib/ronin/payloads/url_payload.rb

Overview

Represents a payload which is hosted publicly at a specified URL.

Example

class MyHostedPayload < URLPayload

  url 'https://evil.com/downloads/my_payload'

end

Direct Known Subclasses

Test::OpenRedirect

Instance Attribute Summary

Attributes inherited from Payload

#encoders, #payload

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Payload

#built?, #built_payload, #bytesize, #cleanup, #encode_payload, #encoded_payload, encoder_class, #initialize, #length, #perform_build, #perform_cleanup, #perform_postlaunch, #perform_prelaunch, #perform_validate, #postlaunch, #prelaunch, #rebuild_payload, #reencode_payload, register, #to_s, #validate

Constructor Details

This class inherits a constructor from Ronin::Payloads::Payload

Class Method Details

.payload_typeSymbol

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.

Note:

This is used internally to map an payload class to a printable type.

Returns the type or kind of payload.

Returns:

  • (Symbol)


72
73
74
# File 'lib/ronin/payloads/url_payload.rb', line 72

def self.payload_type
  :url_payload
end

.url(new_url = nil) ⇒ String

Gets or sets the URL for the payload.

Parameters:

  • new_url (String, nil) (defaults to: nil)

    The new URL to set.

Returns:

  • (String)

    The URL for the payload.

Raises:

  • (NotImplementedError)

    The payload class did not define a url.



51
52
53
54
55
56
57
58
59
60
# File 'lib/ronin/payloads/url_payload.rb', line 51

def self.url(new_url=nil)
  if new_url
    @url = new_url
  else
    @url || if superclass < URLPayload
              superclass.url ||
                raise(NotImplementedError,"#{self} did not define a url")
            end
  end
end

Instance Method Details

#buildObject

Builds the URL payload.



79
80
81
# File 'lib/ronin/payloads/url_payload.rb', line 79

def build
  @payload = self.class.url
end