(Fixes issue 256) added defaultPayload in msfcommand, updated the JS combobox logic accordingly

git-svn-id: https://beef.googlecode.com/svn/trunk@960 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
antisnatchor
2011-05-09 19:43:44 +00:00
parent 78b5b1ac39
commit 41881f3086
2 changed files with 13 additions and 6 deletions

View File

@@ -56,17 +56,23 @@ function generate_form_input_field(form, input, value, disabled, zombie) {
case 'combobox':
input_def['name'] = 'com_' + input['name'];
input_def['triggerAction'] = 'all';
// add a listener so that when the check box is changed it will update the payload options
if(input.reloadOnChange) { // input.reloadOnChange is set in msfcommand.rb
if(input.reloadOnChange || input.defaultPayload != null) { // defined in msfcommand.rb
Ext.getCmp("payload-panel").show(); // initially the panel will be empty so it may appear still hidden
input_def['listeners'] = {
// update the payload options when one of them is selected
'select': function(combo, value) {
get_dynamic_payload_details(combo.getValue(), zombie); // combo.getValue() is the selected payload
}
get_dynamic_payload_details(combo.getValue(), zombie);
},
// set the default payload value as defined in defaultPayload
'afterrender': function(combo){
combo.setValue(input.defaultPayload);
get_dynamic_payload_details(combo.getValue(),zombie);
}
};
}
// create store to contain options for the combo box
input_def['store'] = new Ext.data.ArrayStore( {
fields: input['store_fields'],

View File

@@ -128,7 +128,8 @@ module Commands
'displayField' => 'payload' ,
'autoWidth' => true,
'mode' => 'local',
'reloadOnChange' => true, # this will trigger a reload of the payload options
'reloadOnChange' => true, # reload payloads
'defaultPayload' => "generic/shell_bind_tcp", # default combobox value
'emptyText' => "select a payload..."
}