Created form component for each ARE rule.

This commit is contained in:
root
2024-02-17 03:18:03 -05:00
parent bf4883a0f0
commit b1c04f9f6f
3 changed files with 34 additions and 3 deletions

View File

@@ -91,6 +91,7 @@ module BeEF
ui/panel/Logout.js
ui/panel/WelcomeTab.js
ui/panel/AutoRunTab.js
ui/panel/AutoRunRuleForm.js
ui/panel/ModuleSearching.js
]

View File

@@ -0,0 +1,30 @@
/**
* Form for the user to read, update and delete a specific Auto Run rule.
*
* rule: The object definition of this rule from the Auto Run Engine.
* deleteFn: callback function to delete this rule.
* updateFn: callback function to update this rule.
*/
AutoRunRuleForm = function(rule, deleteFn, updateFn) {
AutoRunRuleForm.superclass.constructor.call(this, {
padding:'10 10 10 10',
items: [{
xtype: 'textfield',
value: rule.name ? rule.name : '',
fieldLabel: 'Name',
}],
buttons: [{
text: 'Delete',
handler: deleteFn
}, {
text: 'Save',
handler: updateFn
}],
border: false,
closable: false
});
};
Ext.extend(AutoRunRuleForm, Ext.FormPanel, {});

View File

@@ -55,10 +55,10 @@ AutoRunTab = function() {
container.update(`<p>Number of Auto Run rules enabled: ${rules.length}.</p>`);
for (let i = 0; i < rules.length; i++) {
ruleTitle = document.createElement('h4');
ruleTitle.innerHTML = rules[i].name ? rules[i].name : `Rule ${i + 1}`;
container.getEl().appendChild(ruleTitle);
ruleForm = new AutoRunRuleForm(rules[i], function() {console.log('delete')}, function() {console.log('update')});
container.add(ruleForm);
}
container.doLayout();
} else {
container.update("<p>Failed to load Auto Run rules.</p>");
}