Class: Ronin::Payloads::CLI::Commands::List Private

Inherits:
Ronin::Payloads::CLI::Command show all
Defined in:
lib/ronin/payloads/cli/commands/list.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.

Lists the available payloads.

Usage

ronin-payloads list [options] [DIR]

Options

-h, --help                       Print help information

Arguments

[DIR]                            The optional payload directory to list

Instance Method Summary collapse

Instance Method Details

#run(dir = 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 list command.

Parameters:

  • dir (String, nil) (defaults to: nil)

    The optional payload directory to list.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/ronin/payloads/cli/commands/list.rb', line 61

def run(dir=nil)
  files = if dir
            dir = "#{dir}/" unless dir.end_with?('/')

            Payloads.list_files.select do |file|
              file.start_with?(dir)
            end
          else
            Payloads.list_files
          end

  files.each do |file|
    puts "  #{file}"
  end
end