diff --git a/extras/aditional_rpmspec/xprobe2-0.3.spec b/extras/aditional_rpmspec/xprobe2-0.3.spec deleted file mode 100644 index 7345b8d16e..0000000000 --- a/extras/aditional_rpmspec/xprobe2-0.3.spec +++ /dev/null @@ -1,73 +0,0 @@ -Name: xprobe2 -Version: 0.3 -Release: 2 -Summary: Tool to detect OS remotely by TCP/IP fingerprinting -License: GPLv2 -Group: Network/Security -URL: http://xprobe.sourceforge.net/ -Packager: Sancho Lerena -Source: http://dl.sf.net/xprobe/xprobe2-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version} -Provides: %{name}-%{version} -Requires: libpcap -BuildRequires: gcc-c++ libpcap-devel - -#This is for SUSE build service, to avoid enforce FHS paths -#!BuildIgnore: post-build-checks - -%description -Xprobe is an alternative to some tools which are heavily dependent upon the -usage of the TCP protocol for remote active operating system fingerprinting. - -Xprobe I combines various remote active operating system fingerprinting methods -using the ICMP protocol, which were discovered during the "ICMP Usage in -Scanning" research project, into a simple, fast, efficient and a powerful way -to detect an underlying operating system a targeted host is using. - -Xprobe2 is an active operating system fingerprinting tool with a different -approach to operating system fingerprinting. Xprobe2 rely on fuzzy signature -matching, probabilistic guesses, multiple matches simultaneously, and a -signature database. - -%prep -%setup - -%build -./configure --with-libpcap-libraries=/usr/lib --with-libpcap-includes=/usr/include/pcap --mandir=%{_mandir} --disable-schemas-install -make - -%install -make DESTDIR=$RPM_BUILD_ROOT install - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -ln -s /usr/local/bin/xprobe2 /usr/bin - -%preun - -%postun - -%files - -%defattr(755,root,root) -/usr/local/etc -/usr/local/etc/xprobe2 - -%defattr(644,root,root) -%doc AUTHORS CHANGELOG COPYING CREDITS README TODO docs/* -%doc /usr/share/man/man1/xprobe2.1.gz -/usr/local/etc/xprobe2/xprobe2.conf - -%defattr(755,root,root) -/usr/local/bin/xprobe2 - - -%changelog -* Fri Dec 18 2009 Sancho Lerena 3.2-2 -- A lot of changes to be ready for all RPM plattforms available on build.opensuse.org - -* Tue Dec 08 2009 Sancho Lerena 3.2-1 -- First RPM Spec for SUSE Systems, based on CentOS Spec from Dag Wieers - diff --git a/extras/aditional_sources/xprobe2-0.3.diff.patch.README b/extras/aditional_sources/xprobe2-0.3.diff.patch.README deleted file mode 100644 index 77e404772b..0000000000 --- a/extras/aditional_sources/xprobe2-0.3.diff.patch.README +++ /dev/null @@ -1,62 +0,0 @@ -Get the original xprobe2-0.3 from Sourceforge: - -http://downloads.sourceforge.net/project/xprobe/xprobe2/Xprobe2%200.3/xprobe2-0.3.tar.gz - -Uncompress it under, for example /tmp/xprobe2-0.3 directory - -Copy the diff file at /tmp - -Execute the patch command: - - patch -p1 < ../xprobe2-0.3.diff.patch - -This should look like: - -patching file CHANGELOG -patching file config.status -patching file configure -patching file libs-external/USI++/src/config.h -patching file libs-external/USI++/src/config.log -patching file libs-external/USI++/src/config.status -patching file libs-external/USI++/src/ip.cc -patching file libs-external/USI++/src/Makefile -patching file libs-external/USI++/src/misc.cc -patching file libs-external/USI++/src/usi++/arp.h -patching file libs-external/USI++/src/usi++/config.h -patching file libs-external/USI++/src/usi++/datalink.h -patching file libs-external/USI++/src/usi++/icmp.h -patching file libs-external/USI++/src/usi++/if.h -patching file libs-external/USI++/src/usi++/ip.h -patching file libs-external/USI++/src/usi++/Layer2.h -patching file libs-external/USI++/src/usi++/README -patching file libs-external/USI++/src/usi++/RX.h -patching file libs-external/USI++/src/usi++/tcp.h -patching file libs-external/USI++/src/usi++/TX.h -patching file libs-external/USI++/src/usi++/TX_IP.h -patching file libs-external/USI++/src/usi++/udp.h -patching file libs-external/USI++/src/usi++/usi++ -patching file libs-external/USI++/src/usi++/usi++.h -patching file libs-external/USI++/src/usi++/usi-structs.h -patching file libs-external/USI++/usi++/config.h -patching file libs-external/USI++/usi++/tcp.h -patching file Makefile -patching file src/config.h -patching file src/defines.h -patching file src/Makefile -patching file src/xplib/Makefile -patching file src/xpmodules/alive_probe/Makefile -patching file src/xpmodules/alive_probe/portscanner/Makefile -patching file src/xpmodules/alive_probe/ttl_calc/Makefile -patching file src/xpmodules/Makefile -patching file src/xpmodules/os_probe/icmp_addrmask/Makefile -patching file src/xpmodules/os_probe/icmp_echo_id/Makefile -patching file src/xpmodules/os_probe/icmp_inforeq/Makefile -patching file src/xpmodules/os_probe/icmp_port_unreach/Makefile -patching file src/xpmodules/os_probe/icmp_timestamp/Makefile -patching file src/xpmodules/os_probe/Makefile -patching file src/xpmodules/os_probe/smb/Makefile -patching file src/xpmodules/os_probe/snmp/Makefile -patching file src/xpmodules/os_probe/tcp_handshake/Makefile -patching file src/xpmodules/os_probe/tcp_rst/Makefile - -Your patched code is now ready to be used. diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh index 58e3187806..60b25b3ba2 100644 --- a/extras/deploy-scripts/pandora_deploy_community.sh +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -300,7 +300,6 @@ server_dependencies=" \ bind-utils \ whois \ cpanminus \ - http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \ https://firefly.artica.es/centos7/pandorawmic-1.0.0-1.x86_64.rpm" execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" @@ -328,7 +327,6 @@ execute_cmd "yum install -y $oracle_dependencies || yum reinstall -y $oracle_dep #ipam dependencies ipam_dependencies=" \ - http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ perl(NetAddr::IP) \ perl(Sys::Syslog) \ perl(DBI) \ diff --git a/extras/deploy-scripts/pandora_deploy_community_el8.sh b/extras/deploy-scripts/pandora_deploy_community_el8.sh index 57301f62e0..1dd0598ccd 100644 --- a/extras/deploy-scripts/pandora_deploy_community_el8.sh +++ b/extras/deploy-scripts/pandora_deploy_community_el8.sh @@ -357,7 +357,6 @@ server_dependencies=" \ java \ bind-utils \ whois \ - http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \ https://firefly.artica.es/centos8/pandorawmic-1.0.0-1.x86_64.rpm" execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies" @@ -385,7 +384,6 @@ execute_cmd "dnf install -y $oracle_dependencies" "Installing Oracle Instant cli #ipam dependencies ipam_dependencies=" \ - http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ perl(NetAddr::IP) \ perl(Sys::Syslog) \ perl(DBI) \ diff --git a/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh b/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh index 21b93c54a0..a3f1003c1e 100644 --- a/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh +++ b/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh @@ -253,7 +253,6 @@ server_dependencies=" \ openssh-client \ postfix \ unzip \ - xprobe \ coreutils \ libio-compress-perl \ libmoosex-role-timer-perl \ @@ -358,7 +357,6 @@ source '/root/.profile' &>> "$LOGFILE" #ipam dependencies ipam_dependencies=" \ - xprobe \ libnetaddr-ip-perl \ coreutils \ libdbd-mysql-perl \ diff --git a/extras/docker/centos8/base/Dockerfile b/extras/docker/centos8/base/Dockerfile index 8b14fbb780..4f9a0c994f 100644 --- a/extras/docker/centos8/base/Dockerfile +++ b/extras/docker/centos8/base/Dockerfile @@ -125,7 +125,6 @@ RUN dnf install -y --setopt=tsflags=nodocs \ bind-utils \ whois \ libnsl \ - http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \ https://firefly.artica.es/centos8/pandorawmic-1.0.0-1.x86_64.rpm ; dnf clean all @@ -136,7 +135,7 @@ RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02- # Instant client Oracle RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm # Install IPAM dependencies -RUN dnf install -y http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm "perl(NetAddr::IP)" "perl(Sys::Syslog)" "perl(DBI)" "perl(XML::Simple)" "perl(Geo::IP)" "perl(IO::Socket::INET6)" "perl(XML::Twig)" "perl(DBD::mysql)" --setopt=tsflags=nodocs +RUN dnf install -y "perl(NetAddr::IP)" "perl(Sys::Syslog)" "perl(DBI)" "perl(XML::Simple)" "perl(Geo::IP)" "perl(IO::Socket::INET6)" "perl(XML::Twig)" "perl(DBD::mysql)" --setopt=tsflags=nodocs EXPOSE 80 443 41121 162/udp diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 568cca018f..8ee7007671 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.770-230428 +Version: 7.0NG.770-230505 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 89c3201131..85515afd23 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.770-230428" +pandora_version="7.0NG.770-230505" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 3ab9b79571..e5063c0a48 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1023,7 +1023,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.770'; -use constant AGENT_BUILD => '230428'; +use constant AGENT_BUILD => '230505'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 82f58d7310..d0d1a3ceb9 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.770 -%define release 230428 +%define release 230505 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 459212d4c9..d5592bf185 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.770 -%define release 230428 +%define release 230505 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 29db9c6c8e..da0a942d93 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.770" -PI_BUILD="230428" +PI_BUILD="230505" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index f3bfbf3fd0..69ebce1a7c 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230428} +{230505} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index d5579a39c8..1c0d61d2f9 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.770 Build 230428") +#define PANDORA_VERSION ("7.0NG.770 Build 230505") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index b39ff11fd7..1c1ad65508 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.770(Build 230428))" + VALUE "ProductVersion", "(7.0NG.770(Build 230505))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 52b7d3aa61..1e86b42f21 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.770-230428 +Version: 7.0NG.770-230505 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index a13be52d08..7fb5af4d28 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.770-230428" +pandora_version="7.0NG.770-230505" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/mr/63.sql b/pandora_console/extras/mr/63.sql index 21008dd2bf..9aca7c604c 100644 --- a/pandora_console/extras/mr/63.sql +++ b/pandora_console/extras/mr/63.sql @@ -1,5 +1,8 @@ START TRANSACTION; +ALTER TABLE tpolicy_group_agents CONVERT TO CHARACTER SET UTF8MB4; +ALTER TABLE tevent_sound CONVERT TO CHARACTER SET UTF8MB4; +ALTER TABLE tsesion_filter CONVERT TO CHARACTER SET UTF8MB4; CREATE TABLE IF NOT EXISTS `tsesion_filter` ( `id_filter` INT NOT NULL AUTO_INCREMENT, `id_name` TEXT NULL, @@ -35,4 +38,6 @@ CREATE TABLE IF NOT EXISTS `tsesion_filter_log_viewer` ( PRIMARY KEY (`id_filter`) ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; +ALTER TABLE `talert_template_module_actions` ADD COLUMN `recovered` TINYINT NOT NULL DEFAULT 0; + COMMIT; diff --git a/pandora_console/fonts/FiraCode-Regular.woff b/pandora_console/fonts/FiraCode-Regular.woff new file mode 100644 index 0000000000..edae9aab94 Binary files /dev/null and b/pandora_console/fonts/FiraCode-Regular.woff differ diff --git a/pandora_console/general/maintenance.php b/pandora_console/general/maintenance.php index 265e08b0e6..934c6df7cc 100644 --- a/pandora_console/general/maintenance.php +++ b/pandora_console/general/maintenance.php @@ -38,6 +38,11 @@ ui_require_css_file('maintenance');
'responsive flex margn'] + ); html_print_image( 'images/maintenance.png', false, diff --git a/pandora_console/general/node_deactivated.php b/pandora_console/general/node_deactivated.php index c88f4f599e..c6001abbc4 100644 --- a/pandora_console/general/node_deactivated.php +++ b/pandora_console/general/node_deactivated.php @@ -38,6 +38,11 @@ ui_require_css_file('maintenance');
'responsive flex margn'] + ); html_print_image( 'images/maintenance.png', false, diff --git a/pandora_console/general/reporting_console_node.php b/pandora_console/general/reporting_console_node.php index 61aedcf310..d566f14599 100644 --- a/pandora_console/general/reporting_console_node.php +++ b/pandora_console/general/reporting_console_node.php @@ -50,6 +50,11 @@ $data['check_php_version'] = phpversion();
'responsive flex margn'] + ); html_print_image( 'images/maintenance.png', false, diff --git a/pandora_console/godmode/agentes/agent_deploy.php b/pandora_console/godmode/agentes/agent_deploy.php new file mode 100644 index 0000000000..f0ce5b3cfa --- /dev/null +++ b/pandora_console/godmode/agentes/agent_deploy.php @@ -0,0 +1,71 @@ + '[AgentDeployWizard]'.$e->getMessage() ]); + exit; + } else { + echo '[AgentDeployWizard]'.$e->getMessage(); + } + + // Stop this execution, but continue 'globally'. + return; +} + +// AJAX controller. +if (is_ajax()) { + $method = get_parameter('method'); + + if (method_exists($adw, $method) === true) { + if ($adw->ajaxMethod($method) === true) { + $adw->{$method}(); + } else { + $adw->error('Unavailable method.'); + } + } else { + $adw->error('Method not found. ['.$method.']'); + } + + // Stop any execution. + exit; +} else { + // Run. + $adw->run(); +} diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 5298df0d4a..6d2ec44f25 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -419,6 +419,9 @@ ui_toggle( 'filter-datatable-main box-flat white_table_graph fixed_filter_bar' ); + +require_once 'godmode/agentes/agent_deploy.php'; + // Data table. $selected = true; $selectNameUp = false; @@ -1025,23 +1028,35 @@ if ($agents !== false) { if ((bool) check_acl($config['id_user'], 0, 'AW') === true) { // Create agent button. - echo '
'; + echo '
'; + + $buttons = html_print_button( + __('Create agent'), + 'crt-2', + false, + '', + [ + 'icon' => 'next', + 'onClick' => "document.getElementById('create-agent').submit();", + ], + true + ).html_print_button( + __('Deploy agent'), + 'modal_deploy_agent', + false, + '', + [], + true + ); html_print_action_buttons( - html_print_submit_button( - __('Create agent'), - 'crt-2', - false, - [ 'icon' => 'next' ], - true - ), + $buttons, [ 'type' => 'data_table', 'class' => 'fixed_action_buttons', 'right_content' => $tablePagination, ] ); - echo ''; } ?> diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php index 57569ac956..fe74c172c8 100644 --- a/pandora_console/godmode/servers/servers.build_table.php +++ b/pandora_console/godmode/servers/servers.build_table.php @@ -73,6 +73,8 @@ $table->headstyle[8] = 'text-align:right;width: 120px;'; $table->titleclass = 'tabletitle'; $table->titlestyle = 'text-transform:uppercase;'; +$table->style[6] = 'display: flex;align-items: center;'; + $table->head = []; $table->head[0] = __('Name'); $table->head[1] = __('Status'); @@ -166,8 +168,16 @@ foreach ($servers as $server) { } $data[6] = $server['threads'].' : '.$server['queued_modules']; - if ($server['queued_modules'] > 200) { - $data[6] .= clippy_context_help('server_queued_modules'); + if ($server['queued_modules'] > 500) { + $data[6] .= '  '; } $data[7] = ui_print_timestamp($server['keepalive'], true); @@ -306,3 +316,26 @@ if ($tiny) { } else { html_print_table($table); } + +?> + diff --git a/pandora_console/images/apple-grey@svg.svg b/pandora_console/images/apple-grey@svg.svg new file mode 100644 index 0000000000..ffe0d5fd93 --- /dev/null +++ b/pandora_console/images/apple-grey@svg.svg @@ -0,0 +1,21 @@ + + + + apple-grey@svg + Created with Sketch. + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/images/info-warning.svg b/pandora_console/images/info-warning.svg new file mode 100644 index 0000000000..f707aa9410 --- /dev/null +++ b/pandora_console/images/info-warning.svg @@ -0,0 +1,11 @@ + + + + Dark / 14 / info@svg + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/pandora_console/images/linux-grey@svg.svg b/pandora_console/images/linux-grey@svg.svg new file mode 100644 index 0000000000..800acb957a --- /dev/null +++ b/pandora_console/images/linux-grey@svg.svg @@ -0,0 +1,21 @@ + + + + linux-grey@svg + Created with Sketch. + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/images/windows-grey@svg.svg b/pandora_console/images/windows-grey@svg.svg new file mode 100644 index 0000000000..d133de5954 --- /dev/null +++ b/pandora_console/images/windows-grey@svg.svg @@ -0,0 +1,21 @@ + + + + windows-grey@svg + Created with Sketch. + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/include/class/AgentDeployWizard.class.php b/pandora_console/include/class/AgentDeployWizard.class.php new file mode 100644 index 0000000000..6a2374584d --- /dev/null +++ b/pandora_console/include/class/AgentDeployWizard.class.php @@ -0,0 +1,782 @@ +AJAXMethods); + } + + + /** + * Generates a JSON error. + * + * @param string $msg Error message. + * + * @return void + */ + public function error($msg) + { + echo json_encode( + ['error' => $msg] + ); + } + + + /** + * Minor function to dump json message as ajax response. + * + * @param string $type Type: result || error. + * @param string $msg Message. + * @param boolean $delete Deletion messages. + * + * @return void + */ + private function ajaxMsg($type, $msg, $delete=false) + { + if ($type === 'error') { + $msg_title = ($delete === true) ? 'Failed while removing' : 'Failed while saving'; + } else { + $msg_title = ($delete === true) ? 'Successfully deleted' : 'Successfully saved into keystore'; + } + + echo json_encode( + [ $type => __($msg_title).':
'.$msg ] + ); + + exit; + } + + + /** + * Initializes object and validates user access. + * + * @param string $ajax_controller Path of ajaxController, is the 'page' + * variable sent in ajax calls. + * + * @return object + */ + public function __construct($ajax_controller) + { + global $config; + + // Check access. + check_login(); + + if ((bool) check_acl($config['id_user'], 0, 'AR') === false) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Trying to access agent deploy wizard' + ); + + if (is_ajax()) { + echo json_encode(['error' => 'noaccess']); + } else { + include 'general/noaccess.php'; + } + + exit; + } + + $this->ajaxController = $ajax_controller; + + return $this; + } + + + /** + * Prints inputs for modal "Deploy agents". + * + * @return void + */ + public function loadModal() + { + ob_start(); + echo '
'; + echo $this->getModalContent(); + echo '
'; + echo ob_get_clean(); + } + + + /** + * Run AgentDeployWizard. + * + * @return void + */ + public function run() + { + global $config; + + if (check_acl($config['id_user'], 0, 'AR') === false) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Trying to access agent deploy.' + ); + include 'general/noaccess.php'; + return; + } + + ui_require_css_file('agent_deploy_wizard'); + + // Auxiliar div for agent deploy modal. + echo ''; + + echo $this->loadJS(); + } + + + /** + * Generates content of modal. + * + * @return string Modal content. + */ + public function getModalContent() + { + global $config; + + ob_start(); + + $inputs = []; + + // Container div for stepper. + $stepper_container = html_print_div( + [ + 'id' => 'stepper_container', + 'class' => 'stepper', + ], + true + ); + + html_print_div( + [ + 'id' => 'modal_header', + 'class' => 'margin-bottom-10', + 'content' => $stepper_container, + ] + ); + + // Deploy configuration. + $tableConfiguration = new stdClass(); + $tableConfiguration->class = 'filter-table-adv w100p'; + $tableConfiguration->data = []; + $tableConfiguration->style = []; + $tableConfiguration->cellclass = []; + $tableConfiguration->colspan = []; + $tableConfiguration->rowclass['os'] = 'margin-bottom-5'; + $tableConfiguration->rowstyle['block2'] = 'display: flex; justify-content: space-between;'; + $tableConfiguration->rowspan = []; + + $windows_label_img = html_print_image( + '/images/windows-grey@svg.svg', + true, + ['class' => 'installer-title-icon main_menu_icon'] + ); + + $windows_label = html_print_div( + [ + 'style' => 'display: flex;align-items: center; margin-top: 5px;margin-bottom: 5px;', + 'content' => $windows_label_img.'Windows', + ], + true + ); + + $linux_label_img = html_print_image( + '/images/linux-grey@svg.svg', + true, + ['class' => 'installer-title-icon main_menu_icon'] + ); + + $linux_label = html_print_div( + [ + 'style' => 'display: flex;align-items: center; margin-top: 5px;margin-bottom: 5px;', + 'content' => $linux_label_img.'Unix / Linux', + ], + true + ); + + $mac_label_img = html_print_image( + '/images/apple-grey@svg.svg', + true, + ['class' => 'installer-title-icon main_menu_icon'] + ); + + $mac_label = html_print_div( + [ + 'style' => 'display: flex;align-items: center; margin-top: 5px;margin-bottom: 5px;', + 'content' => $mac_label_img.'Mac OS', + ], + true + ); + + // Operating System switch buttons. + $switchButtons = []; + $switchButtons[] = html_print_radio_button_extended( + 'os', + 0, + $windows_label, + 0, + false, + '', + '', + true + ); + $switchButtons[] = html_print_radio_button_extended( + 'os', + 1, + $linux_label, + 0, + false, + '', + '', + true + ); + $switchButtons[] = html_print_radio_button_extended( + 'os', + 2, + $mac_label, + 0, + false, + '', + '', + true + ); + + $sub_tip = ''.__('Please note that all OS must be 64-bit based architecture').''; + + $tableConfiguration->data['os'][] = html_print_label_input_block( + __('Choose your OS'), + html_print_div( + [ + 'id' => 'os_selector', + 'class' => 'switch_radio_button custom-switch-radio-button', + 'content' => implode('', $switchButtons), + ], + true + ).$sub_tip + ); + + $server_add_help_tip = ui_print_help_tip( + __('Use your %s Data Server IP address here. It must be possible to establish a connection from the agent to port 41121/tcp of this address.', get_product_name()), + true + ); + + $tableConfiguration->data['block2'][0] = html_print_label_input_block( + __('Server address').$server_add_help_tip, + html_print_input_text( + 'server_addr', + $_SERVER['SERVER_ADDR'], + '', + 16, + 100, + true, + false, + true, + '', + 'w260px' + ) + ); + + $tableConfiguration->data['block2'][1] = html_print_label_input_block( + __('Group'), + html_print_select_groups( + false, + 'AR', + false, + 'group', + $group, + '', + '', + 0, + true, + false, + true, + 'w260px', + false, + '', + '', + false, + 'id_grupo', + false, + false, + false, + '260px', + false, + true, + ) + ); + + echo '
'; + echo '
'; + + if ($config['language'] === 'es') { + $instructions_url = 'https://pandorafms.com/manual/es/documentation/02_installation/05_configuration_agents'; + } else { + $instructions_url = 'https://pandorafms.com/manual/en/documentation/02_installation/05_configuration_agents'; + } + + $instructions_link = ''.__('view the following instructions').''; + + $more_info_link = html_print_div( + [ + 'id' => 'config_form_more_info', + 'class' => 'warn-box', + 'content' => __('If you need more information regarding agents').', '.$instructions_link, + ], + true + ); + + $table_config = html_print_div( + [ + 'style' => 'flex: 1;', + 'content' => html_print_table($tableConfiguration, true), + ], + true + ); + + html_print_div( + [ + 'id' => 'config_form', + 'class' => 'white_table_flex agent_details_col modal-content', + 'content' => $table_config.$more_info_link, + ] + ); + + html_print_div( + ['id' => 'footer_separator'] + ); + + html_print_div( + [ + 'id' => 'config_buttonset', + 'class' => 'ui-dialog-buttonset', + 'content' => html_print_submit_button( + __('Generate installer'), + 'generate_installer', + false, + [], + true, + ), + ] + ); + echo '
'; + echo '
'; + + echo '
'; + echo ''; + + html_print_div( + [ + 'id' => 'installer_buttonset', + 'class' => 'flex-row', + 'style' => '', + 'content' => html_print_button( + __('Change configuration'), + 'change_configuration', + false, + '', + ['class' => 'secondary'], + true, + ).html_print_button( + __('Done'), + 'done', + false, + '', + ['style' => 'min-width: 0;'], + true + ), + ] + ); + + echo '
'; + + return ob_get_clean(); + } + + + /** + * Loads JS content. + * + * @return string JS content. + */ + public function loadJS() + { + ob_start(); + + ui_require_javascript_file('stepper', 'include/javascript/', true); + + // Javascript content. + ?> + + __('Main node'), 'type' => 'center_node', 'children' => iterate_group_array($data_groups, $data_agents), - 'color' => '#3F3F3F', + 'color' => ($config['style'] === 'pandora_black') ? '#111' : '#FFF', ]; if (empty($graph_data['children'])) { diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index bc8ffefe8a..b2f5091d4c 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -6932,4 +6932,40 @@ function html_print_go_top() $output .= ''; return $output; -} \ No newline at end of file +} + + +/** + * Render a code picker fragment with default Pandora styles. + * + * @param string $id, + * @param string $content Content. + * @param string $classes Classes for code picker. + * @param boolean $single_line If true, code picker will be displayed as a single line of code. + * @param boolean $return Return output if set to true. + * + * @return string + */ +function html_print_code_picker( + string $id, + string $content='', + string $classes='', + bool $single_line=false, + bool $return=false +) { + $single_line_class = ''; + + if ($single_line === true) { + $single_line_class = 'single-line '; + } + + $output = '
'; + $output .= '
'.$content.'
'; + $output .= '
'; + + if ($return === true) { + return $output; + } else { + echo $output; + } +} diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index a5bdb1218f..4dcf94edf1 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -1770,7 +1770,7 @@ function ui_require_javascript_file($name, $path='include/javascript/', $echo_ta if (is_metaconsole() && (isset($config['requirements_use_base_url']) === false - || $config['requirements_use_base_url'] === false) && $filename !== 'include/javascript/select2.min.js' + || $config['requirements_use_base_url'] === false) ) { $config['js'][$name] = '../../'.$filename; } else { diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js index 09150de658..5c8b59013b 100644 --- a/pandora_console/include/graphs/pandora.d3.js +++ b/pandora_console/include/graphs/pandora.d3.js @@ -825,8 +825,7 @@ function sunburst(recipient, data, width, height, tooltip = true) { if (height === "auto") { height = width; } - // var width = 960, - // height = 700; + var radius = Math.min(width, height) / 2; var x = d3.scale.linear().range([0, 2 * Math.PI]); @@ -857,7 +856,11 @@ function sunburst(recipient, data, width, height, tooltip = true) { return Math.max(0, y(d.y)); }) .outerRadius(function(d) { - return Math.max(0, y(d.y + d.dy)); + if (d.children || d.depth === 4) { + return Math.max(0, y(d.y + d.dy)); + } else { + return Math.max(0, y(d.y + d.dy)) + 20; + } }); var g = svg @@ -879,6 +882,7 @@ function sunburst(recipient, data, width, height, tooltip = true) { : color((d.children ? d : d.parent).name); }) .style("cursor", "pointer") + .style("stroke-width", "0.2") .on("click", click) .on("mouseover", tooltip === "1" ? over_user : "") .on("mouseout", out_user) @@ -888,23 +892,38 @@ function sunburst(recipient, data, width, height, tooltip = true) { if (d.type === "central_service") { return 0; } + var ang = ((x(d.x + d.dx / 2) - Math.PI / 2) / Math.PI) * 180; - return ang > 90 ? 180 + ang : ang; + if (calculate_angle(d) < 20) { + return ang; + } else { + return Math.trunc(ang) == 90 || Math.trunc(ang) == 89 + ? ang - 90 + : 90 + ang; + } } var text = g .append("text") .attr("transform", function(d) { - return ( - "translate(" + - arc.centroid(d) + - ")rotate(" + - computeTextRotation(d) + - ")" - ); + if (typeof d.show_name != "undefined" && d.show_name) { + return ( + "translate(" + + arc.centroid(d) + + ")rotate(" + + computeTextRotation(d) + + ")" + ); + } }) .attr("x", function(d) { - return computeTextRotation(d) > 180 ? -40 : -30; + if (typeof d.show_name != "undefined" && d.show_name) { + if (calculate_angle(d) < 20) { + return (d.name.length + 15) * -1; + } else { + return (d.name.length + 25) * -1; + } + } }) .attr("dx", "6") // margin .attr("dy", function(d) { @@ -914,17 +933,30 @@ function sunburst(recipient, data, width, height, tooltip = true) { return ".35em"; }) // vertical-align .attr("opacity", function(d) { - if ( - (typeof d.show_name != "undefined" && d.show_name) || - d.type === "central_service" - ) + if (typeof d.show_name != "undefined" && d.show_name) { return 1; - else return 0; + } else { + return 0; + } }) .text(function(d) { + if (d.name.length > 20) { + var resta = d.name.length - 12; + var string = d.name.slice( + d.name.length / 2 - resta / 2, + d.name.length / 2 + resta / 2 + ); + var split = d.name.split(`${string}`); + return `${split[0]}...${split[1]}`; + } return d.name; }) - .style("font-size", "10px") + .style("font-size", "11px") + .style("fill", function(d) { + if (d.color !== "#82b92e") { + return "white"; + } + }) // Makes svg elements invisible to events .style("pointer-events", "none"); @@ -972,7 +1004,11 @@ function sunburst(recipient, data, width, height, tooltip = true) { ); }) .attr("x", function(d) { - return computeTextRotation(d) > 180 ? -40 : -30; + if (calculate_angle(d) < 20) { + return (d.name.length + 15) * -1; + } else { + return (d.name.length + 25) * -1; + } }) .transition() .duration(250) @@ -1074,6 +1110,15 @@ function sunburst(recipient, data, width, height, tooltip = true) { function hide_tooltip() { $("#tooltip").hide(); } + + function calculate_angle(d) { + var start_angle = Math.max(0, Math.min(2 * Math.PI, x(d.x))); + start_angle = (start_angle * 180) / Math.PI; + var end_angle = Math.max(0, Math.min(2 * Math.PI, x(d.x + d.dx))); + end_angle = (end_angle * 180) / Math.PI; + + return end_angle - start_angle; + } } function createGauge( diff --git a/pandora_console/include/javascript/stepper.js b/pandora_console/include/javascript/stepper.js new file mode 100644 index 0000000000..c12834e17f --- /dev/null +++ b/pandora_console/include/javascript/stepper.js @@ -0,0 +1,69 @@ +function Stepper(container, steps) { + if (container instanceof jQuery) { + this.container = container[0]; + } else { + this.container = container; + } + + this.steps = []; + + for (var i = 1; i <= steps.length; i++) { + var stepContainer = document.createElement("div"); + stepContainer.className = "step-container"; + var step = document.createElement("span"); + step.className = "step"; + step.textContent = i; + var text = document.createElement("div"); + text.className = "step-text"; + text.textContent = steps[i - 1]; + stepContainer.appendChild(step); + stepContainer.appendChild(text); + this.steps.push(stepContainer); + } +} + +Stepper.prototype.render = function() { + var separator = document.createElement("div"); + separator.className = "step-separator"; + var stepsContainer = document.createElement("div"); + stepsContainer.className = "steps"; + + for (var i = 0; i < this.steps.length; i++) { + if (i > 0) { + stepsContainer.appendChild(separator.cloneNode()); + } + stepsContainer.appendChild(this.steps[i]); + } + + this.container.innerHTML = ""; + this.container.appendChild(stepsContainer); +}; + +Stepper.prototype.selectStep = function(step) { + for (var i = 0; i < this.steps.length; i++) { + if (i < step - 1) { + this.steps[i].querySelector(".step").classList.add("visited"); + this.steps[i].querySelector(".step-text").classList.remove("active"); + var separators = this.container.querySelectorAll(".step-separator"); + if (separators[i]) { + separators[i].classList.add("visited"); + } + } else if (i === step - 1) { + this.steps[i].querySelector(".step").classList.add("active"); + this.steps[i].querySelector(".step-text").classList.add("active"); + this.steps[i].querySelector(".step").classList.remove("visited"); + } else { + this.steps[i] + .querySelector(".step") + .classList.remove("visited", "active"); + + this.steps[i].querySelector(".step-text").classList.remove("active"); + + var separators = this.container.querySelectorAll(".step-separator"); + + if (separators[i - 1]) { + separators[i - 1].classList.remove("visited"); + } + } + } +}; diff --git a/pandora_console/include/styles/agent_deploy_wizard.css b/pandora_console/include/styles/agent_deploy_wizard.css new file mode 100644 index 0000000000..906b20500c --- /dev/null +++ b/pandora_console/include/styles/agent_deploy_wizard.css @@ -0,0 +1,97 @@ +#agent_deploy_modal { + margin-bottom: 5px; +} + +#footer_separator { + position: absolute; + bottom: 57px; + border-top: 1px solid #c1ccdc; + width: 100%; + left: 0px; +} + +#stepper_container { + display: flex; + justify-content: center; + align-items: center; +} + +#modal_header { + background-color: #f6f7fb; + border-radius: 10px; + width: 100%; + height: 76px; + /* padding: 10px; */ + display: flex; + justify-content: center; + align-items: center; +} + +#config_form_more_info { + margin-bottom: 5px !important; +} + +#stepper_container { + width: 35%; +} + +#table1-os-0 { + width: 100%; +} + +#os_selector { + width: 100%; + height: 50px; + color: #333; +} + +#os_selector > label { + width: 100%; + height: 30px; +} + +.modal-content { + display: flex; + margin-bottom: 20px; + min-height: 400px; + flex-direction: column; + padding-left: 5px; + padding-right: 5px; +} + +.installer-code-fragment { + margin-bottom: 15px; + margin-top: 5px; +} + +.installer-title { + display: flex; + align-items: center; + margin-bottom: 10px; + margin-top: 10px; +} + +.installer-title-icon { + margin-right: 9px; +} + +.green-link { + color: #1d7873 !important; + text-decoration: none !important; +} + +.green-link:hover { + color: #0d312f !important; +} + +.custom-switch-radio-button > label { + color: #444 !important; +} + +.custom-switch-radio-button input:checked + label img { + filter: brightness(100); +} + +.svg-brightness-0 { + filter: brightness(0); +} diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 2bff29229b..d6fec23c27 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -151,6 +151,14 @@ src: local("Nunito-Regular"), url(../../fonts/nunito.woff) format("woff"); } +@font-face { + font-family: "firacode-regular"; + src: url("../fonts/FiraCode-Regular.woff") format("woff"); + src: local("FiraCode-Regular"), + url(../../fonts/FiraCode-Regular.woff) format("woff"); + font-weight: normal; +} + * { font-size: 9pt; line-height: 16pt; @@ -479,6 +487,11 @@ select:-internal-list-box { max-width: 250px; } +.w260px { + width: 260px; + max-width: 260px; +} + .w280px { width: 280px; max-width: 280px; @@ -1212,6 +1225,14 @@ p.center { margin: 0 auto; } +.margin-top-5 { + margin-top: 5px; +} + +.margin-bottom-5 { + margin-bottom: 5px; +} + .margin-top-10 { margin-top: 10px; } @@ -11528,6 +11549,11 @@ p.trademark-copyright { color: #8a96a6; } +.input_sub_placeholder_normal { + font-size: 13px; + color: #8a96a6; +} + .input_sub_placeholder_warning { color: #ffb900; font-style: italic; @@ -11956,6 +11982,214 @@ div.parent_graph > p.legend_background > table > tbody > tr { word-wrap: break-word; } +.warn-box { + background: #fffbdf; + color: #454545; + font-size: 15px; + border-radius: 5px; + padding: 15px; + padding-left: 30px; + position: relative; + margin: 25px 0px; +} +.warn-box::before { + content: "|"; + color: #dd9900; + position: absolute; + left: 4px; + top: 50%; + transform: translateY(-50%); + height: 77%; + background: #dd9900; + border-radius: 12px; + width: 4px; +} +.err-box { + background: #fbdada; + color: #454545; + font-size: 15px; + border-radius: 5px; + padding: 15px; + padding-left: 30px; + position: relative; + margin: 25px 0px; +} +.err-box::before { + content: "|"; + color: red; + position: absolute; + left: 4px; + top: 50%; + transform: translateY(-50%); + height: 77%; + background: red; + border-radius: 12px; + width: 4px; +} + +.signature { + color: #8a96a6; + font-size: 13px; + font-weight: 300; + margin-right: auto; + margin-left: 10px; +} +.link { + color: #82b92e; + text-decoration: none; +} +.signature a { + color: #82b92e; + text-decoration: none; +} + +.steps { + display: flex; + align-items: center; + width: 100%; +} + +.step { + font-size: 15px; + border: 2px solid #c0ccdc; + color: #999; + border-radius: 30px; + width: 30px; + height: 30px; + text-align: center; + display: flex; + align-items: center; + justify-content: center; + position: relative; + z-index: 1; +} + +.step.active { + background-color: #0d312f !important; + color: #ffffff !important; + border-color: #0d312f !important; +} + +.step.visited { + background-color: #1d7873 !important; + color: #ffffff !important; + border-color: #1d7873 !important; +} + +.steps { + display: flex; + justify-content: space-between; + align-items: center; +} + +.step-separator { + flex: 1; + height: calc(50% - 12px); + border: none; + border-top: 2px solid transparent; + border-image: repeating-linear-gradient( + to right, + #c0ccdc 0, + #c0ccdc 4px, + transparent 4px, + transparent 8px + ) + 1 0; + position: relative; + transform: translateY(-14px); +} + +.step-separator.visited { + border-top: 2px solid #1d7873 !important; + border-image: none; +} + +.step-separator:last-child { + display: none; +} + +.step-container { + display: flex; + flex-direction: column; + align-items: center; + width: 30px; +} + +.step-text { + font-size: 12px; + color: #333; + text-align: center; + margin-top: 5px; +} + +.step-text.active { + font-weight: bold; +} + +.code-fragment { + background-color: #1f2435; + color: #eaeaea; + overflow-y: scroll; + height: 100px; + padding: 10px; + font-family: "firacode-regular"; + font-size: 14px; + padding-left: 25px; + padding-right: 25px; + border-radius: 6px; +} + +.code-fragment.single-line { + height: 20px !important; + overflow-y: hidden !important; +} + +.code-font { + font-family: "firacode-regular" !important; +} + +/* Webkit-based browsers */ +.code-fragment::-webkit-scrollbar { + width: 6px; + height: 6px; +} + +.code-fragment::-webkit-scrollbar-track { + background-color: transparent; +} + +.code-fragment::-webkit-scrollbar-thumb { + background-color: rgba(255, 255, 255, 0.25); + border-radius: 4px; + width: 6px; + height: 50px; +} + +.code-fragment::-webkit-scrollbar-thumb:hover { + background-color: rgba(255, 255, 255, 0.25); +} + +/* Firefox */ +.code-fragment::-moz-scrollbar { + width: 6px; + height: 6px; +} + +.code-fragment::-moz-scrollbar-track { + background-color: transparent; +} + +.code-fragment::-moz-scrollbar-thumb { + background-color: rgba(255, 255, 255, 0.25); + border-radius: 4px; + width: 6px; + height: 50px; +} + +.code-fragment::-moz-scrollbar-thumb:hover { + background-color: rgba(255, 255, 255, 0.25); +} + .legend-font-small { font-size: 7px !important; } diff --git a/pandora_console/install.php b/pandora_console/install.php index 68c0f0f212..bd876719f6 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@
'; echo ''; - -echo ''.__('Accoustic console').''; -ui_require_css_file('wizard'); -ui_require_css_file('discovery'); ?> + +<?php echo __('Accoustic console'); ?>) + + + + + + + + + + + + +