From d75adc089901125cbe39f88791b1a3595cec53d0 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Tue, 20 Jan 2015 15:36:28 +0000 Subject: [PATCH] Add context menu for empty Hosts grid --- extensions/admin_ui/media/css/base.css | 6 + .../admin_ui/media/images/icons/adapter.png | Bin 0 -> 1458 bytes .../ui/panel/tabs/ZombieTabNetwork.js | 108 +++++++++++++----- 3 files changed, 85 insertions(+), 29 deletions(-) create mode 100644 extensions/admin_ui/media/images/icons/adapter.png diff --git a/extensions/admin_ui/media/css/base.css b/extensions/admin_ui/media/css/base.css index 37422083f..1acb3d86c 100644 --- a/extensions/admin_ui/media/css/base.css +++ b/extensions/admin_ui/media/css/base.css @@ -108,6 +108,12 @@ background-repeat: no-repeat; } +.network-host-ctxMenu-adapter { + background-image: url(../images/icons/adapter.png); + background-size: 16px 16px; + background-repeat: no-repeat; +} + .network-host-ctxMenu-fingerprint { background-image: url(../images/icons/magnifier.png); background-size: 16px 16px; diff --git a/extensions/admin_ui/media/images/icons/adapter.png b/extensions/admin_ui/media/images/icons/adapter.png new file mode 100644 index 0000000000000000000000000000000000000000..f90357942d6f1bb04fd7cbcd48a56c62c3101749 GIT binary patch literal 1458 zcmV;j1x@;iP) zdu-EH6vw~)^|7{FJG-zkQHBE_h$x20BOz+ywszAn*wzkARQzMc#KfR5Fh-0R@ejj5 ziT`L^!plU~jg5_H_cT#M!ov^|L=(bv(D{s zRN~C{XF;J5daDq;Fu7gmipQ1{fRg|=%%wl|B>-@`?e+@%aP9)MS}k-so%k{cr^V#l z7zdl)$KAYWC=^047!=<}mn}s@!%_A?a)9#ka$NlR5{yP8KHR&PV%G(=T8&6VhQ(q+ zU;iL-vNJI-5DR5i)gprXDzWe4qEMM^k&Yt-IYo6F42A%kJSG@1>C*Ou%uO+X@7#{Yct-T#y zuMhX$w+PKmN&(ib!yi|BkeO*lNpT6%($a+Kus?(!&%KKLMZ3{`WgC`0yiW|eaDH>V z?~!F6Bi*Rwz+iNA6s}em1_!;kXF(pCo12vZloG(7*KWYf03{{RXr!12M#DICa5LYvYyyIB2aBhtEF)SynEJqL~ZFRL$2)xLhI~T`~w9aOC3~_889N1>gnoYjt!*)Y>^XB%0~i<>5CFE~V#<7r*i|aR-tu@nXlsoDWMyS3 z1*mhEmad0qa1dsb30A8Ocjo5a62M=*y=ZT5gV*PSB{LH(Eyt7;q8I>EXJllcu+WP9 zh4~@`Tx4QVm?aEcgb*uC9D?rOyV2R%j-jC;;Y~#Vb#-;_va&Mxd_&^+)zs`kClw<8 z%~dfkFAuZblnmI@(<7=MAHhN@MAg+>#cz`-15Hg$*swtXzoP@$68&^eJ?9w22cC2}i`W&R_L@ANlt*vdMqOoQ?fo2w!NK6h1f5YT%&iH78 zhb-GsaXV2}RaJ%rZ$cAk9_buXO_B|1w^YCB+P}XRp1=D`s2xgT&rk82q&-ORD&|EE zr1}~DHeD>+-+KSjp+g7Id+qXKYI~B{b5e|u29V(Yf>b2umF@f7`w!G2(06`HTvL%- z1yJAkB)86@*Hmz9Ls9v9#-{5Fkvt5u0_b+WyK6L=ag@wQBO2srd-3w!4KTiVP4xQ@ z%*UtK?dS{TB268JD(RyI*!j*5erN{A0W9}Fuy`Oj00l58Vd*>>jV}dY*mPC&2M#Vk z`DX@PxFNxylNGu3*IzDW(Z>@9Ak829DiLj8ZQd7BRDB0GWL4y!oT{E@QwRYkZ1-dU z9cemGtZ)J&X*OcVmW7WMpKZUw@eDdVIRvSSb_`fI)((zMm~s;S3&WhbKiS!OH2?qr M07*qoM6N<$g7`?MOaK4? literal 0 HcmV?d00001 diff --git a/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabNetwork.js b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabNetwork.js index b2b8266c7..b727db008 100644 --- a/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabNetwork.js +++ b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabNetwork.js @@ -5,7 +5,7 @@ // /* - * The Network tab panel for the selected zombie. + * The Network tab panel for the selected zombie browser. * Loaded in /ui/panel/index.html */ ZombieTab_Network = function(zombie) { @@ -15,22 +15,23 @@ ZombieTab_Network = function(zombie) { // RESTful API token var token = beefwui.get_rest_token(); - var get_module_id = function(name){ - var id = ""; - $jwterm.ajax({ - type: 'GET', - url: "/api/modules/search/" + name + "?token=" + token, - async: false, - processData: false, - success: function(data){ - id = data.id; - }, - error: function(){ - //update_fail("Error getting module id."); - } - }); + // get module ID from name + var get_module_id = function(name){ + var id = ""; + $jwterm.ajax({ + type: 'GET', + url: "/api/modules/search/" + name + "?token=" + token, + async: false, + processData: false, + success: function(data){ + id = data.id; + }, + error: function(){ + commands_statusbar.update_fail("Error getting module id for '"+mod_name+"'"); + } + }); return id; - } + } /* * The panel that displays all identified network services grouped by host @@ -89,12 +90,61 @@ ZombieTab_Network = function(zombie) { rowclick: function(grid, rowIndex) { var r = grid.getStore().getAt(rowIndex).data; }, - containercontextmenu: function(view, e) { - e.preventDefault(); - }, contextmenu: function(e, element, options) { e.preventDefault(); }, + containercontextmenu: function(view, e) { + e.preventDefault(); + var emptygrid_menu = new Ext.menu.Menu({ + items: [ + { + text: 'Get Internal IP (WebRTC)', + iconCls: 'network-host-ctxMenu-adapter', + handler: function() { + var mod_id = get_module_id("get_internal_ip_webrtc"); + commands_statusbar.update_sending('Identifying zombie network adapters ...'); + $jwterm.ajax({ + contentType: 'application/json', + data: JSON.stringify({}), + dataType: 'json', + type: 'POST', + url: "/api/modules/" + zombie.session + "/" + mod_id + "?token=" + token, + async: false, + processData: false, + success: function(data){ + commands_statusbar.update_sent("Command [id: " + data.command_id + "] sent successfully"); + }, + error: function(){ + commands_statusbar.update_fail('Error sending command'); + } + }); + } + },{ + text: 'Identify LAN Subnets', + iconCls: 'network-host-ctxMenu-network', + handler: function() { + var mod_id = get_module_id("identify_lan_subnets"); + commands_statusbar.update_sending('Identifying zombie LAN subnets ...'); + $jwterm.ajax({ + contentType: 'application/json', + data: JSON.stringify({}), + dataType: 'json', + type: 'POST', + url: "/api/modules/" + zombie.session + "/" + mod_id + "?token=" + token, + async: false, + processData: false, + success: function(data){ + commands_statusbar.update_sent("Command [id: " + data.command_id + "] sent successfully"); + }, + error: function(){ + commands_statusbar.update_fail('Error sending command'); + } + }); + } + }] + }); + emptygrid_menu.showAt(e.getXY()); + }, rowcontextmenu: function(grid, rowIndex, e) { e.preventDefault(); grid.getSelectionModel().selectRow(rowIndex); @@ -126,7 +176,7 @@ ZombieTab_Network = function(zombie) { async: false, processData: false, success: function(data){ - commands_statusbar.update_sent("Command [" + data.command_id + "] sent successfully"); + commands_statusbar.update_sent("Command [id: " + data.command_id + "] sent successfully"); }, error: function(){ commands_statusbar.update_fail('Error sending command'); @@ -148,7 +198,7 @@ ZombieTab_Network = function(zombie) { async: false, processData: false, success: function(data){ - commands_statusbar.update_sent("Command [" + data.command_id + "] sent successfully"); + commands_statusbar.update_sent("Command [id: " + data.command_id + "] sent successfully"); }, error: function(){ commands_statusbar.update_fail('Error sending command'); @@ -177,7 +227,7 @@ ZombieTab_Network = function(zombie) { async: false, processData: false, success: function(data){ - commands_statusbar.update_sent("Command [" + data.command_id + "] sent successfully"); + commands_statusbar.update_sent("Command [id: " + data.command_id + "] sent successfully"); }, error: function(){ commands_statusbar.update_fail('Error sending command'); @@ -199,7 +249,7 @@ ZombieTab_Network = function(zombie) { async: false, processData: false, success: function(data){ - commands_statusbar.update_sent("Command [" + data.command_id + "] sent successfully"); + commands_statusbar.update_sent("Command [id: " + data.command_id + "] sent successfully"); }, error: function(){ commands_statusbar.update_fail('Error sending command'); @@ -228,7 +278,7 @@ ZombieTab_Network = function(zombie) { async: false, processData: false, success: function(data){ - commands_statusbar.update_sent("Command [" + data.command_id + "] sent successfully"); + commands_statusbar.update_sent("Command [id: " + data.command_id + "] sent successfully"); }, error: function(){ commands_statusbar.update_fail('Error sending command'); @@ -250,7 +300,7 @@ ZombieTab_Network = function(zombie) { async: false, processData: false, success: function(data){ - commands_statusbar.update_sent("Command [" + data.command_id + "] sent successfully"); + commands_statusbar.update_sent("Command [id: " + data.command_id + "] sent successfully"); }, error: function(){ commands_statusbar.update_fail('Error sending command'); @@ -375,7 +425,7 @@ ZombieTab_Network = function(zombie) { async: false, processData: false, success: function(data){ - commands_statusbar.update_sent("Command [" + data.command_id + "] sent successfully"); + commands_statusbar.update_sent("Command [id: " + data.command_id + "] sent successfully"); }, error: function(){ commands_statusbar.update_fail('Error sending command'); @@ -397,7 +447,7 @@ ZombieTab_Network = function(zombie) { async: false, processData: false, success: function(data){ - commands_statusbar.update_sent("Command [" + data.command_id + "] sent successfully"); + commands_statusbar.update_sent("Command [id: " + data.command_id + "] sent successfully"); }, error: function(){ commands_statusbar.update_fail('Error sending command'); @@ -422,7 +472,7 @@ ZombieTab_Network = function(zombie) { async: false, processData: false, success: function(data){ - commands_statusbar.update_sent("Command [" + data.command_id + "] sent successfully"); + commands_statusbar.update_sent("Command [id: " + data.command_id + "] sent successfully"); }, error: function(){ commands_statusbar.update_fail('Error sending command'); @@ -447,7 +497,7 @@ ZombieTab_Network = function(zombie) { async: false, processData: false, success: function(data){ - commands_statusbar.update_sent("Command [" + data.command_id + "] sent successfully"); + commands_statusbar.update_sent("Command [id: " + data.command_id + "] sent successfully"); }, error: function(){ commands_statusbar.update_fail('Error sending command');