Class: Ronin::Exploits::CLI::Commands::List Private

Inherits:
Ronin::Exploits::CLI::Command show all
Defined in:
lib/ronin/exploits/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 exploits.

Usage

ronin-exploits list [options] [NAME]

Options

-h, --help                       Print help information

Arguments

[NAME]                           The optional exploit name 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-exploits list command.

Parameters:

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

    The optional exploit directory to list.



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

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

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

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