saving work: start implementing the code that will generate and disable distributed engine rules in the UI
git-svn-id: https://beef.googlecode.com/svn/trunk@630 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
@@ -88,5 +88,13 @@ module Constants
|
||||
|
||||
end
|
||||
|
||||
# The distributed engine codes
|
||||
module DistributedEngine
|
||||
|
||||
REQUESTER = 1
|
||||
PORTSCANNER = 2
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<%= script_tag 'ux/StatusBar.js' %>
|
||||
|
||||
<%= script_tag 'ui/panel/common.js' %>
|
||||
<%= script_tag 'ui/panel/DistributedEngine.js' %>
|
||||
<%= script_tag 'ui/panel/PanelStatusBar.js' %>
|
||||
|
||||
<%= script_tag 'ui/panel/tabs/ZombieTabMain.js' %>
|
||||
|
||||
39
public/javascript/ui/panel/DistributedEngine.js
Normal file
39
public/javascript/ui/panel/DistributedEngine.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* RULES TYPE
|
||||
* - DOMAIN : DOMAIN www.zzz.com
|
||||
* - EXTERNAL : EXTERNAL 123.456.789.123
|
||||
* - INTERNAL : INTERNAL 10.0.0.3
|
||||
*/
|
||||
DistributedEngine = function() {
|
||||
//defines the constant code to match with the backend ruby
|
||||
this.CONSTANTS = {
|
||||
'requester' : 1,
|
||||
'portscanner' : 2
|
||||
};
|
||||
|
||||
/*
|
||||
* Returns true of the hooked browser matches one of the rules and should be checked.
|
||||
* @param: {Literal Object} the browser object.
|
||||
* @param: {Literal Object} the rule set object.
|
||||
* @return: {Boolean} true if matches, false if not.
|
||||
*/
|
||||
this.HookedBrowserMatchesRules = function(hooked_browser, rules) {
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Disable an existing rule in the framework. That function is called when the user
|
||||
* unchecks a hooked browser.
|
||||
* @param: {Integer} the id of the rule.
|
||||
*/
|
||||
this.DisableRule = function(rule_id) {
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Creates and sends a new rule to the backend.
|
||||
*/
|
||||
this.CreateNewRule = function() {
|
||||
|
||||
};
|
||||
};
|
||||
@@ -4,8 +4,15 @@ ZombieTabs = function(zombie_tree_list) {
|
||||
this.tree_items = new Array;
|
||||
|
||||
//we store the list of trees in a correct array format for ExtJs
|
||||
for(tree in zombie_tree_list) {
|
||||
this.tree_items.push(zombie_tree_list[tree]);
|
||||
for(tree_name in zombie_tree_list) {
|
||||
var tree = zombie_tree_list[tree_name];
|
||||
|
||||
//set the tree as distributed if it's not the basic tree
|
||||
if(tree_name != "basic") {
|
||||
tree.tree_configuration["distributed"] = true;
|
||||
}
|
||||
|
||||
this.tree_items.push(tree);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -46,9 +46,11 @@ var ZombiesMgr = function(zombies_tree_lists) {
|
||||
for(var i in online_hooked_browsers) {
|
||||
var online_hooked_browser = this.zombieFactory(i, online_hooked_browsers);
|
||||
hooked_browsers_tree.addZombie(online_hooked_browser, true, ((tree_type != 'basic') ? true : false));
|
||||
//TODO: add the rules here
|
||||
}
|
||||
|
||||
//apply the rules to the tree
|
||||
hooked_browsers_tree.applyRules(rules);
|
||||
|
||||
//expand the online hooked browser tree lists
|
||||
if(hooked_browsers_tree.online_hooked_browsers_treenode.childNodes.length > 0) {
|
||||
hooked_browsers_tree.online_hooked_browsers_treenode.expand(true);
|
||||
|
||||
@@ -68,6 +68,10 @@ Ext.extend(zombiesTreeList, Ext.tree.TreePanel, {
|
||||
}
|
||||
|
||||
mainPanel.activate(node.attributes.session);
|
||||
},
|
||||
//update the set of rules when a checkbox is clicked
|
||||
checkchange: function(node, checked) {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@@ -188,7 +192,8 @@ Ext.extend(zombiesTreeList, Ext.tree.TreePanel, {
|
||||
sub_folder_node = new Ext.tree.TreeNode({
|
||||
id: 'sub-folder-'+folder,
|
||||
text: folder,
|
||||
checked: ((checkbox) ? false : null)
|
||||
checked: ((checkbox) ? false : null),
|
||||
type: this.tree_configuration["sub-branch"]
|
||||
});
|
||||
|
||||
mother_node.appendChild(sub_folder_node);
|
||||
@@ -246,5 +251,16 @@ Ext.extend(zombiesTreeList, Ext.tree.TreePanel, {
|
||||
}
|
||||
}, this);
|
||||
}, this);
|
||||
},
|
||||
|
||||
/*
|
||||
* Apply a new set of distributed engine rules to the nodes in the tree
|
||||
* @param: {Literal Objects} the rules set. See the zombie manager.
|
||||
*/
|
||||
applyRules: function(rules) {
|
||||
//we return if the tree is not distributed
|
||||
if(!this.tree_configuration["distributed"]) return;
|
||||
|
||||
//TODO
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user