Class: Ronin::Payloads::CLI::Commands::Show Private
- Inherits:
-
PayloadCommand
- Object
- Core::CLI::Command
- Ronin::Payloads::CLI::Command
- PayloadCommand
- Ronin::Payloads::CLI::Commands::Show
- Includes:
- CommandKit::Printing::Fields, Core::CLI::Printing::Arch, Core::CLI::Printing::Metadata, Core::CLI::Printing::OS, Core::CLI::Printing::Params, Printing
- Defined in:
- lib/ronin/payloads/cli/commands/show.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Prints information about a payload.
Usage
ronin-payloads show [options] {--file FILE | NAME}
Options
-f, --file FILE The optional file to load the payload from
-v, --verbose Enables verbose output
-h, --help Print help information
Arguments
NAME The name of the payload to load
Constant Summary
Constants included from Printing
Instance Attribute Summary
Attributes inherited from PayloadCommand
Instance Method Summary collapse
-
#example_build_command(payload) ⇒ String
private
Builds an example
ronin-payloads build
command for the payload. -
#print_payload(payload) ⇒ Object
private
Prints the metadata for a payload class.
-
#print_payload_usage(payload) ⇒ Object
private
Prints an example
ronin-payloads build
command for the payload. -
#run(name = nil) ⇒ Object
private
Runs the
ronin-payloads show
command.
Methods included from Printing
Methods inherited from PayloadCommand
#initialize_payload, #load_payload, #load_payload_from, #validate_payload
Methods included from PayloadMethods
#initialize_payload, #load_payload, #load_payload_from, #validate_payload
Instance Method Details
#example_build_command(payload) ⇒ String
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.
Builds an example ronin-payloads build
command for the payload.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/ronin/payloads/cli/commands/show.rb', line 142 def example_build_command(payload) command = ['ronin-payloads', 'build'] if [:file] command << '-f' << [:file] else command << payload.id end payload.params.each_value do |param| if param.required? && !param.default command << '-p' << "#{param.name}=#{param_usage(param)}" end end return command.join(' ') end |
#print_payload(payload) ⇒ Object
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.
Prints the metadata for a payload class.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/ronin/payloads/cli/commands/show.rb', line 85 def print_payload(payload) puts "[ #{payload.id} ]" puts indent do fields = {} fields['Type'] = payload_type(payload) fields['Summary'] = payload.summary if payload.summary if payload.include?(Metadata::Arch) if (arch = payload.arch) fields['Arch'] = arch_name(arch) end end if payload.include?(Metadata::OS) if (os = payload.os) fields['OS'] = os_name(os) end end print_fields(fields) puts (payload) print_description(payload) print_references(payload) print_params(payload) print_payload_usage(payload) end end |
#print_payload_usage(payload) ⇒ Object
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.
Prints an example ronin-payloads build
command for the payload.
125 126 127 128 129 130 |
# File 'lib/ronin/payloads/cli/commands/show.rb', line 125 def print_payload_usage(payload) puts "Usage:" puts puts " $ #{example_build_command(payload)}" puts end |
#run(name = nil) ⇒ Object
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.
Runs the ronin-payloads show
command.
74 75 76 77 78 |
# File 'lib/ronin/payloads/cli/commands/show.rb', line 74 def run(name=nil) super(name) print_payload(payload_class) end |