Class: Ronin::Payloads::CLI::Commands::Encoder Private

Inherits:
Ronin::Payloads::CLI::Command show all
Includes:
CommandKit::Printing::Fields, Core::CLI::Printing::Arch, Core::CLI::Printing::Metadata, Core::CLI::Printing::OS, Core::CLI::Printing::Params, EncoderMethods
Defined in:
lib/ronin/payloads/cli/commands/encoder.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 an encoder.

Instance Method Summary collapse

Methods included from EncoderMethods

#encoder_type, #initialize_encoder, #load_encoder_from, #validate_encoder

Instance Method Details

#load_encoder(name) ⇒ Class<Encoders::Encoder>

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.

Loads an encoder class.

Returns:



80
81
82
# File 'lib/ronin/payloads/cli/commands/encoder.rb', line 80

def load_encoder(name)
  super(name,options[:file])
end

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 metadata for an encoder class.

Parameters:



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
117
118
119
120
121
122
123
# File 'lib/ronin/payloads/cli/commands/encoder.rb', line 90

def print_encoder(encoder_class)
  puts "[ #{encoder_class.id} ]"
  puts

  indent do
    fields = {}

    if (type = encoder_type(encoder_class))
      fields['Type'] = type
    end

    if encoder_class.include?(Metadata::Arch)
      if (arch = encoder_class.arch)
        fields['Arch'] = arch_name(arch)
      end
    end

    if encoder_class.include?(Metadata::OS)
      if (os = encoder_class.os)
        fields['OS'] = os_name(os)
      end
    end

    if (summary = encoder_class.summary)
      fields['Summary'] = summary
    end

    print_fields fields
    print_authors(encoder_class)
    print_description(encoder_class)
    print_references(encoder_class)
    print_params(encoder_class)
  end
end

#run(name) ⇒ 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 encoder command.

Parameters:

  • name (String)

    The optional name of the encoder to load and print metadata about.



71
72
73
# File 'lib/ronin/payloads/cli/commands/encoder.rb', line 71

def run(name)
  print_encoder(load_encoder(name))
end