#
# Copyright (c) 2006-2020 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Jboss_jmx_upload_exploit < BeEF::Core::Command

  def self.options
    return [
        {'name' => 'rhost', 'ui_label' => 'Remote Target Host', 'value' => '127.0.0.1'},
        {'name' => 'rport', 'ui_label' => 'Remote Target Port', 'value' => '8080'},
        {'name' => 'lhost', 'ui_label' => 'MSF Listener Host', 'value' => '127.0.0.1'},
        {'name' => 'lport', 'ui_label' => 'MSF Listener Port (or bind)', 'value' => '6666'},
        {'name' => 'injectedCommand', 'ui_label' => 'Command to execute', 'value' => 'cmd.exe'},
        {'name' => 'jspName', 'ui_label' => 'Malicious JSP name', 'value' =>  rand(32**20).to_s(32)},
        { 'name' => 'payload', 'type' => 'combobox', 'ui_label' => 'Payload', 'store_type' => 'arraystore',
          'store_fields' => ['payload'], 'store_data' => [['reverse'],['bind']],
          'valueField' => 'payload', 'displayField' => 'payload', 'mode' => 'local', 'autoWidth' => true
        }
    ]
  end

  def post_execute
    save({'result' => @datastore['result']})
  end

end
