From 923921b92bce6f29eb321094904bde2fd6726180 Mon Sep 17 00:00:00 2001 From: bcoles Date: Mon, 23 Apr 2012 19:33:19 +0930 Subject: [PATCH] Added skeleton for custom hooks Part of issue #101 --- .../media/javascript/ui/panel/HooksTab.js | 77 +++++++++++++++++++ .../media/javascript/ui/panel/MainPanel.js | 10 ++- test/unit/extensions/tc_hooks.rb | 29 +++++++ test/unit/ts_unit.rb | 4 +- 4 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 extensions/admin_ui/media/javascript/ui/panel/HooksTab.js create mode 100644 test/unit/extensions/tc_hooks.rb diff --git a/extensions/admin_ui/media/javascript/ui/panel/HooksTab.js b/extensions/admin_ui/media/javascript/ui/panel/HooksTab.js new file mode 100644 index 000000000..47dbce237 --- /dev/null +++ b/extensions/admin_ui/media/javascript/ui/panel/HooksTab.js @@ -0,0 +1,77 @@ +// +// Copyright 2012 Wade Alcorn wade@bindshell.net +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +HooksTab = function() { + + /* + * The panel used to configure the hook. + ********************************************/ + var hooks_panel = new Ext.FormPanel({ + title: 'Hooks', + id: 'hooks-panel', + hideLabels : false, + border: false, + padding: '3px 5px 0 5px', + + items:[{ + fieldLabel: 'Text', + xtype: 'textarea', + id: 'inputText', + name: 'inputText', + width: '100%', + height: '40%', + allowBlank: true + },{ + fieldLabel: 'Result', + xtype: 'textarea', + id: 'resultText', + name: 'resultText', + width: '100%', + height: '40%', + allowBlank: true + }], + + buttons: [{ + text: 'Add Hook', + handler: function() { + var form = Ext.getCmp('hooks-panel').getForm(); + var form_values = form.getValues(); + var input_text = form_values['inputText']; + var result=""; + form.setValues({resultText: result}); + } + },{ + text: 'Delete Hook', + handler: function() { + var form = Ext.getCmp('hooks-panel').getForm(); + var form_values = form.getValues(); + var input_text = form_values['inputText']; + var result=""; + form.setValues({resultText: result}); + } + }] + + }); + + HooksTab.superclass.constructor.call(this, { + region: 'center', + items: [hooks_panel], + autoScroll: true, + border: false + }); + +}; + +Ext.extend(HooksTab,Ext.Panel, {}); diff --git a/extensions/admin_ui/media/javascript/ui/panel/MainPanel.js b/extensions/admin_ui/media/javascript/ui/panel/MainPanel.js index 7e46b8a10..c00c3ef5d 100644 --- a/extensions/admin_ui/media/javascript/ui/panel/MainPanel.js +++ b/extensions/admin_ui/media/javascript/ui/panel/MainPanel.js @@ -41,6 +41,7 @@ MainPanel = function(){ this.grid = new DataGrid('/ui/logs/all.json',30); this.grid.border = false; this.welcome_tab = new WelcomeTab; + //this.hooks_tab = new HooksTab; //this.hackvertor_tab = new HackVertorTab; MainPanel.superclass.constructor.call(this, { @@ -71,7 +72,14 @@ MainPanel = function(){ items:[ this.grid /* - ]},{ + ]},{ + id:'hooks-view', + layout:'border', + title:'Hooks', + hideMode:'offsets', + items:[ + //this.hooks_tab + ]},{ id:'hackvertor-view', layout:'border', title:'HackVertor', diff --git a/test/unit/extensions/tc_hooks.rb b/test/unit/extensions/tc_hooks.rb new file mode 100644 index 000000000..019211c25 --- /dev/null +++ b/test/unit/extensions/tc_hooks.rb @@ -0,0 +1,29 @@ +# +# Copyright 2012 Wade Alcorn wade@bindshell.net +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +require 'test/unit' + +class TC_Hooks < Test::Unit::TestCase + + def setup + $:.unshift(File.join(File.expand_path(File.dirname(__FILE__)), '.')) + $root_dir = File.expand_path('../../../../', __FILE__) + end + + def test_hooks + assert(true) + end + +end diff --git a/test/unit/ts_unit.rb b/test/unit/ts_unit.rb index 61f27f9b8..3ddc745b3 100644 --- a/test/unit/ts_unit.rb +++ b/test/unit/ts_unit.rb @@ -32,6 +32,7 @@ require './extensions/tc_xssrays' require './extensions/tc_vnc' require './extensions/tc_ipec_tunnel' require './extensions/tc_hackverter' +require './extensions/tc_hooks' require './extensions/tc_proxy' require './extensions/tc_requester' require './extensions/tc_event_logger' @@ -61,9 +62,10 @@ class TS_BeefTests suite << TC_Proxy.suite suite << TC_Hackverter.suite suite << TC_EventLogger.suite + suite << TC_Hooks.suite return suite end end -Test::Unit::UI::Console::TestRunner.run(TS_BeefTests) \ No newline at end of file +Test::Unit::UI::Console::TestRunner.run(TS_BeefTests)