Class: Wpxf::Payloads::Custom

Inherits:
Wpxf::Payload show all
Includes:
Wpxf
Defined in:
lib/wpxf/payloads/custom.rb

Overview

A custom payload container.

Instance Attribute Summary

Attributes inherited from Wpxf::Payload

#queued_commands

Attributes included from Options

#datastore, #options

Instance Method Summary collapse

Methods included from Wpxf

app_path, build_module_list, change_stdout_sync, custom_modules_path, data_directory, databases_path, gemspec, home_directory, load_custom_modules, load_module, modules_path, payloads_path, version

Methods inherited from Wpxf::Payload

#check, #cleanup, #constants, #enqueue_command, #escape_single_quotes, #generate_vars, #obfuscated_variables, #php_preamble, #post_exploit, #random_var_name

Methods included from Options

#all_options_valid?, #get_option, #get_option_value, #missing_options, #normalized_option_value, #option_valid?, #option_value?, #register_advanced_options, #register_evasion_options, #register_option, #register_options, #scoped_option_change, #set_option_value, #unregister_option, #unset_option

Constructor Details

#initializeCustom

Returns a new instance of Custom.



8
9
10
11
12
13
14
15
16
17
18
19
# 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

Instance Method Details

#encodedObject



21
22
23
# File 'lib/wpxf/payloads/custom.rb', line 21

def encoded
  raw
end

#payload_pathObject



25
26
27
# File 'lib/wpxf/payloads/custom.rb', line 25

def payload_path
  File.expand_path(datastore['payload_path'])
end

#prepare(mod) ⇒ Object



29
30
31
32
33
34
35
36
# 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

#rawObject



38
39
40
# File 'lib/wpxf/payloads/custom.rb', line 38

def raw
  File.open(payload_path, 'rb', &:read)
end