Textfields for ARE module input fields.
This commit is contained in:
@@ -10,6 +10,49 @@ AutoRunModuleForm = function(moduleData, deleteFn, moveUp, moveDown, ruleId, ind
|
||||
const moduleTextAreaId = `rule-${ruleId}-module-textarea-${index}`;
|
||||
const chainModeComboId = `rule-${ruleId}-module-combo-${index}`;
|
||||
|
||||
const moduleOptionsContainer = new Ext.Panel({
|
||||
padding: '5 5 5 5',
|
||||
border: false,
|
||||
layout: 'form',
|
||||
items: [/*{
|
||||
xtype: 'combo',
|
||||
id: chainModeComboId,
|
||||
fieldLabel: 'Chain Mode',
|
||||
store: ['moduleA', 'moduleB'], // TODO: Update this to the array of commands.
|
||||
queryMode: 'local', // Use local data.
|
||||
triggerAction: 'all', // Show both options instead of just the default.
|
||||
editable: false, // Disable manual text input.
|
||||
forceSelection: true,
|
||||
value: moduleData.name,
|
||||
},*/
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
fieldLabel: 'Module Name',
|
||||
value: moduleData.name,
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
fieldLabel: 'Module Author',
|
||||
value: moduleData.author ? moduleData.author : 'anonymous',
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
function loadModule() {
|
||||
// TODO: Need to query module option types so that not everything is given a textfield.
|
||||
console.log("Module data:");
|
||||
console.log(moduleData);
|
||||
for (key in moduleData.options) {
|
||||
const value = moduleData.options[key];
|
||||
const inputField = new Ext.form.TextField({
|
||||
fieldLabel: key,
|
||||
value: value ? value : '',
|
||||
});
|
||||
moduleOptionsContainer.add(inputField);
|
||||
};
|
||||
}
|
||||
loadModule();
|
||||
|
||||
const buttonContainer = new Ext.Container({
|
||||
layout: {
|
||||
type: 'hbox',
|
||||
@@ -34,30 +77,13 @@ AutoRunModuleForm = function(moduleData, deleteFn, moveUp, moveDown, ruleId, ind
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
AutoRunModuleForm.superclass.constructor.call(this, {
|
||||
padding: '10 10 10 10',
|
||||
closable: false,
|
||||
items: [
|
||||
/*{
|
||||
xtype: 'combo',
|
||||
id: chainModeComboId,
|
||||
fieldLabel: 'Chain Mode',
|
||||
store: ['sequential', 'nested-forward'],
|
||||
queryMode: 'local', // Use local data.
|
||||
triggerAction: 'all', // Show both options instead of just the default.
|
||||
editable: false, // Disable manual text input.
|
||||
forceSelection: true,
|
||||
value: moduleData.chain_mode ? moduleData.chain_mode : 'sequential'
|
||||
},*/
|
||||
{
|
||||
xtype: 'textarea',
|
||||
id: moduleTextAreaId,
|
||||
fieldLabel: 'Module Data',
|
||||
value: moduleData ? JSON.stringify(moduleData) : '{}',
|
||||
grow: true,
|
||||
width: '80%'
|
||||
},
|
||||
buttonContainer
|
||||
moduleOptionsContainer,
|
||||
buttonContainer
|
||||
]});
|
||||
};
|
||||
|
||||
|
||||
@@ -357,13 +357,13 @@ function genNewExploitPanel(panel, command_module_id, command_module_name, zombi
|
||||
fieldLabel: 'Description',
|
||||
fieldClass: 'command-module-panel-description',
|
||||
value: module.Description
|
||||
}),
|
||||
new Ext.form.DisplayField({
|
||||
name: 'command_module_id_visible',
|
||||
fieldLabel: 'Id',
|
||||
fieldClass: 'command-module-panel-description',
|
||||
value: command_module_id
|
||||
})
|
||||
}),
|
||||
new Ext.form.DisplayField({
|
||||
name: 'command_module_id_visible',
|
||||
fieldLabel: 'Id',
|
||||
fieldClass: 'command-module-panel-description',
|
||||
value: command_module_id
|
||||
})
|
||||
],
|
||||
|
||||
buttons:[{
|
||||
@@ -425,3 +425,63 @@ function genNewExploitPanel(panel, command_module_id, command_module_name, zombi
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function genNewAutoRunModulePanel(panel, module, ruleId) {
|
||||
if(typeof panel != 'object') {
|
||||
Ext.beef.msg('Bad!', 'Incorrect panel chosen.');
|
||||
return;
|
||||
}
|
||||
|
||||
panel.removeAll();
|
||||
if(module.name == 'some special command module') {
|
||||
//HERE we will develop specific panels for the command modules that require it.
|
||||
} else {
|
||||
var form = new Ext.form.FormPanel({
|
||||
id: `form-are-module-${ruleId}`,
|
||||
border: false,
|
||||
labelWidth: 75,
|
||||
defaultType: 'textfield',
|
||||
title: module.name,
|
||||
bodyStyle: 'padding: 5px;',
|
||||
|
||||
items: [
|
||||
new Ext.form.DisplayField({
|
||||
name: 'command_module_description',
|
||||
fieldLabel: 'Description',
|
||||
fieldClass: 'command-module-panel-description',
|
||||
value: module.description
|
||||
}),
|
||||
],
|
||||
|
||||
buttons:[{
|
||||
text: "Save Module",
|
||||
handler: function() {console.log("Saved module...")}
|
||||
}]
|
||||
});
|
||||
|
||||
// create the panel and hide it
|
||||
/*
|
||||
var payload_panel = new Ext.Panel({
|
||||
id: 'payload-panel', // used with Ext.GetCmp('payload-panel')
|
||||
bodyStyle: 'padding:10px;', // we can assign styles to the main div
|
||||
layout : 'form',
|
||||
bodyBorder: false,
|
||||
height: 200,
|
||||
hidden: true,
|
||||
border: false //we can remove the border of the panel
|
||||
});
|
||||
*/
|
||||
|
||||
Ext.each(module.Data, function(input){
|
||||
// Fake a zombie "session" property for the sake of getting it working.
|
||||
generate_form_input_field(form, input, null, false, {session: module.name})}
|
||||
);
|
||||
|
||||
//form.add(payload_panel);
|
||||
panel.add(form);
|
||||
panel.doLayout();
|
||||
// hide the load mask after rendering of the config panel is done
|
||||
//panel.configLoadMask.hide();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user