Class: Ronin::Payloads::CLI::Commands::New Private

Inherits:
Ronin::Payloads::CLI::Command show all
Includes:
Core::CLI::Generator, Core::CLI::Generator::Options::Author, Core::CLI::Generator::Options::Description, Core::CLI::Generator::Options::Reference, Core::CLI::Generator::Options::Summary, Generator
Defined in:
lib/ronin/payloads/cli/commands/new.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.

Creates a new payload file.

Usage

ronin-payload new [options] FILE

Options

-t asm|shellcode|c|go|rust|shell|powershell|html|javascript|typescript|java|sql|php|python|ruby|nodejs,
    --type                       The type for the new payload
-a, --author NAME                The name of the author
-e, --author-email EMAIL         The email address of the author
-S, --summary TEXT               One sentence summary
-D, --description TEXT           Longer description
-R, --reference URL              Adds a reference URL
-h, --help                       Print help information

Arguments

FILE                             The path to the new payload file.

Constant Summary

Constants included from Generator

Generator::PAYLOAD_TYPES

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ New

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.

Initializes the ronin-payloads new command.



95
96
97
98
99
# File 'lib/ronin/payloads/cli/commands/new.rb', line 95

def initialize(**kwargs)
  super(**kwargs)

  @payload_type = PAYLOAD_TYPES.fetch(:payload)
end

Instance Attribute Details

#referencesArray<String> (readonly)

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.

The references to add to the payload.



87
88
89
# File 'lib/ronin/payloads/cli/commands/new.rb', line 87

def references
  @references
end

Instance Method Details

#run(file) ⇒ 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 new command.



107
108
109
110
111
112
113
# File 'lib/ronin/payloads/cli/commands/new.rb', line 107

def run(file)
  @file_name  = File.basename(file,File.extname(file))
  @class_name = CommandKit::Inflector.camelize(@file_name)

  erb "payload.rb.erb", file
  chmod '+x', file
end