Class: Ronin::PostEx::CLI::ShellShell

Inherits:
Core::CLI::Shell
  • Object
show all
Defined in:
lib/ronin/post_ex/cli/shell_shell.rb

Overview

A shell for System::Shell.

Instance Method Summary collapse

Constructor Details

#initialize(shell, **kwargs) ⇒ ShellShell

Initializes the shell.

Parameters:

  • shell (System::Shell)

    The shell resource.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments for Ronin::Core::CLI::Shell#initialize.



43
44
45
46
47
# File 'lib/ronin/post_ex/cli/shell_shell.rb', line 43

def initialize(shell, **kwargs)
  super(**kwargs)

  @shell = shell
end

Instance Method Details

#exec(command) ⇒ Object

Executes a command and prints it's output.

Parameters:

  • command (String)

    The command string.



55
56
57
58
59
60
61
# File 'lib/ronin/post_ex/cli/shell_shell.rb', line 55

def exec(command)
  if command == 'exit'
    exit
  else
    puts @shell.run(command)
  end
end