From 6d85b912e2c5f635a390ba4746a5deebe1b0f2f1 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Mon, 6 Feb 2023 16:34:40 +0100 Subject: [PATCH] 9962-Omnishell in agent view --- pandora_console/images/omnishell.png | Bin 0 -> 606 bytes pandora_console/include/functions_html.php | 21 ++++++++++++++++++ pandora_console/include/functions_ui.php | 18 +++++++++++++++ .../operation/agentes/ver_agente.php | 21 ++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 pandora_console/images/omnishell.png diff --git a/pandora_console/images/omnishell.png b/pandora_console/images/omnishell.png new file mode 100644 index 0000000000000000000000000000000000000000..02c8f0e071e936d8b8fe8d83261e3d25a867b588 GIT binary patch literal 606 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc#=yY%t50_}ki(Mh=?zc(M!jHiZ6P)IEGjV&JEe^ z#q20jYPQ>R<$?vRQ4vcvbw+q9oOct>IU4m@w63XsLBi^#3nDlSIh)LqxYp|UDsYsA zRlcn{H$$@Q@tT_!8>-*WseX26=1ybfPe1>BE3nuz({Z!gx!G?%v`>5DpJF80-`85E zCwsm0`^y&s)~g~*S_Jx-QsO%`1X{MGXf<5>yeE~@Op5m*zsH6EjWhq5*qaY7mpAb{ z=^wDq&+gRMHB67ggm<=7?cLY8a``dOH`z%xa{g(XBgIc=CY|>>bAZ2Yrb}Z&cXq1! zn#LNDPKoZLWotaM&K%-;ZP~Uobcc$XP-p1z!e=5GnZ|?soj0C%zq!e{?UiazhH=Bx`-_bDH@tpRyg2jbm4)3^8tcBu)E|@nuV?he zZB#ZBaqcwgp3GH#az!7k0 zRZ*LF8HeNg2%TlW{?@%X%d=vk^7&@@C(W(K0ShJK`dvF>e>|T2r$NCbtf1ufj{MC6 zdk>%9ypW~hwBTg@m4`BlcgAq`Kizuh(6lv=F5fy=5x7kB!{=C$qVvy+n>6SD`D|0R j;0MdX+; literal 0 HcmV?d00001 diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 31c2e5214a..44a8289b0d 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -84,6 +84,27 @@ function html_debug_print($var, $file='', $oneline=false) } +/** + * Console log. + */ +function jslog($var) +{ + $more_info = ''; + if (is_string($var)) { + $more_info = 'size: '.strlen($var); + } else if (is_bool($var)) { + $more_info = 'val: '.($var ? 'true' : 'false'); + } else if (is_null($var)) { + $more_info = 'is null'; + } else if (is_array($var)) { + $more_info = count($var); + } + + echo ''."\n"; + echo ''; +} + + // Alias for "html_debug_print" function html_debug($var, $file='', $oneline=false) { diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 6a658997f6..ce17086f02 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -7084,3 +7084,21 @@ function ui_get_inventory_module_add_form( } +function ui_print_status_div($status) +{ + switch ((int) $status) { + case 0: + $return = '
 
'; + break; + + case 1: + $return = '
 
'; + break; + + default: + $return = '
 
'; + break; + } + + return $return; +} \ No newline at end of file diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index ece6ec2d6c..b5aa181e8b 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -37,6 +37,7 @@ require_once $config['homedir'].'/include/functions_groups.php'; require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_users.php'; enterprise_include_once('include/functions_metaconsole.php'); +enterprise_include_once('include/functions_omnishell.php'); ui_require_javascript_file('openlayers.pandora'); ui_require_css_file('agent_view'); @@ -1485,6 +1486,17 @@ if ($policyTab == -1) { $policyTab = ''; } + +// Omnishell. +$tasks = count_tasks_agent($id_agente); + +if ($tasks === true) { + $omnishellTab = enterprise_hook('omnishell_tab'); + if ($omnishellTab == -1) { + $omnishellTab = ''; + } +} + // WUX Console. $modules_wux = enterprise_hook('get_wux_modules', [$id_agente]); if ($modules_wux) { @@ -1747,6 +1759,7 @@ $onheader = [ 'ncm_view' => ($ncm_tab ?? null), 'external_tools' => ($external_tools ?? null), 'incident' => ($incidenttab ?? null), + 'omnishell' => ($omnishellTab ?? null), ]; @@ -1871,6 +1884,10 @@ switch ($tab) { $tab_name = 'Policies'; break; + case 'omnishell': + $tab_name = 'Omnishell'; + break; + case 'ux_console_tab': $tab_name = 'UX Console'; break; @@ -2009,6 +2026,10 @@ switch ($tab) { enterprise_include('operation/agentes/policy_view.php'); break; + case 'omnishell': + enterprise_include('operation/agentes/omnishell_view.php'); + break; + case 'ux_console_tab': enterprise_include('operation/agentes/ux_console_view.php'); break;