Document how to derive reference_name from ancestors

MSP-11145
bug/bundler_fix
Luke Imhoff 2014-10-27 15:59:12 -05:00
parent 485860ebfb
commit dae114a7f3
No known key found for this signature in database
GPG Key ID: 5B1FB01FB33356F8
1 changed files with 30 additions and 1 deletions

View File

@ -3,6 +3,31 @@
# Tests that the `:ancestor_reference_names` can be loaded from `:modules_pathname` and once the ancestors are loaded
# that `:reference_name` can be instantiated.
#
# # Payload Reference Name Derivation
# You can see this naming logic [here](https://github.com/rapid7/metasploit-framework/blob/1508be6254f698f345616d14415bce164bf377f9/lib/msf/core/payload_set.rb#L132-L148).
#
# ## Single
# 1. Remove the payload type prefix, `modules/payloads/singles`, from the path.
# 2. Remove the file extension, `.rb` from the path
#
# This is <reference_name>
#
# ## Staged
#
# ### Stager
# Determine if the stager module has a `handler_type_alias`
# No) Use stager's handler's `handler_type` as `<handler_type>`.
# Yes) Use the return value from `handler_type_alias` as `<handler_type>`.
#
# ### Stage
# 1. Remove the payload type prefix, `modules/payloads/stages`, from the path.
# 2. Remove the file extension, `.rb` from the path.
#
# This is <stage_reference_name>.
#
# ### Combining
# The final staged module's combined `<reference_name>` is `<stage_reference_name>/<handler_type>`.
#
# @example Using 'payload can be instantiated' with `Metasploit::Framework::Spec::UntestedPayloads.define_task` and 'untested payloads' shared context
# # Rakefile
# require 'metasploit/framework/spec/untested_payloads'
@ -33,7 +58,11 @@
#
# @param options [Hash{Symbol => Array<String>, Pathname, String}]
# @option options [Array<String>] :ancestor_reference_names The reference names of the payload modules that are included
# in {Msf::Payload} to make the `:reference_name` payload.
# in {Msf::Payload} to make the `:reference_name` payload. Ancestor reference names are the names of the files under
# `modules/payloads` without the extension `.rb` that are mixed together to form a payload module `Class`. For
# single payloads, there will be one ancestor reference name from `modules/payloads/singles`, while for staged
# payloads there with be one ancestor reference name from `modules/payloads/stagers` and one ancestor reference name
# from `modules/payloads/stages`.
# @option options [Pathname] :modules_pathname The `modules` directory from which to load `:ancestor_reference_names`.
# @option options [String] :reference_name The reference name for payload class that should be instantiated from mixing
# `:ancestor_reference_names`.