class Wpxf::Payloads::Custom

A custom payload container.

Public Class Methods

new() click to toggle source
Calls superclass method Wpxf::Payload::new
# File lib/wpxf/payloads/custom.rb, line 8
def initialize
  super

  unregister_option(get_option('encode_payload'))
  register_options([
    StringOption.new(
      name: 'payload_path',
      required: true,
      desc: 'The path to the custom payload'
    )
  ])
end

Public Instance Methods

encoded() click to toggle source
# File lib/wpxf/payloads/custom.rb, line 21
def encoded
  raw
end
payload_path() click to toggle source
# File lib/wpxf/payloads/custom.rb, line 25
def payload_path
  File.expand_path(datastore['payload_path'])
end
prepare(mod) click to toggle source
# File lib/wpxf/payloads/custom.rb, line 29
def prepare(mod)
  unless File.exist?(payload_path)
    mod.emit_error "#{payload_path} does not exist"
    return false
  end

  true
end
raw() click to toggle source
# File lib/wpxf/payloads/custom.rb, line 38
def raw
  File.open(payload_path, 'rb', &:read)
end