Merge branch 'develop' into 'ent-10906-Carga-de-datos-de-demo'
# Conflicts: # pandora_console/extras/mr/67.sql # pandora_console/pandoradb.sql
@ -520,18 +520,18 @@ execute_cmd "systemctl restart mysql" "Configuring and restarting database engin
|
||||
|
||||
#Define packages
|
||||
if [ "$PANDORA_LTS" -eq '1' ] ; then
|
||||
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/Tarball/LTS/pandorafms_server-7.0NG.tar.gz"
|
||||
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/Tarball/LTS/pandorafms_console-7.0NG.tar.gz"
|
||||
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/LTS/pandorafms_server-7.0NG.tar.gz"
|
||||
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/LTS/pandorafms_console-7.0NG.tar.gz"
|
||||
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.x86_64.tar.gz"
|
||||
elif [ "$PANDORA_LTS" -ne '1' ] ; then
|
||||
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_server-7.0NG.tar.gz"
|
||||
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_console-7.0NG.tar.gz"
|
||||
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_server-7.0NG.tar.gz"
|
||||
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_console-7.0NG.tar.gz"
|
||||
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE=" https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.x86_64.tar.gz"
|
||||
fi
|
||||
|
||||
if [ "$PANDORA_BETA" -eq '1' ] ; then
|
||||
PANDORA_SERVER_PACKAGE="http://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest.tar.gz"
|
||||
PANDORA_CONSOLE_PACKAGE="http://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_console-latest.tar.gz"
|
||||
PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest.tar.gz"
|
||||
PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_console-latest.tar.gz"
|
||||
PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.x86_64.tar.gz"
|
||||
fi
|
||||
|
||||
@ -837,7 +837,7 @@ echo "@hourly root bash -c /etc/cron.hourly/pandora_db" >> /etc/cront
|
||||
|
||||
## Enabling agent adn configuring Agente
|
||||
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF &>> "$LOGFILE"
|
||||
execute_cmd "/etc/init.d/pandora_agent_daemon start" "Starting PandoraFSM Agent"
|
||||
execute_cmd "/etc/init.d/pandora_agent_daemon restart" "Starting PandoraFSM Agent"
|
||||
systemctl enable pandora_agent_daemon &>> "$LOGFILE"
|
||||
|
||||
#fix path phantomjs
|
||||
|
@ -234,6 +234,21 @@ module_description Number of cron task files
|
||||
module_unit files
|
||||
module_end
|
||||
|
||||
# This module /var/log/syslog file, under the module name "syslog"
|
||||
# And search for "ssh" string into it, sending only that information.
|
||||
module_begin
|
||||
module_name Syslog
|
||||
module_description Search for ssh string into /var/log/syslog file
|
||||
module_type log
|
||||
module_regexp /var/log/syslog
|
||||
module_pattern ssh
|
||||
module_end
|
||||
|
||||
#Hardening plugin for security compliance analysis. Enable to use it.
|
||||
#module_begin
|
||||
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
|
||||
#module_absoluteinterval 7d
|
||||
#module_end
|
||||
|
||||
# Plugin example
|
||||
|
||||
@ -241,11 +256,6 @@ module_end
|
||||
|
||||
module_plugin pandora_df
|
||||
|
||||
# This parses /var/log/syslog file, under the module name "syslog"
|
||||
# And search for "ssh" string into it, sending only that information.
|
||||
|
||||
module_plugin grep_log /var/log/syslog Syslog ssh
|
||||
|
||||
# Get disk space free in MB
|
||||
#module_begin
|
||||
#module_name disk_root_free
|
||||
@ -270,7 +280,6 @@ module_plugin grep_log /var/log/syslog Syslog ssh
|
||||
#module_end
|
||||
|
||||
# Plugin for inventory on the agent.
|
||||
|
||||
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users process ip route
|
||||
|
||||
# Example of preconditions
|
||||
@ -303,4 +312,13 @@ module_plugin grep_log /var/log/syslog Syslog ssh
|
||||
|
||||
# This plugin runs several security checks in a Linux system
|
||||
|
||||
#module_plugin pandora_security_check
|
||||
#module_plugin pandora_security_check
|
||||
|
||||
# Extraction module example
|
||||
#module_begin
|
||||
#module_name Collector
|
||||
#module_description Logs extraction module
|
||||
#module_type log
|
||||
#module_regexp /var/log/logfile.log
|
||||
#module_pattern .*
|
||||
#module_end
|
@ -147,22 +147,23 @@ module_max_critical 20
|
||||
module_end
|
||||
|
||||
# Log events
|
||||
|
||||
# Get logs from System source.
|
||||
module_begin
|
||||
module_name System Events (TermService)
|
||||
module_type async_string
|
||||
module_logevent
|
||||
module_description Log Events coming from Terminal Service
|
||||
module_type log
|
||||
module_logevent
|
||||
module_source System
|
||||
module_application TermService
|
||||
module_end
|
||||
|
||||
# Get logs from Security source.
|
||||
module_begin
|
||||
module_name Security Events (Invalid Login)
|
||||
module_type async_string
|
||||
module_description Security log events for invalid login attempt
|
||||
module_name Security Events
|
||||
module_description Security log events
|
||||
module_type log
|
||||
module_logevent
|
||||
module_source Security
|
||||
module_eventcode 529
|
||||
module_end
|
||||
|
||||
# Check if Dhcp service is enabled
|
||||
@ -219,6 +220,12 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs"
|
||||
# module_description Free space on drive D: (%)
|
||||
# module_end
|
||||
|
||||
# Hardening plugin for security compliance analysis.
|
||||
# module_begin
|
||||
# module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_hardening.exe -t 150"
|
||||
# module_absoluteinterval 7d
|
||||
# module_end
|
||||
|
||||
# Sample of Windows inventory module (ONLY ENTERPRISE)!
|
||||
#module_begin
|
||||
#module_name Inventory
|
||||
@ -344,4 +351,13 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs"
|
||||
#module_condition (3,8) cmd.exe /c echo range >> c:\log.txt
|
||||
#module_exec echo 5
|
||||
#module_description Postcondition test module
|
||||
#module_end
|
||||
|
||||
# Example of collector module
|
||||
#module_begin
|
||||
#module_name Collector
|
||||
#module_description Logs extraction module
|
||||
#module_type log
|
||||
#module_regexp /var/log/logfile.log
|
||||
#module_pattern .*
|
||||
#module_end
|
@ -2179,16 +2179,7 @@ sub configure ($) {
|
||||
|
||||
#Launch tentacle server in proxy mode if configured
|
||||
if ($Conf{'proxy_mode'}) {
|
||||
|
||||
#Check if user is root
|
||||
if ($> != 0) {
|
||||
if (launch_tentacle_proxy() != 0) {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
error ('Proxy mode can not be launched as root');
|
||||
return 1;
|
||||
}
|
||||
return 1 if (launch_tentacle_proxy() != 0);
|
||||
}
|
||||
|
||||
# Add the plugins directory to the PATH
|
||||
|
1
pandora_agents/plugins/windows/pandora_security_win/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
dist
|
10
pandora_agents/plugins/windows/pandora_security_win/Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
# Makefile for winexe.py.
|
||||
.PHONY: all build_image pandora_security_win.py
|
||||
|
||||
all: build_image pandora_security_win.py
|
||||
|
||||
build_image:
|
||||
docker build -t pandora_security_win docker/
|
||||
|
||||
pandora_security_win.py:
|
||||
docker run --rm -t -v`pwd`:/pybuild pandora_security_win
|
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Build the winexe binary.
|
||||
wine pip install -r src/requirements.txt
|
||||
wine pyinstaller --onefile src/pandora_security_win.py
|
||||
rm -rf build/ __pycache__/ pandora_security_win.spec
|
@ -0,0 +1,34 @@
|
||||
FROM i386/debian
|
||||
|
||||
# Update the package list.
|
||||
RUN apt-get update
|
||||
|
||||
# Install needed packages.
|
||||
RUN apt-get install --yes \
|
||||
gnupg2 \
|
||||
unzip \
|
||||
software-properties-common \
|
||||
wget \
|
||||
xvfb
|
||||
|
||||
# Install WineHQ.
|
||||
RUN wget -q https://dl.winehq.org/wine-builds/winehq.key -O- | apt-key add -
|
||||
RUN apt-add-repository https://dl.winehq.org/wine-builds/debian/; apt-get update
|
||||
RUN apt-get install --yes --install-recommends wine
|
||||
|
||||
# Use Windows 10.
|
||||
COPY winetricks /tmp/winetricks
|
||||
RUN /bin/bash /tmp/winetricks win10; rm -f /tmp/winetricks
|
||||
|
||||
# Install Python.
|
||||
RUN wget https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe
|
||||
RUN xvfb-run wine python-3.8.10.exe /quiet Include_doc=0 Include_dev=0 Include_test=0 InstallAllUsers=1 PrependPath=1 TargetDir=c:\python; echo
|
||||
ENV WINEPATH="c:\\python;c:\\python\Scripts"
|
||||
|
||||
# Install Python modules..
|
||||
RUN wine pip.exe install wheel
|
||||
RUN wine pip.exe install pyinstaller
|
||||
|
||||
VOLUME ["/pybuild"]
|
||||
WORKDIR "/pybuild"
|
||||
ENTRYPOINT ["/bin/bash", "/pybuild/build.sh"]
|
23525
pandora_agents/plugins/windows/pandora_security_win/docker/winetricks
Normal file
@ -0,0 +1,406 @@
|
||||
import wmi, sys, winreg, os, subprocess, json, re
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
|
||||
## Define modules
|
||||
modules=[]
|
||||
|
||||
def print_module(module, print_flag=None):
|
||||
"""Returns module in XML format. Accepts only {dict}.\n
|
||||
- Only works with one module at a time: otherwise iteration is needed.
|
||||
- Module "value" field accepts str type or [list] for datalists.
|
||||
- Use print_flag to show modules' XML in STDOUT.
|
||||
"""
|
||||
data = dict(module)
|
||||
module_xml = ("<module>\n"
|
||||
"\t<name><![CDATA[" + str(data["name"]) + "]]></name>\n"
|
||||
"\t<type>" + str(data["type"]) + "</type>\n"
|
||||
)
|
||||
|
||||
if type(data["type"]) is not str and "string" not in data["type"]: #### Strip spaces if module not generic_data_string
|
||||
data["value"] = data["value"].strip()
|
||||
if isinstance(data["value"], list): # Checks if value is a list
|
||||
module_xml += "\t<datalist>\n"
|
||||
for value in data["value"]:
|
||||
if type(value) is dict and "value" in value:
|
||||
module_xml += "\t<data>\n"
|
||||
module_xml += "\t\t<value><![CDATA[" + str(value["value"]) + "]]></value>\n"
|
||||
if "timestamp" in value:
|
||||
module_xml += "\t\t<timestamp><![CDATA[" + str(value["timestamp"]) + "]]></timestamp>\n"
|
||||
module_xml += "\t</data>\n"
|
||||
module_xml += "\t</datalist>\n"
|
||||
else:
|
||||
module_xml += "\t<data><![CDATA[" + str(data["value"]) + "]]></data>\n"
|
||||
if "desc" in data:
|
||||
module_xml += "\t<description><![CDATA[" + str(data["desc"]) + "]]></description>\n"
|
||||
if "unit" in data:
|
||||
module_xml += "\t<unit><![CDATA[" + str(data["unit"]) + "]]></unit>\n"
|
||||
if "interval" in data:
|
||||
module_xml += "\t<module_interval><![CDATA[" + str(data["interval"]) + "]]></module_interval>\n"
|
||||
if "tags" in data:
|
||||
module_xml += "\t<tags>" + str(data["tags"]) + "</tags>\n"
|
||||
if "module_group" in data:
|
||||
module_xml += "\t<module_group>" + str(data["module_group"]) + "</module_group>\n"
|
||||
if "module_parent" in data:
|
||||
module_xml += "\t<module_parent>" + str(data["module_parent"]) + "</module_parent>\n"
|
||||
if "min_warning" in data:
|
||||
module_xml += "\t<min_warning><![CDATA[" + str(data["min_warning"]) + "]]></min_warning>\n"
|
||||
if "min_warning_forced" in data:
|
||||
module_xml += "\t<min_warning_forced><![CDATA[" + str(data["min_warning_forced"]) + "]]></min_warning_forced>\n"
|
||||
if "max_warning" in data:
|
||||
module_xml += "\t<max_warning><![CDATA[" + str(data["max_warning"]) + "]]></max_warning>\n"
|
||||
if "max_warning_forced" in data:
|
||||
module_xml += "\t<max_warning_forced><![CDATA[" + str(data["max_warning_forced"]) + "]]></max_warning_forced>\n"
|
||||
if "min_critical" in data:
|
||||
module_xml += "\t<min_critical><![CDATA[" + str(data["min_critical"]) + "]]></min_critical>\n"
|
||||
if "min_critical_forced" in data:
|
||||
module_xml += "\t<min_critical_forced><![CDATA[" + str(data["min_critical_forced"]) + "]]></min_critical_forced>\n"
|
||||
if "max_critical" in data:
|
||||
module_xml += "\t<max_critical><![CDATA[" + str(data["max_critical"]) + "]]></max_critical>\n"
|
||||
if "max_critical_forced" in data:
|
||||
module_xml += "\t<max_critical_forced><![CDATA[" + str(data["max_critical_forced"]) + "]]></max_critical_forced>\n"
|
||||
if "str_warning" in data:
|
||||
module_xml += "\t<str_warning><![CDATA[" + str(data["str_warning"]) + "]]></str_warning>\n"
|
||||
if "str_warning_forced" in data:
|
||||
module_xml += "\t<str_warning_forced><![CDATA[" + str(data["str_warning_forced"]) + "]]></str_warning_forced>\n"
|
||||
if "str_critical" in data:
|
||||
module_xml += "\t<str_critical><![CDATA[" + str(data["str_critical"]) + "]]></str_critical>\n"
|
||||
if "str_critical_forced" in data:
|
||||
module_xml += "\t<str_critical_forced><![CDATA[" + str(data["str_critical_forced"]) + "]]></str_critical_forced>\n"
|
||||
if "critical_inverse" in data:
|
||||
module_xml += "\t<critical_inverse><![CDATA[" + str(data["critical_inverse"]) + "]]></critical_inverse>\n"
|
||||
if "warning_inverse" in data:
|
||||
module_xml += "\t<warning_inverse><![CDATA[" + str(data["warning_inverse"]) + "]]></warning_inverse>\n"
|
||||
if "max" in data:
|
||||
module_xml += "\t<max><![CDATA[" + str(data["max"]) + "]]></max>\n"
|
||||
if "min" in data:
|
||||
module_xml += "\t<min><![CDATA[" + str(data["min"]) + "]]></min>\n"
|
||||
if "post_process" in data:
|
||||
module_xml += "\t<post_process><![CDATA[" + str(data["post_process"]) + "]]></post_process>\n"
|
||||
if "disabled" in data:
|
||||
module_xml += "\t<disabled><![CDATA[" + str(data["disabled"]) + "]]></disabled>\n"
|
||||
if "min_ff_event" in data:
|
||||
module_xml += "\t<min_ff_event><![CDATA[" + str(data["min_ff_event"]) + "]]></min_ff_event>\n"
|
||||
if "status" in data:
|
||||
module_xml += "\t<status><![CDATA[" + str(data["status"]) + "]]></status>\n"
|
||||
if "timestamp" in data:
|
||||
module_xml += "\t<timestamp><![CDATA[" + str(data["timestamp"]) + "]]></timestamp>\n"
|
||||
if "custom_id" in data:
|
||||
module_xml += "\t<custom_id><![CDATA[" + str(data["custom_id"]) + "]]></custom_id>\n"
|
||||
if "critical_instructions" in data:
|
||||
module_xml += "\t<critical_instructions><![CDATA[" + str(data["critical_instructions"]) + "]]></critical_instructions>\n"
|
||||
if "warning_instructions" in data:
|
||||
module_xml += "\t<warning_instructions><![CDATA[" + str(data["warning_instructions"]) + "]]></warning_instructions>\n"
|
||||
if "unknown_instructions" in data:
|
||||
module_xml += "\t<unknown_instructions><![CDATA[" + str(data["unknown_instructions"]) + "]]></unknown_instructions>\n"
|
||||
if "quiet" in data:
|
||||
module_xml += "\t<quiet><![CDATA[" + str(data["quiet"]) + "]]></quiet>\n"
|
||||
if "module_ff_interval" in data:
|
||||
module_xml += "\t<module_ff_interval><![CDATA[" + str(data["module_ff_interval"]) + "]]></module_ff_interval>\n"
|
||||
if "crontab" in data:
|
||||
module_xml += "\t<crontab><![CDATA[" + str(data["crontab"]) + "]]></crontab>\n"
|
||||
if "min_ff_event_normal" in data:
|
||||
module_xml += "\t<min_ff_event_normal><![CDATA[" + str(data["min_ff_event_normal"]) + "]]></min_ff_event_normal>\n"
|
||||
if "min_ff_event_warning" in data:
|
||||
module_xml += "\t<min_ff_event_warning><![CDATA[" + str(data["min_ff_event_warning"]) + "]]></min_ff_event_warning>\n"
|
||||
if "min_ff_event_critical" in data:
|
||||
module_xml += "\t<min_ff_event_critical><![CDATA[" + str(data["min_ff_event_critical"]) + "]]></min_ff_event_critical>\n"
|
||||
if "ff_type" in data:
|
||||
module_xml += "\t<ff_type><![CDATA[" + str(data["ff_type"]) + "]]></ff_type>\n"
|
||||
if "ff_timeout" in data:
|
||||
module_xml += "\t<ff_timeout><![CDATA[" + str(data["ff_timeout"]) + "]]></ff_timeout>\n"
|
||||
if "each_ff" in data:
|
||||
module_xml += "\t<each_ff><![CDATA[" + str(data["each_ff"]) + "]]></each_ff>\n"
|
||||
if "module_parent_unlink" in data:
|
||||
module_xml += "\t<module_parent_unlink><![CDATA[" + str(data["parent_unlink"]) + "]]></module_parent_unlink>\n"
|
||||
if "global_alerts" in data:
|
||||
for alert in data["alert"]:
|
||||
module_xml += "\t<alert_template><![CDATA[" + alert + "]]></alert_template>\n"
|
||||
module_xml += "</module>\n"
|
||||
|
||||
if print_flag:
|
||||
print (module_xml)
|
||||
|
||||
return (module_xml)
|
||||
|
||||
def check_antivirus_status():
|
||||
try:
|
||||
wmi_obj = wmi.WMI(namespace="root/SecurityCenter2")
|
||||
antivirus_products = wmi_obj.query("SELECT * FROM AntivirusProduct")
|
||||
|
||||
for product in antivirus_products:
|
||||
display_name = product.displayName
|
||||
product_state = product.productState
|
||||
product_state_hex = hex(product_state)
|
||||
last_update = product.timestamp
|
||||
atv_status = int(product_state_hex[3:5])
|
||||
atv_uptodate = int(product_state_hex[5:7])
|
||||
atv_status = 1 if atv_status in [10, 11] else 0
|
||||
atv_uptodate = 1 if atv_uptodate in [00,] else 0
|
||||
|
||||
#print(f"{display_name}, product_state: {product_state}, product_state_hex: {product_state_hex}, last_update: {last_update}, status: {atv_status}, uptodate: {atv_uptodate}")
|
||||
modules.append({
|
||||
"name" : f"{display_name} Antivirus status",
|
||||
"type" : "generic_proc",
|
||||
"value": atv_status,
|
||||
"module_group": "security",
|
||||
"desc" : f"{display_name} state: {product_state}, last update: {last_update}",
|
||||
})
|
||||
modules.append({
|
||||
"name" : f"{display_name} Antivirus up to date",
|
||||
"type" : "generic_proc",
|
||||
"value": atv_uptodate,
|
||||
"module_group": "security",
|
||||
"desc" : f"{display_name} state: {product_state}, last update: {last_update}",
|
||||
})
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error check antivirus: {e}", file=sys.stderr)
|
||||
|
||||
def is_lock_screen_enabled():
|
||||
try:
|
||||
# Open the registry key
|
||||
key_path = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
|
||||
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key_path) as key:
|
||||
# Query the value of the DisableLockScreen key
|
||||
value_name = "DisableLockScreen"
|
||||
value, _ = winreg.QueryValueEx(key, value_name)
|
||||
|
||||
# Check if the lock screen is enabled (0 means enabled)
|
||||
status = value == 0
|
||||
if status == False: return status
|
||||
|
||||
except FileNotFoundError:
|
||||
# If the registry key or value is not found, consider it as enabled
|
||||
status = True
|
||||
except Exception as e:
|
||||
print(f"Error check lockscreen: {e}", file=sys.stderr)
|
||||
status = False
|
||||
|
||||
try:
|
||||
# Define the registry key for the lock screen settings
|
||||
reg_key_path = r"SOFTWARE\Policies\Microsoft\Windows\Personalization"
|
||||
reg_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, reg_key_path)
|
||||
|
||||
# Query the "NoLockScreen" DWORD value
|
||||
value_name = "NoLockScreen"
|
||||
value, _ = winreg.QueryValueEx(reg_key, value_name)
|
||||
|
||||
# Check if the "NoLockScreen" value is 0 (enabled)
|
||||
status = value == 0
|
||||
if status == False: return status
|
||||
|
||||
except FileNotFoundError:
|
||||
# If the registry key or value is not found, consider it as enabled
|
||||
status = True
|
||||
except Exception as e:
|
||||
print(f"Error check lockscreen: {e}", file=sys.stderr)
|
||||
status = False
|
||||
|
||||
return status
|
||||
|
||||
def check_locksreen_enables():
|
||||
status = is_lock_screen_enabled()
|
||||
value = 1 if status == True else 0
|
||||
|
||||
modules.append({
|
||||
"name" : "Lockscreen status",
|
||||
"type" : "generic_proc",
|
||||
"value": value,
|
||||
"module_group": "security",
|
||||
"desc" : f"Check lockscreen enable",
|
||||
})
|
||||
|
||||
def convert_to_human_readable_date(timestamp_str):
|
||||
try:
|
||||
# Parse the timestamp string without the time zone
|
||||
timestamp = datetime.strptime(timestamp_str, '%Y%m%d%H%M%S')
|
||||
|
||||
# Convert to a human-readable format
|
||||
human_readable_date = timestamp.strftime('%Y-%m-%d %H:%M:%S %z')
|
||||
|
||||
return human_readable_date.strip()
|
||||
except Exception as e:
|
||||
print(f"Error converting date: {e}", file=sys.stderr)
|
||||
return None
|
||||
|
||||
def check_time_difference(timestamp, timedays=10):
|
||||
try:
|
||||
# Convert the timestamp string to a datetime object
|
||||
given_timestamp = datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S')
|
||||
|
||||
# Get the current time
|
||||
current_time = datetime.now()
|
||||
|
||||
#Calculate the time difference
|
||||
time_difference = current_time - given_timestamp
|
||||
|
||||
# Check if the time difference is greater than one hour
|
||||
if time_difference < timedelta(days=timedays):
|
||||
return "1"
|
||||
else:
|
||||
return "0"
|
||||
except Exception as e:
|
||||
print(f"Error check time difference: {e}", file=sys.stderr)
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
def get_windows_update_info(limit=5):
|
||||
try:
|
||||
# Connect to the Win32_ReliabilityRecords class in the root/cimv2 namespace
|
||||
wmi_conn = wmi.WMI()
|
||||
|
||||
# Query the Win32_ReliabilityRecords class for Windows Update information
|
||||
query = "SELECT * FROM Win32_ReliabilityRecords WHERE sourcename = 'Microsoft-Windows-WindowsUpdateClient'"
|
||||
result = wmi_conn.query(query)
|
||||
|
||||
# Extract relevant information and format output
|
||||
update_info = [
|
||||
{
|
||||
"date": convert_to_human_readable_date(record.timegenerated.split('.')[0]),
|
||||
"update": record.message
|
||||
}
|
||||
for record in result[:limit]
|
||||
]
|
||||
|
||||
last_update_date=update_info[0]['date']
|
||||
value=check_time_difference(last_update_date)
|
||||
|
||||
modules.append({
|
||||
"name" : "Microsoft Update system status",
|
||||
"type" : "generic_proc",
|
||||
"value": value,
|
||||
"module_group": "security",
|
||||
"desc" : f"Check if system was updated in the last 10 days. last update: {last_update_date}",
|
||||
})
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"Error windows update check: {e}", file=sys.stderr)
|
||||
return False
|
||||
|
||||
def is_firewall_enabled():
|
||||
try:
|
||||
# Run PowerShell command to check if the Windows Firewall is enabled
|
||||
result = subprocess.run(
|
||||
['powershell', 'Get-NetFirewallProfile |Select-Object profile, enabled | ConvertTo-Json'],
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
|
||||
result_json= json.loads(result.stdout)
|
||||
for profile in result_json:
|
||||
modules.append({
|
||||
"name" : f"Firewall profile: {profile['Profile']} status",
|
||||
"type" : "generic_proc",
|
||||
"value": profile["Enabled"],
|
||||
"module_group": "security",
|
||||
"desc" : f"Check if firewall profile {profile['Profile']} is enabled",
|
||||
})
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"Error firewall check: {e}", file=sys.stderr)
|
||||
return False
|
||||
|
||||
def check_password_enforcement():
|
||||
enforce_pass = 1
|
||||
counter = 0
|
||||
try:
|
||||
# Connect to the WMI service
|
||||
wmi_service = wmi.WMI()
|
||||
|
||||
# Query for user accounts
|
||||
users = wmi_service.Win32_UserAccount()
|
||||
|
||||
# Check if each user enforces password
|
||||
for user in users:
|
||||
# username = user.Name
|
||||
# password_required = user.PasswordRequired
|
||||
if user.PasswordRequired == False :
|
||||
enforce_pass = 0
|
||||
counter += 1
|
||||
#print(f"User: {username}, Password Required: {password_required}")
|
||||
|
||||
modules.append({
|
||||
"name" : "All users enforced password",
|
||||
"type" : "generic_proc",
|
||||
"value": enforce_pass,
|
||||
"module_group": "security",
|
||||
"desc" : f"Check if all users has enforced password, not secure users = {counter}",
|
||||
})
|
||||
except Exception as e:
|
||||
print(f"Error: {e}", file=sys.stderr)
|
||||
print("Failed to check password enforcement for users.", file=sys.stderr)
|
||||
|
||||
|
||||
def check_login_audit_policy():
|
||||
try:
|
||||
# Run the auditpol command to check the audit policy for Logon/Logoff
|
||||
cmd_command = "auditpol /get /subcategory:Logon"
|
||||
result = subprocess.run(cmd_command, shell=True, capture_output=True, text=True, check=True)
|
||||
last_line = result.stdout.strip().split('\n')[-1]
|
||||
cleaned_line = re.sub(' +', ' ', last_line)
|
||||
|
||||
# Interpret the result
|
||||
if "Success and Failure" in result.stdout:
|
||||
result = 1
|
||||
elif "Aciertos y errores" in result.stdout:
|
||||
result = 1
|
||||
elif "No Auditing" in result.stdout:
|
||||
result = 0
|
||||
elif "Sin auditoría" in result.stdout:
|
||||
result = 0
|
||||
else:
|
||||
print("Unable to determine audit policy for Logon/Logoff events.", file=sys.stderr)
|
||||
result = 0
|
||||
modules.append({
|
||||
"name" : "Check logon event audited",
|
||||
"type" : "generic_proc",
|
||||
"value": result,
|
||||
"module_group": "security",
|
||||
"desc" : f"Check if the logon events audit log is enables, status:{cleaned_line}",
|
||||
})
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error: {e}")
|
||||
print("Failed to check audit policy using auditpol command.", file=sys.stderr)
|
||||
return
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
check_antivirus_status()
|
||||
check_locksreen_enables()
|
||||
get_windows_update_info()
|
||||
is_firewall_enabled()
|
||||
check_password_enforcement()
|
||||
check_login_audit_policy()
|
||||
|
||||
for module in modules:
|
||||
print_module(module, True)
|
||||
|
||||
|
||||
# Windows Defender status values:
|
||||
# 0: No action needed
|
||||
# 266240: Antivirus is up to date
|
||||
# 266256: Antivirus is out of date
|
||||
# 266304: Antivirus is not monitoring
|
||||
# 393216 (0x60000): No action needed.
|
||||
# 393232 (0x60010): Antivirus is up to date.
|
||||
# 393240 (0x60018): Antivirus is out of date.
|
||||
# 393216 (0x60030): Antivirus is not monitoring.
|
||||
# 397312 (0x61000): Antivirus is disabled.
|
||||
|
||||
# AVG Internet Security 2012 (from antivirusproduct WMI)
|
||||
# 262144 (040000) = disabled and up to date
|
||||
# 266240 (041000) = enabled and up to date
|
||||
# AVG Internet Security 2012 (from firewallproduct WMI)
|
||||
# 266256 (041010) = firewall enabled - (last two blocks not relevant it seems for firewall)
|
||||
# 262160 (040010) = firewall disabled - (last two blocks not relevant it seems for firewall)
|
||||
|
||||
# Windows Defender
|
||||
# 393472 (060100) = disabled and up to date
|
||||
# 397584 (061110) = enabled and out of date
|
||||
# 397568 (061100) = enabled and up to date
|
||||
# Microsoft Security Essentials
|
||||
# 397312 (061000) = enabled and up to date
|
||||
# 393216 (060000) = disabled and up to date
|
@ -0,0 +1 @@
|
||||
WMI==1.5.1
|
@ -157,12 +157,32 @@ module_exec last | head -1
|
||||
module_description Last Login
|
||||
module_end
|
||||
|
||||
# Plugin example
|
||||
#Hardening plugin for security compliance analysis. Enable to use it.
|
||||
#module_begin
|
||||
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
|
||||
#module_absoluteinterval 7d
|
||||
#module_end
|
||||
|
||||
# This parses /var/log/syslog file, under the module name "syslog"
|
||||
# This module parses /var/log/syslog file, under the module name "syslog"
|
||||
# And search for "ssh" string into it, sending only that information.
|
||||
module_begin
|
||||
module_name Syslog
|
||||
module_description Search for ssh string into /var/log/syslog file
|
||||
module_type log
|
||||
module_regexp /var/log/syslog
|
||||
module_pattern ssh
|
||||
module_end
|
||||
|
||||
module_plugin grep_log /var/log/syslog Syslog ssh
|
||||
# Plugin example
|
||||
|
||||
# Plugin for inventory on the agent.
|
||||
# module_plugin inventory 1 cpu ram video nic hd cdrom software
|
||||
|
||||
# Extraction module example
|
||||
#module_begin
|
||||
#module_name Collector
|
||||
#module_description Logs extraction module
|
||||
#module_type log
|
||||
#module_regexp /var/log/logfile.log
|
||||
#module_pattern .*
|
||||
#module_end
|
@ -372,13 +372,32 @@ module_end
|
||||
#module_description XGrid
|
||||
#module_end
|
||||
|
||||
#Hardening plugin for security compliance analysis. Enable to use it.
|
||||
#module_begin
|
||||
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
|
||||
#module_absoluteinterval 7d
|
||||
#module_end
|
||||
|
||||
# This module parses /var/log/syslog file, under the module name "syslog"
|
||||
# And search for "ssh" string into it, sending only that information.
|
||||
module_begin
|
||||
module_name Syslog
|
||||
module_description Log collection modules
|
||||
module_type log
|
||||
module_regexp /var/log/syslog
|
||||
module_pattern ssh
|
||||
module_end
|
||||
|
||||
# Plugin example
|
||||
|
||||
# This parses /var/log/syslog file, under the module name "syslog"
|
||||
# And search for "ssh" string into it, sending only that information.
|
||||
|
||||
#module_plugin grep_log /var/log/syslog Syslog ssh
|
||||
|
||||
# Plugin for inventory on the agent.
|
||||
|
||||
# module_plugin inventory 1 cpu ram video nic hd cdrom software
|
||||
|
||||
# Extraction module example
|
||||
#module_begin
|
||||
#module_name Collector
|
||||
#module_description Logs extraction module
|
||||
#module_type log
|
||||
#module_regexp /var/log/logfile.log
|
||||
#module_pattern .*
|
||||
#module_end
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.774-231205
|
||||
Version: 7.0NG.774-231218
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.774-231205"
|
||||
pandora_version="7.0NG.774-231218"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -271,11 +271,17 @@ module_plugin pandora_netusage
|
||||
module_plugin autodiscover --default
|
||||
|
||||
# Plugin for inventory on the agent.
|
||||
#module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
|
||||
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
|
||||
|
||||
# Log collection modules. This will collect log files for forensic analysis and store everything
|
||||
# This is for LOG monitoring. Different than log monitoring.
|
||||
#module_plugin grep_log_module /var/log/messages Syslog \.\*
|
||||
module_begin
|
||||
module_name Syslog
|
||||
module_description Log collection modules
|
||||
module_type log
|
||||
module_regexp /var/log/messages
|
||||
module_pattern .*
|
||||
module_end
|
||||
|
||||
# Another samples of monitoring modules
|
||||
|
||||
@ -317,9 +323,9 @@ module_plugin autodiscover --default
|
||||
#module_absoluteinterval 7d
|
||||
#module_end
|
||||
|
||||
# Logs extraction
|
||||
# Extraction module example
|
||||
#module_begin
|
||||
#module_name Syslog
|
||||
#module_name Collector
|
||||
#module_description Logs extraction module
|
||||
#module_type log
|
||||
#module_regexp /var/log/logfile.log
|
||||
|
@ -1039,7 +1039,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.774';
|
||||
use constant AGENT_BUILD => '231205';
|
||||
use constant AGENT_BUILD => '231218';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
@ -4436,14 +4436,7 @@ my $PID = $$;
|
||||
|
||||
#Launch tentacle server in proxy mode if configured
|
||||
if ($Conf{'proxy_mode'}) {
|
||||
|
||||
#Check if user is root
|
||||
if ($> != 0) {
|
||||
launch_tentacle_proxy();
|
||||
} else {
|
||||
log_message ('error', 'Proxy mode can not be launched as root');
|
||||
exit 1;
|
||||
}
|
||||
launch_tentacle_proxy();
|
||||
}
|
||||
|
||||
# Advice if YAML::Tiny is allowed in this system
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231205
|
||||
%define release 231218
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -5,7 +5,7 @@
|
||||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231205
|
||||
%define release 231218
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
@ -5,7 +5,7 @@
|
||||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231205
|
||||
%define release 231218
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
@ -5,7 +5,7 @@
|
||||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231205
|
||||
%define release 231218
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
Name: %{name}
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.774
|
||||
%define release 231205
|
||||
%define release 231218
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.774"
|
||||
PI_BUILD="231205"
|
||||
PI_BUILD="231218"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -179,6 +179,22 @@ module_description Total number of TCP connections active
|
||||
module_group Networking
|
||||
module_end
|
||||
|
||||
# Get logs from System source.
|
||||
module_begin
|
||||
module_name Eventlog_System
|
||||
module_type log
|
||||
module_logevent
|
||||
module_source System
|
||||
module_end
|
||||
|
||||
# Get logs from Security source.
|
||||
module_begin
|
||||
module_name Eventlog_Security
|
||||
module_type log
|
||||
module_logevent
|
||||
module_source Security
|
||||
module_end
|
||||
|
||||
# Example plugin to retrieve drive usage
|
||||
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs"
|
||||
|
||||
@ -273,22 +289,6 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
|
||||
#module_type generic_data_string
|
||||
#module_end
|
||||
|
||||
# Get logs from System source. Need enterprise version.
|
||||
#module_begin
|
||||
#module_name Eventlog_System
|
||||
#module_type log
|
||||
#module_logevent
|
||||
#module_source System
|
||||
#module_end
|
||||
|
||||
# Get logs from Security source. Need enterprise version.
|
||||
#module_begin
|
||||
#module_name Eventlog_Security
|
||||
#module_type log
|
||||
#module_logevent
|
||||
#module_source Security
|
||||
#module_end
|
||||
|
||||
# Get logs from Application source. Need enterprise version.
|
||||
#module_begin
|
||||
#module_name Eventlog_Application
|
||||
@ -538,3 +538,8 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
|
||||
#module_regexp C:\server\logs\xserver.log
|
||||
#module_pattern .*
|
||||
#module_end
|
||||
|
||||
# Pandora basic security check plugin for windows.
|
||||
#module_begin
|
||||
#module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_security_win.exe"
|
||||
#module_end
|
||||
|
3
pandora_agents/win32/bin/util/pandora_security_win.exe
Executable file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c58891fbd16bf80f288e0ff4751801aa02dbf4e6c914625b4d49a364c7e0b511
|
||||
size 7829249
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{231205}
|
||||
{231218}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.774 Build 231205")
|
||||
#define PANDORA_VERSION ("7.0NG.774 Build 231218")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Pandora FMS"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.774(Build 231205))"
|
||||
VALUE "ProductVersion", "(7.0NG.774(Build 231218))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.774-231205
|
||||
Version: 7.0NG.774-231218
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.774-231205"
|
||||
pandora_version="7.0NG.774-231218"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -183,7 +183,9 @@ if (isset($config['force_instant_logout']) === true
|
||||
$_SESSION = [];
|
||||
session_destroy();
|
||||
header_remove('Set-Cookie');
|
||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||
if (isset($_COOKIE[session_name()]) === true) {
|
||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||
}
|
||||
|
||||
if ($config['auth'] === 'saml' && empty($public_hash) === true) {
|
||||
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
|
||||
|
@ -34,11 +34,11 @@ if ((bool) $config['metaconsole']) {
|
||||
include_once $config['homedir'].'/include/functions_modules.php';
|
||||
include_once $config['homedir'].'/include/functions_users.php';
|
||||
} else {
|
||||
include_once '../include/config.php';
|
||||
include_once '../include/functions_agents.php';
|
||||
include_once '../include/functions_reporting.php';
|
||||
include_once '../include/functions_modules.php';
|
||||
include_once '../include/functions_users.php';
|
||||
include_once __DIR__.'/../include/config.php';
|
||||
include_once __DIR__.'/../include/functions_agents.php';
|
||||
include_once __DIR__.'/../include/functions_reporting.php';
|
||||
include_once __DIR__.'/../include/functions_modules.php';
|
||||
include_once __DIR__.'/../include/functions_users.php';
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,286 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Pandora FMS - https://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2023 Pandora FMS
|
||||
// Please see https://pandorafms.com/community/ for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
function pandora_files_repo_install()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($config['files_repo_installed']) && $config['files_repo_installed'] == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
$full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/';
|
||||
$full_sql_dir = $full_extensions_dir.'files_repo/sql/';
|
||||
|
||||
$file_path = '';
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$file_path = $full_sql_dir.'files_repo.sql';
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
$file_path = $full_sql_dir.'files_repo.postgreSQL.sql';
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$file_path = $full_sql_dir.'files_repo.oracle.sql';
|
||||
break;
|
||||
}
|
||||
|
||||
if (!empty($file_path)) {
|
||||
$result = db_process_file($file_path);
|
||||
|
||||
if ($result) {
|
||||
// Configuration values
|
||||
$values = [
|
||||
'token' => 'files_repo_installed',
|
||||
'value' => 1,
|
||||
];
|
||||
db_process_sql_insert('tconfig', $values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function pandora_files_repo_uninstall()
|
||||
{
|
||||
global $config;
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
db_process_sql('DROP TABLE `tfiles_repo_group`');
|
||||
db_process_sql('DROP TABLE `tfiles_repo`');
|
||||
db_process_sql(
|
||||
'DELETE FROM `tconfig`
|
||||
WHERE `token` LIKE "files_repo_%"'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
db_process_sql('DROP TABLE "tfiles_repo_group"');
|
||||
db_process_sql('DROP TABLE "tfiles_repo"');
|
||||
db_process_sql(
|
||||
'DELETE FROM "tconfig"
|
||||
WHERE "token" LIKE \'files_repo_%\''
|
||||
);
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
db_process_sql('DROP TRIGGER "tfiles_repo_group_inc"');
|
||||
db_process_sql('DROP SEQUENCE "tfiles_repo_group_s"');
|
||||
db_process_sql('DROP TABLE "tfiles_repo_group"');
|
||||
db_process_sql('DROP TRIGGER "tfiles_repo_inc"');
|
||||
db_process_sql('DROP SEQUENCE "tfiles_repo_s"');
|
||||
db_process_sql('DROP TABLE "tfiles_repo"');
|
||||
db_process_sql(
|
||||
'DELETE FROM tconfig
|
||||
WHERE token LIKE \'files_repo_%\''
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!empty($config['attachment_store'])) {
|
||||
delete_dir($config['attachment_store'].'/files_repo');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function pandora_files_repo_godmode()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (!isset($config['files_repo_installed']) || !$config['files_repo_installed']) {
|
||||
ui_print_error_message(__('Extension not installed'));
|
||||
}
|
||||
|
||||
// ACL Check
|
||||
check_login();
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access to Files repository'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
// Header tabs.
|
||||
$godmode['text'] = '<a href="index.php?sec=godmode/extensions&sec2=extensions/files_repo">'.html_print_image('images/configuration@svg.svg', true, ['title' => __('Administration view'), 'class' => 'main_menu_icon invert_filter']).'</a>';
|
||||
$godmode['godmode'] = 1;
|
||||
$godmode['active'] = 1;
|
||||
|
||||
$operation['text'] = '<a href="index.php?sec=extensions&sec2=extensions/files_repo">'.html_print_image('images/see-details@svg.svg', true, ['title' => __('Operation view'), 'class' => 'main_menu_icon invert_filter']).'</a>';
|
||||
$operation['operation'] = 1;
|
||||
|
||||
$onheader = [
|
||||
'godmode' => $godmode,
|
||||
'operation' => $operation,
|
||||
];
|
||||
|
||||
// Header.
|
||||
ui_print_standard_header(
|
||||
__('Extensions'),
|
||||
'images/extensions.png',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
$onheader,
|
||||
[
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Admin tools'),
|
||||
],
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Extension manager'),
|
||||
],
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Files repository manager'),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/';
|
||||
include_once $full_extensions_dir.'files_repo/functions_files_repo.php';
|
||||
|
||||
// Directory files_repo check.
|
||||
if (!files_repo_check_directory(true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$server_content_length = 0;
|
||||
if (isset($_SERVER['CONTENT_LENGTH'])) {
|
||||
$server_content_length = $_SERVER['CONTENT_LENGTH'];
|
||||
}
|
||||
|
||||
// Check for an anoying error that causes the $_POST and $_FILES arrays.
|
||||
// were empty if the file is larger than the post_max_size.
|
||||
if (intval($server_content_length) > 0 && empty($_POST)) {
|
||||
ui_print_error_message(__('Problem uploading. Please check this PHP runtime variable values: <pre> post_max_size (currently '.ini_get('post_max_size').')</pre>'));
|
||||
}
|
||||
|
||||
// GET and POST parameters.
|
||||
$file_id = (int) get_parameter('file_id');
|
||||
$add_file = (bool) get_parameter('add_file');
|
||||
$update_file = (bool) get_parameter('update_file');
|
||||
$delete_file = (bool) get_parameter('delete');
|
||||
|
||||
// File add or update.
|
||||
if ($add_file || ($update_file && $file_id > 0)) {
|
||||
$groups = get_parameter('groups', []);
|
||||
$public = (bool) get_parameter('public');
|
||||
$description = io_safe_output((string) get_parameter('description'));
|
||||
if (mb_strlen($description, 'UTF-8') > 200) {
|
||||
$description = mb_substr($description, 0, 200, 'UTF-8');
|
||||
}
|
||||
|
||||
$description = io_safe_input($description);
|
||||
|
||||
if ($add_file) {
|
||||
$result = files_repo_add_file('upfile', $description, $groups, $public);
|
||||
} else if ($update_file) {
|
||||
$result = files_repo_update_file($file_id, $description, $groups, $public);
|
||||
$file_id = 0;
|
||||
}
|
||||
|
||||
if ($result['status'] == false) {
|
||||
ui_print_error_message($result['message']);
|
||||
}
|
||||
}
|
||||
|
||||
// File delete.
|
||||
if ($delete_file && $file_id > 0) {
|
||||
$result = files_repo_delete_file($file_id);
|
||||
if ($result !== -1) {
|
||||
ui_print_result_message($result, __('Successfully deleted'), __('Could not be deleted'));
|
||||
}
|
||||
|
||||
$file_id = 0;
|
||||
}
|
||||
|
||||
// FORM.
|
||||
include $full_extensions_dir.'files_repo/files_repo_form.php';
|
||||
if (!$file_id) {
|
||||
// LIST.
|
||||
$manage = true;
|
||||
include $full_extensions_dir.'files_repo/files_repo_list.php';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function pandora_files_repo_operation()
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Header tabs.
|
||||
$onheader = [];
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$godmode['text'] = '<a href="index.php?sec=godmode/extensions&sec2=extensions/files_repo">'.html_print_image('images/configuration@svg.svg', true, ['title' => __('Administration view'), 'class' => 'main_menu_icon invert_filter']).'</a>';
|
||||
$godmode['godmode'] = 1;
|
||||
|
||||
$operation['text'] = '<a href="index.php?sec=extensions&sec2=extensions/files_repo">'.html_print_image('images/see-details@svg.svg', true, ['title' => __('Operation view'), 'class' => 'main_menu_icon invert_filter']).'</a>';
|
||||
$operation['operation'] = 1;
|
||||
$operation['active'] = 1;
|
||||
|
||||
$onheader = [
|
||||
'godmode' => $godmode,
|
||||
'operation' => $operation,
|
||||
];
|
||||
}
|
||||
|
||||
// Header.
|
||||
ui_print_standard_header(
|
||||
__('Files repository'),
|
||||
'images/extensions.png',
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
$onheader,
|
||||
[
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Admin tools'),
|
||||
],
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Extension manager'),
|
||||
],
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Files repository'),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/';
|
||||
include_once $full_extensions_dir.'files_repo/functions_files_repo.php';
|
||||
|
||||
// Directory files_repo check.
|
||||
if (!files_repo_check_directory(true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// LIST.
|
||||
$full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/';
|
||||
|
||||
include $full_extensions_dir.'files_repo/files_repo_list.php';
|
||||
}
|
||||
|
||||
|
||||
extensions_add_operation_menu_option(__('Files repository'), null, null, 'v1r1');
|
||||
extensions_add_main_function('pandora_files_repo_operation');
|
||||
extensions_add_godmode_menu_option(__('Files repository manager'), 'PM', null, null, 'v1r1');
|
||||
extensions_add_godmode_function('pandora_files_repo_godmode');
|
||||
|
||||
pandora_files_repo_install();
|
@ -1,168 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Pandora FMS - https://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2023 Pandora FMS
|
||||
// Please see https://pandorafms.com/community/ for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
$full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/';
|
||||
require_once $full_extensions_dir.'files_repo/functions_files_repo.php';
|
||||
|
||||
|
||||
|
||||
$offset = (int) get_parameter('offset');
|
||||
$filter = [];
|
||||
$filter['limit'] = $config['block_size'];
|
||||
$filter['offset'] = $offset;
|
||||
$filter['order'] = [
|
||||
'field' => 'id',
|
||||
'order' => 'DESC',
|
||||
];
|
||||
|
||||
$files = files_repo_get_files($filter);
|
||||
|
||||
|
||||
if (!empty($files)) {
|
||||
if (!isset($manage)) {
|
||||
$manage = false;
|
||||
}
|
||||
|
||||
// Pagination
|
||||
if ($manage) {
|
||||
$url = ui_get_full_url('index.php?sec=godmode/extensions&sec2=extensions/files_repo');
|
||||
} else {
|
||||
$url = ui_get_full_url('index.php?sec=extensions&sec2=extensions/files_repo');
|
||||
}
|
||||
|
||||
$total_files = files_repo_get_files(false, true);
|
||||
ui_pagination($total_files, $url, $offset);
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
$table->style = [];
|
||||
$table->style[1] = 'max-width: 200px;';
|
||||
$table->style[4] = 'text-align: center;';
|
||||
$table->head = [];
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Description');
|
||||
$table->head[2] = __('Size');
|
||||
$table->head[3] = __('Last modification');
|
||||
$table->head[4] = '';
|
||||
$table->data = [];
|
||||
|
||||
foreach ($files as $file_id => $file) {
|
||||
$data = [];
|
||||
|
||||
// Prepare the filename for the get_file.php script
|
||||
$document_root = str_replace(
|
||||
'\\',
|
||||
'/',
|
||||
io_safe_output($_SERVER['DOCUMENT_ROOT'])
|
||||
);
|
||||
$file['location'] = str_replace(
|
||||
'\\',
|
||||
'/',
|
||||
io_safe_output($file['location'])
|
||||
);
|
||||
$relative_path = str_replace($document_root, '', $file['location']);
|
||||
$file_name = explode('/', $file['location']);
|
||||
$file_decoded = $file_name[(count($file_name) - 1)];
|
||||
$file_path = base64_encode($file_decoded);
|
||||
$hash = md5($file_path.$config['server_unique_identifier']);
|
||||
$url = ui_get_full_url(
|
||||
'include/get_file.php?file='.urlencode($file_path).'&hash='.$hash
|
||||
);
|
||||
$date_format = ($config['date_format']) ? io_safe_output($config['date_format']) : 'F j, Y - H:m';
|
||||
|
||||
$data[0] = "<a href=\"$url\" target=\"_blank\">".$file['name'].'</a>';
|
||||
// Name
|
||||
$data[1] = ui_print_truncate_text(
|
||||
$file['description'],
|
||||
'description',
|
||||
true,
|
||||
true
|
||||
);
|
||||
// Description
|
||||
$data[2] = ui_format_filesize($file['size']);
|
||||
// Size
|
||||
$data[3] = date($date_format, $file['mtime']);
|
||||
// Last modification
|
||||
// Public URL
|
||||
$data[4] = '';
|
||||
$table->cellclass[][4] = 'table_action_buttons';
|
||||
if (!empty($file['hash'])) {
|
||||
$public_url = ui_get_full_url(
|
||||
EXTENSIONS_DIR.'/files_repo/files_repo_get_file.php?file='.$file['hash']
|
||||
);
|
||||
$message = __('Copy to clipboard').': Ctrl+C -> Enter';
|
||||
$action = "window.prompt('$message', '$public_url');";
|
||||
$data[4] .= "<a href=\"javascript:;\" onclick=\"$action\">";
|
||||
$data[4] .= html_print_image(
|
||||
'images/world.png',
|
||||
true,
|
||||
['title' => __('Public link')]
|
||||
);
|
||||
// Public link image
|
||||
$data[4] .= '</a> ';
|
||||
}
|
||||
|
||||
$data[4] .= "<a href=\"$url\" target=\"_blank\">";
|
||||
$data[4] .= html_print_image(
|
||||
'images/download.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Download'),
|
||||
'style' => 'padding:3px',
|
||||
]
|
||||
);
|
||||
// Download image
|
||||
$data[4] .= '</a>';
|
||||
|
||||
if ($manage) {
|
||||
$config_url = ui_get_full_url(
|
||||
'index.php?sec=godmode/extensions&sec2=extensions/files_repo&file_id='.$file_id
|
||||
);
|
||||
$data[4] .= "<a href=\"$config_url\">";
|
||||
$data[4] .= html_print_image(
|
||||
'images/edit.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('Edit'),
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
);
|
||||
// Edit image
|
||||
$data[4] .= '</a>';
|
||||
|
||||
$delete_url = ui_get_full_url(
|
||||
'index.php?sec=godmode/extensions&sec2=extensions/files_repo&delete=1&file_id='.$file_id
|
||||
);
|
||||
$data[4] .= " <a href=\"$delete_url\" onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\">";
|
||||
$data[4] .= html_print_image(
|
||||
'images/delete.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('Delete'),
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
);
|
||||
// Delete image
|
||||
$data[4] .= '</a>';
|
||||
}
|
||||
|
||||
$table->data[] = $data;
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
} else {
|
||||
ui_print_info_message(__('No items'));
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
CREATE TABLE tfiles_repo (
|
||||
id NUMBER(5, 0) NOT NULL PRIMARY KEY,
|
||||
name VARCHAR2(255) NOT NULL,
|
||||
description VARCHAR2(500) NULL,
|
||||
hash VARCHAR2(8) NULL
|
||||
);
|
||||
CREATE SEQUENCE tfiles_repo_s INCREMENT BY 1 START WITH 1;
|
||||
CREATE OR REPLACE TRIGGER tfiles_repo_inc BEFORE INSERT ON tfiles_repo REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tfiles_repo_s.nextval INTO :NEW.ID FROM dual; END;;
|
||||
|
||||
CREATE TABLE tfiles_repo_group (
|
||||
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
|
||||
id_file NUMBER(5, 0) NOT NULL REFERENCES tfiles_repo(id) ON DELETE CASCADE,
|
||||
id_group NUMBER(4, 0) NOT NULL
|
||||
);
|
||||
CREATE SEQUENCE tfiles_repo_group_s INCREMENT BY 1 START WITH 1;
|
||||
CREATE OR REPLACE TRIGGER tfiles_repo_group_inc BEFORE INSERT ON tfiles_repo_group REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tfiles_repo_group_s.nextval INTO :NEW.ID FROM dual; END;;
|
@ -1,2 +0,0 @@
|
||||
CREATE TABLE "tfiles_repo" ("id" SERIAL NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "description" VARCHAR(500) NULL default '', "hash" VARCHAR(8) NULL default '');
|
||||
CREATE TABLE "tfiles_repo_group" ("id" SERIAL NOT NULL PRIMARY KEY, "id_file" INTEGER NOT NULL REFERENCES tfiles_repo("id") ON DELETE CASCADE, "id_group" INTEGER NOT NULL);
|
@ -1,15 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS `tfiles_repo` (
|
||||
`id` int(5) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`description` varchar(500) NULL default '',
|
||||
`hash` varchar(8) NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tfiles_repo_group` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_file` int(5) unsigned NOT NULL,
|
||||
`id_group` int(4) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_file`) REFERENCES tfiles_repo(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
@ -31,7 +31,7 @@ function view_logfile($file_name, $toggle=false)
|
||||
} else {
|
||||
$file_size = filesize($file_name);
|
||||
|
||||
if ($memory_limit < $file_size) {
|
||||
if ($memory_limit < $file_size && $memory_limit !== '-1') {
|
||||
$code .= '<pre><h2>'.$file_name.' ('.__('File is too large than PHP memory allocated in the system.').')</h2>';
|
||||
$code .= '<h2>'.__('The preview file is imposible.').'</h2>';
|
||||
} else if ($file_size > ($config['max_log_size'] * 1000)) {
|
||||
@ -117,6 +117,7 @@ function pandoralogs_extension_main()
|
||||
view_logfile($config['homedir'].'/log/console.log', true);
|
||||
}
|
||||
|
||||
view_logfile('/var/log/php-fpm/www-error.log', true);
|
||||
view_logfile($logs_directory.'/pandora_server.log', true);
|
||||
view_logfile($logs_directory.'/pandora_server.error', true);
|
||||
|
||||
|
@ -1720,4 +1720,19 @@ include/functions_integriaims.php
|
||||
include/ajax/integria_incidents.ajax.php
|
||||
enterprise/operation/log/log_source.php
|
||||
enterprise/include/class/LogSource.class.php
|
||||
include/chart_generator.php
|
||||
include/chart_generator.php
|
||||
enterprise/extensions/translate_string.php
|
||||
enterprise/extensions/translate_string/functions.php
|
||||
enterprise/extensions/translate_string/translate_string.oracle.sql
|
||||
enterprise/extensions/translate_string/translate_string.postgresql.sql
|
||||
enterprise/extensions/translate_string/translate_string.sql
|
||||
enterprise/extensions/translate_string
|
||||
extensions/files_repo.php
|
||||
extensions/files_repo/files_repo_form.php
|
||||
extensions/files_repo/files_repo_get_file.php
|
||||
extensions/files_repo/files_repo_list.php
|
||||
extensions/files_repo/functions_files_repo.php
|
||||
extensions/files_repo/sql/files_repo.oracle.sql
|
||||
extensions/files_repo/sql/files_repo.postgreSQL.sql
|
||||
extensions/files_repo/sql/files_repo.sql
|
||||
extensions/files_repo
|
||||
|
@ -1,4 +1,4 @@
|
||||
pandorafms.vmware=9959cc3e5cc6bfcfadd6d05b56d4a11b
|
||||
pandorafms.vmware=248788e0fb2cd4e11623e4a52ee7d05b
|
||||
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
|
||||
pandorafms.mssql=1cc215409741d19080269ffba112810e
|
||||
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6
|
||||
|
18
pandora_console/extras/discovery/DiscoveryApps.csv
Normal file
@ -0,0 +1,18 @@
|
||||
pandorafms.aws.ec2;Amazon EC2;cloud;1;pandorafms.aws.ec2.png;https://pandorafms.com/library/aws-ec2-discovery/
|
||||
pandorafms.aws.rds;Amazon RDS;cloud;1;pandorafms.aws.rds.png;https://pandorafms.com/library/aws-rds-discovery/
|
||||
pandorafms.aws.s3;Amazon S3;cloud;1;pandorafms.aws.s3.png;https://pandorafms.com/library/aws-s3-discovery/
|
||||
pandorafms.azure.mc;Azure Microsoft Compute;cloud;1;pandorafms.azure.mc.png;https://pandorafms.com/library/aws-azure-discovery/
|
||||
pandorafms.db2;DB2;app;1;pandorafms.db2.png;https://pandorafms.com/library/db2-discovery/
|
||||
pandorafms.gcp.ce;Google Cloud Compute Engine;cloud;1;pandorafms.gcp.ce.png;https://pandorafms.com/library/google-cloud-discovery/
|
||||
pandorafms.mssql;Microsoft SQL Server;app;1;pandorafms.mssql.png;https://pandorafms.com/library/mssql-discovery/
|
||||
pandorafms.mysql;MySQL;app;1;pandorafms.mysql.png;https://pandorafms.com/library/mysql-discovery/
|
||||
pandorafms.oracle;Oracle;app;1;pandorafms.oracle.png;https://pandorafms.com/library/oracle-discovery/
|
||||
pandorafms.proxmox;Proxmox;app;0;pandorafms.proxmox.png;https://pandorafms.com/library/proxmox-discovery/
|
||||
pandorafms.sap.deset;SAP R3 - Deset;app;1;pandorafms.sap.deset.png;https://pandorafms.com/library/sap-discovery/
|
||||
pandorafms.vmware;VMware;app;1;pandorafms.vmware.png;https://pandorafms.com/library/vmware-discovery/
|
||||
pandorafms.kubernetes;Kubernetes;app;1;pandorafms.kubernetes.png;https://pandorafms.com/library/kubernetes-discovery/
|
||||
pandorafms.mongodb;MongoDB;app;1;pandorafms.mongodb.png;https://pandorafms.com/library/mongodb-discovery/
|
||||
pandorafms.ovh;OVH;cloud;1;pandorafms.ovh.png;https://pandorafms.com/library/ovh-discovery/
|
||||
pandorafms.vulnscan;Vulnerability Scanner;app;1;pandorafms.vulnscan.png;https://pandorafms.com/library/pandora-vulnerability-discovery/
|
||||
pandorafms.postgresql;PostgreSQL;app;1;pandorafms.postgresql.png;https://pandorafms.com/library/postgresql-discovery/
|
||||
pandorafms.xenserver;Xenserver;app;1;pandorafms.xenserver.png;https://pandorafms.com/library/xenserver-discovery/
|
|
7
pandora_console/extras/mr/68.sql
Normal file
@ -0,0 +1,7 @@
|
||||
START TRANSACTION;
|
||||
|
||||
DELETE FROM `twelcome_tip` WHERE `title` = 'Automatic agent provision system';
|
||||
|
||||
INSERT INTO `twelcome_tip` (`id_lang`,`id_profile`,`title`,`text`,`url`,`enable`) VALUES ('en_GB',0,'Automatic agent provision system','The agent self-provisioning system allows an agent recently entered into the system to automatically apply changes to their configuration (such as moving them from group, assigning them certain values in custom fields) and of course applying certain monitoring policies. It is one of the most powerful functionalities, aimed at managing very large system parks.','https://pandorafms.com/manual/start?id=en/documentation/02_installation/05_configuration_agents#conf',1);
|
||||
|
||||
COMMIT;
|
@ -35,7 +35,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
||||
$notifications_numbers['last_id']
|
||||
).'</div>';
|
||||
$header_welcome = '';
|
||||
if (check_acl($config['id_user'], $group, 'AW')) {
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
$header_welcome .= '<div id="welcome-icon-header">';
|
||||
$header_welcome .= html_print_image(
|
||||
'images/wizard@svg.svg',
|
||||
@ -455,19 +455,28 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
||||
);
|
||||
$header_logout .= '</a></div>';
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$subtitle_header = $config['custom_subtitle_header'];
|
||||
$class_header = '';
|
||||
} else {
|
||||
$subtitle_header = __('the Flexible Monitoring System (OpenSource version)');
|
||||
echo '<div id="dialog_why_enterprise" class="invisible"></div>';
|
||||
$class_header = 'underline-hover modal_module_list';
|
||||
}
|
||||
|
||||
if (is_reporting_console_node() === true) {
|
||||
echo '<div class="header_left">';
|
||||
echo '<div class="header_left '.$class_header.'">';
|
||||
echo '<span class="header_title">';
|
||||
echo $config['custom_title_header'];
|
||||
echo '</span>';
|
||||
echo '<span class="header_subtitle">';
|
||||
echo $config['custom_subtitle_header'];
|
||||
echo $subtitle_header;
|
||||
echo '</span>';
|
||||
echo '</div>';
|
||||
echo '<div class="header_center"></div>';
|
||||
echo '<div class="header_right">'.$modal_help, $header_user, $header_logout.'</div>';
|
||||
} else {
|
||||
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
|
||||
echo '<div class="header_left '.$class_header.'"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$subtitle_header.'</span></div>
|
||||
<div class="header_center">'.$header_searchbar.'</div>
|
||||
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $modal_help, $header_setup, $header_user, $header_logout.'</div>';
|
||||
}
|
||||
@ -916,6 +925,46 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
<?php if (enterprise_installed() === false) { ?>
|
||||
$('.header_left').on('click', function(){
|
||||
// Hidden tips modal.
|
||||
$(".window").css("display", "none");
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
page: "include/functions_menu",
|
||||
'why_enterprise': "true"
|
||||
},
|
||||
function(data) {
|
||||
if (data) {
|
||||
$("#dialog_why_enterprise").html(data);
|
||||
// Open dialog
|
||||
$("#dialog_why_enterprise").dialog({
|
||||
resizable: false,
|
||||
draggable: false,
|
||||
modal: true,
|
||||
show: {
|
||||
effect: "fade",
|
||||
duration: 200
|
||||
},
|
||||
hide: {
|
||||
effect: "fade",
|
||||
duration: 200
|
||||
},
|
||||
closeOnEscape: true,
|
||||
width: 700,
|
||||
height: 450,
|
||||
close: function(){
|
||||
$('#dialog_why_enterprise').html('');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
"html"
|
||||
);
|
||||
});
|
||||
<?php } ?>
|
||||
|
||||
// Check new notifications on a periodic way
|
||||
setInterval(check_new_notifications, 60000);
|
||||
|
||||
|
@ -1237,11 +1237,24 @@ if ($new_agent === false) {
|
||||
$actionButtons .= html_print_input_hidden('id_agente', $id_agente);
|
||||
|
||||
if (is_management_allowed() === true) {
|
||||
$clusters = agents_get_agent_belongs_cluster($id_agente);
|
||||
$cluster_belongs = '';
|
||||
if (empty($clusters) === false) {
|
||||
$clusters = array_reduce(
|
||||
$clusters,
|
||||
function ($carry, $item) {
|
||||
$carry[] = $item['name'];
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
$cluster_belongs = implode(', ', $clusters);
|
||||
}
|
||||
|
||||
$actionButtons .= html_print_button(
|
||||
__('Delete agent'),
|
||||
'deleteAgent',
|
||||
false,
|
||||
'deleteAgentDialog('.$id_agente.')',
|
||||
'deleteAgentDialog('.$id_agente.', "'.$cluster_belongs.'")',
|
||||
[
|
||||
'icon' => 'delete',
|
||||
'mode' => 'secondary dialog_opener',
|
||||
@ -1289,10 +1302,18 @@ ui_require_jquery_file('bgiframe');
|
||||
}
|
||||
}
|
||||
|
||||
function deleteAgentDialog($idAgente) {
|
||||
function deleteAgentDialog($idAgente, cluster) {
|
||||
var msg_cluster = '';
|
||||
if(cluster) {
|
||||
msg_cluster = "<?php echo __('This agent belongs to the clusters'); ?>";
|
||||
msg_cluster += ': ';
|
||||
msg_cluster += cluster;
|
||||
msg_cluster += '. ';
|
||||
}
|
||||
|
||||
confirmDialog({
|
||||
title: "<?php echo __('Delete agent'); ?>",
|
||||
message: "<?php echo __('This action is not reversible. Are you sure'); ?>",
|
||||
message: msg_cluster + "<?php echo __('This action is not reversible. Are you sure'); ?>",
|
||||
onAccept: function() {
|
||||
window.location.assign('index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente='+$idAgente);
|
||||
}
|
||||
|
@ -2258,6 +2258,28 @@ if ($update_module || $create_module
|
||||
|| ($module_in_policy && !$module_linked)
|
||||
) {
|
||||
if ($success_action > 0) {
|
||||
if (empty($old_configuration_data) === true
|
||||
&& empty($configuration_data) === true && $disabled === '0'
|
||||
&& ($enable_module || $disable_module)
|
||||
) {
|
||||
$modulo_nombre = io_safe_output(
|
||||
db_get_value(
|
||||
'nombre',
|
||||
'tagente_modulo',
|
||||
'id_agente_modulo',
|
||||
(empty($disable_module) === false) ? $disable_module : $enable_module
|
||||
)
|
||||
);
|
||||
|
||||
$old_configuration_data = config_agents_get_module_from_conf(
|
||||
$id_agente,
|
||||
$modulo_nombre
|
||||
);
|
||||
$configuration_data = $old_configuration_data;
|
||||
|
||||
$disabled = (empty($disable_module) === false) ? true : false;
|
||||
}
|
||||
|
||||
enterprise_hook(
|
||||
'config_agents_write_module_in_conf',
|
||||
[
|
||||
@ -2406,7 +2428,6 @@ if ($disable_module) {
|
||||
$modulo_nombre = io_safe_output($modulo_nombre['nombre']);
|
||||
|
||||
if ($result === NOERR) {
|
||||
enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||
'Disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']
|
||||
|
@ -566,10 +566,10 @@ if ($search != '') {
|
||||
if ($id != '') {
|
||||
$aux = $id[0]['id_agent'];
|
||||
$search_sql = sprintf(
|
||||
' AND ( nombre LIKE "%%%s%%"
|
||||
OR alias LIKE "%%%s%%"
|
||||
OR comentarios LIKE "%%%s%%"
|
||||
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%")
|
||||
' AND ( REPLACE(nombre, " ", " ") LIKE "%%%s%%"
|
||||
OR REPLACE(alias, " ", " ") LIKE "%%%s%%"
|
||||
OR REPLACE(comentarios, " ", " ") LIKE "%%%s%%"
|
||||
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, " ", " ") LIKE "%%%s%%")
|
||||
OR tagente.id_agente = %d',
|
||||
$search,
|
||||
$search,
|
||||
@ -591,10 +591,10 @@ if ($search != '') {
|
||||
$search_sql .= ')';
|
||||
} else {
|
||||
$search_sql = sprintf(
|
||||
' AND ( nombre
|
||||
LIKE "%%%s%%" OR alias
|
||||
LIKE "%%%s%%" OR comentarios LIKE "%%%s%%"
|
||||
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%"))',
|
||||
' AND ( REPLACE(nombre, " ", " ")
|
||||
LIKE "%%%s%%" OR REPLACE(alias, " ", " ")
|
||||
LIKE "%%%s%%" OR REPLACE(comentarios, " ", " ") LIKE "%%%s%%"
|
||||
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, " ", " ") LIKE "%%%s%%"))',
|
||||
$search,
|
||||
$search,
|
||||
$search,
|
||||
@ -958,12 +958,33 @@ if ($agents !== false) {
|
||||
);
|
||||
|
||||
if ($check_aw === true && is_management_allowed() === true) {
|
||||
if ($agent['id_os'] != CLUSTER_OS_ID) {
|
||||
$onClickActionDeleteAgent = 'if (!confirm(\' '.__('Are you sure?').'\')) return false;';
|
||||
} else {
|
||||
$onClickActionDeleteAgent = 'if (!confirm(\' '.__('WARNING! - You are going to delete a cluster agent. Are you sure?').'\')) return false;';
|
||||
$clusters = agents_get_agent_belongs_cluster($agent['id_agente']);
|
||||
$cluster_belongs = '';
|
||||
if (empty($clusters) === false) {
|
||||
$clusters = array_reduce(
|
||||
$clusters,
|
||||
function ($carry, $item) {
|
||||
$carry[] = $item['name'];
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
$cluster_belongs = implode(', ', $clusters);
|
||||
}
|
||||
|
||||
$msg = '';
|
||||
if ($agent['id_os'] == CLUSTER_OS_ID) {
|
||||
$msg .= __('You are going to delete a cluster agent');
|
||||
$msg .= '. ';
|
||||
} else if (empty($cluster_belongs) === false) {
|
||||
$msg .= __('This agent belongs to the clusters');
|
||||
$msg .= ': ';
|
||||
$msg .= $cluster_belongs;
|
||||
$msg .= '. ';
|
||||
}
|
||||
|
||||
$msg .= __('Are you sure?');
|
||||
$onClickActionDeleteAgent = 'if (!confirm(\' '.$msg.'\')) return false;';
|
||||
|
||||
$agentActionButtons[] = html_print_menu_button(
|
||||
[
|
||||
'href' => ui_get_full_url(
|
||||
|
@ -575,7 +575,7 @@ $where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente);
|
||||
$search_string_entities = io_safe_input($search_string);
|
||||
|
||||
$basic_where = sprintf(
|
||||
"(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND",
|
||||
"(REPLACE(nombre, ' ', ' ') LIKE '%%%s%%' OR REPLACE(nombre, ' ', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, ' ', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, ' ', ' ') LIKE '%%%s%%') AND",
|
||||
$search_string,
|
||||
$search_string_entities,
|
||||
$search_string,
|
||||
|
167
pandora_console/godmode/files_repo/files_repo.php
Normal file
@ -0,0 +1,167 @@
|
||||
<?php
|
||||
/**
|
||||
* File repository
|
||||
*
|
||||
* @category Files repository
|
||||
* @package Pandora FMS
|
||||
* @subpackage Enterprise
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2007-2023 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||
* This code is NOT free software. This code is NOT licenced under GPL2 licence
|
||||
* You cannnot redistribute it without written permission of copyright holder.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
// ACL Check.
|
||||
check_login();
|
||||
if (check_acl($config['id_user'], 0, 'PM') === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access to Files repository'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$tab = get_parameter('tab', '');
|
||||
|
||||
$url = 'index.php?sec=extensions&sec2=godmode/files_repo/files_repo';
|
||||
|
||||
// Header tabs.
|
||||
$godmode['text'] = '<a href="'.$url.'&tab=configuration">';
|
||||
$godmode['text'] .= html_print_image(
|
||||
'images/configuration@svg.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('Administration view'),
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
);
|
||||
$godmode['text'] .= '</a>';
|
||||
$godmode['godmode'] = 1;
|
||||
|
||||
$operation['text'] = '<a href="'.$url.'">';
|
||||
$operation['text'] .= html_print_image(
|
||||
'images/see-details@svg.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('Operation view'),
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
);
|
||||
$operation['text'] .= '</a>';
|
||||
$operation['operation'] = 1;
|
||||
|
||||
$operation['active'] = 1;
|
||||
$godmode['active'] = 0;
|
||||
if ($tab === 'configuration') {
|
||||
$godmode['active'] = 1;
|
||||
$operation['active'] = 0;
|
||||
}
|
||||
|
||||
$onheader = [
|
||||
'godmode' => $godmode,
|
||||
'operation' => $operation,
|
||||
];
|
||||
|
||||
// Header.
|
||||
ui_print_standard_header(
|
||||
__('Extensions'),
|
||||
'images/extensions.png',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
$onheader,
|
||||
[
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Tools'),
|
||||
],
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Files repository'),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
require_once __DIR__.'/../../include/functions_files_repository.php';
|
||||
|
||||
// Directory files_repo check.
|
||||
if (files_repo_check_directory() === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$server_content_length = 0;
|
||||
if (isset($_SERVER['CONTENT_LENGTH'])) {
|
||||
$server_content_length = $_SERVER['CONTENT_LENGTH'];
|
||||
}
|
||||
|
||||
// Check for an anoying error that causes the $_POST and $_FILES arrays.
|
||||
// were empty if the file is larger than the post_max_size.
|
||||
if (intval($server_content_length) > 0 && empty($_POST)) {
|
||||
ui_print_error_message(
|
||||
__('Problem uploading. Please check this PHP runtime variable values: <pre> post_max_size (currently '.ini_get('post_max_size').')</pre>')
|
||||
);
|
||||
}
|
||||
|
||||
// GET and POST parameters.
|
||||
$file_id = (int) get_parameter('file_id');
|
||||
$add_file = (bool) get_parameter('add_file');
|
||||
$update_file = (bool) get_parameter('update_file');
|
||||
$delete_file = (bool) get_parameter('delete');
|
||||
|
||||
// File add or update.
|
||||
if ($add_file === true || ($update_file === true && $file_id > 0)) {
|
||||
$groups = get_parameter('groups', []);
|
||||
$public = (bool) get_parameter('public');
|
||||
$description = io_safe_output((string) get_parameter('description'));
|
||||
if (mb_strlen($description, 'UTF-8') > 200) {
|
||||
$description = mb_substr($description, 0, 200, 'UTF-8');
|
||||
}
|
||||
|
||||
$description = io_safe_input($description);
|
||||
|
||||
if ($add_file === true) {
|
||||
$result = files_repo_add_file('upfile', $description, $groups, $public);
|
||||
} else if ($update_file === true) {
|
||||
$result = files_repo_update_file($file_id, $description, $groups, $public);
|
||||
$file_id = 0;
|
||||
}
|
||||
|
||||
if ($result['status'] == false) {
|
||||
ui_print_error_message($result['message']);
|
||||
} else {
|
||||
if ($add_file === true) {
|
||||
ui_print_success_message(__('Successfully created'));
|
||||
} else if ($update_file === true) {
|
||||
ui_print_success_message(__('Successfully updated'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// File delete.
|
||||
if ($delete_file === true && $file_id > 0) {
|
||||
$result = files_repo_delete_file($file_id);
|
||||
if ($result !== -1) {
|
||||
ui_print_result_message($result, __('Successfully deleted'), __('Could not be deleted'));
|
||||
}
|
||||
|
||||
$file_id = 0;
|
||||
}
|
||||
|
||||
$operation['active'] = 1;
|
||||
if ($tab === 'configuration') {
|
||||
include_once __DIR__.'/files_repo_form.php';
|
||||
} else {
|
||||
include_once __DIR__.'/files_repo_list.php';
|
||||
}
|
@ -1,20 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* File repository Form
|
||||
*
|
||||
* @category Files repository
|
||||
* @package Pandora FMS
|
||||
* @subpackage Enterprise
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2007-2023 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||
* This code is NOT free software. This code is NOT licenced under GPL2 licence
|
||||
* You cannnot redistribute it without written permission of copyright holder.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - https://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2023 Pandora FMS
|
||||
// Please see https://pandorafms.com/community/ for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
$full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/';
|
||||
require_once $full_extensions_dir.'files_repo/functions_files_repo.php';
|
||||
|
||||
$file = [];
|
||||
$file['name'] = '';
|
||||
@ -117,6 +124,10 @@ if ($file_id > 0) {
|
||||
'file_id',
|
||||
$file_id,
|
||||
true
|
||||
).html_print_input_hidden(
|
||||
'update_file',
|
||||
1,
|
||||
true
|
||||
)
|
||||
);
|
||||
} else {
|
||||
@ -150,8 +161,8 @@ if ($file_id > 0) {
|
||||
|
||||
$table->data[] = $row;
|
||||
|
||||
$url = ui_get_full_url('index.php?sec=godmode/extensions&sec2=extensions/files_repo');
|
||||
echo "<form method='post' action='$url' enctype='multipart/form-data'>";
|
||||
$url = ui_get_full_url('index.php?sec=extensions&sec2=godmode/files_repo/files_repo');
|
||||
echo '<form method="post" action="'.$url.'" enctype="multipart/form-data">';
|
||||
html_print_table($table);
|
||||
html_print_action_buttons($submit_button);
|
||||
echo '</form>';
|
@ -1,54 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Get public file repository.
|
||||
*
|
||||
* @category Files repository
|
||||
* @package Pandora FMS
|
||||
* @subpackage Enterprise
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2007-2023 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||
* This code is NOT free software. This code is NOT licenced under GPL2 licence
|
||||
* You cannnot redistribute it without written permission of copyright holder.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - https://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2023 Pandora FMS
|
||||
// Please see https://pandorafms.com/community/ for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
require_once '../../include/config.php';
|
||||
|
||||
$file_hash = (string) get_parameter('file');
|
||||
|
||||
// Only allow 1 parameter in the request
|
||||
// Only allow 1 parameter in the request.
|
||||
$check_request = (count($_REQUEST) === 1) ? true : false;
|
||||
$check_get = (count($_GET) === 1) ? true : false;
|
||||
$check_post = (count($_POST) === 0) ? true : false;
|
||||
// Only allow the parameter 'file'
|
||||
$check_parameter = (!empty($file_hash)) ? true : false;
|
||||
|
||||
// Only allow the parameter 'file'.
|
||||
$check_parameter = (empty($file_hash) === false) ? true : false;
|
||||
$check_string = (preg_match('/^[0-9a-zA-Z]{8}$/', $file_hash) === 1) ? true : false;
|
||||
|
||||
$checks = ($check_request && $check_get && $check_post && $check_parameter && $check_string);
|
||||
if (!$checks) {
|
||||
throw_error(15);
|
||||
// ERROR
|
||||
}
|
||||
|
||||
// Get the db file row
|
||||
// Get the db file row.
|
||||
$file = db_get_row_filter('tfiles_repo', ['hash' => $file_hash]);
|
||||
if (!$file) {
|
||||
throw_error(10);
|
||||
// ERROR
|
||||
}
|
||||
|
||||
// Case sensitive check
|
||||
// Case sensitive check.
|
||||
$check_hash = ($file['hash'] == $file_hash) ? true : false;
|
||||
if (!$check_hash) {
|
||||
throw_error(10);
|
||||
// ERROR
|
||||
}
|
||||
|
||||
// Get the location
|
||||
// Get the location.
|
||||
$files_repo_path = io_safe_output($config['attachment_store']).'/files_repo';
|
||||
$location = $files_repo_path.'/'.$file['id'].'_'.$file['name'];
|
||||
if (!file_exists($location) || !is_readable($location) || !is_file($location)) {
|
||||
throw_error(5);
|
||||
// ERROR
|
||||
}
|
||||
|
||||
// All checks are fine. Download the file!
|
||||
@ -58,6 +64,13 @@ header('Content-Disposition: attachment; filename="'.$file['name'].'"');
|
||||
readfile($location);
|
||||
|
||||
|
||||
/**
|
||||
* Show errors
|
||||
*
|
||||
* @param integer $time Sleep.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function throw_error($time=15)
|
||||
{
|
||||
sleep($time);
|
157
pandora_console/godmode/files_repo/files_repo_list.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* File repository List
|
||||
*
|
||||
* @category Files repository
|
||||
* @package Pandora FMS
|
||||
* @subpackage Enterprise
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2007-2023 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||
* This code is NOT free software. This code is NOT licenced under GPL2 licence
|
||||
* You cannnot redistribute it without written permission of copyright holder.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
$offset = (int) get_parameter('offset');
|
||||
$filter = [];
|
||||
$filter['limit'] = $config['block_size'];
|
||||
$filter['offset'] = $offset;
|
||||
$filter['order'] = [
|
||||
'field' => 'id',
|
||||
'order' => 'DESC',
|
||||
];
|
||||
|
||||
$files = files_repo_get_files($filter);
|
||||
|
||||
if (empty($files) === false) {
|
||||
$url = ui_get_full_url('index.php?sec=extensions&sec2=godmode/files_repo/files_repo');
|
||||
|
||||
$total_files = files_repo_get_files(false, true);
|
||||
ui_pagination($total_files, $url, $offset);
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
$table->style = [];
|
||||
$table->style[1] = 'max-width: 200px;';
|
||||
$table->style[4] = 'text-align: center;';
|
||||
$table->head = [];
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Description');
|
||||
$table->head[2] = __('Size');
|
||||
$table->head[3] = __('Last modification');
|
||||
$table->head[4] = '';
|
||||
$table->data = [];
|
||||
|
||||
foreach ($files as $file_id => $file) {
|
||||
$data = [];
|
||||
// Prepare the filename for the get_file.php script.
|
||||
$document_root = str_replace(
|
||||
'\\',
|
||||
'/',
|
||||
io_safe_output($_SERVER['DOCUMENT_ROOT'])
|
||||
);
|
||||
$file['location'] = str_replace(
|
||||
'\\',
|
||||
'/',
|
||||
io_safe_output($file['location'])
|
||||
);
|
||||
$relative_path = str_replace($document_root, '', $file['location']);
|
||||
$file_name = explode('/', $file['location']);
|
||||
$file_decoded = $file_name[(count($file_name) - 1)];
|
||||
$file_path = base64_encode($file_decoded);
|
||||
$hash = md5($file_path.$config['server_unique_identifier']);
|
||||
$url_get_file = ui_get_full_url(
|
||||
'include/get_file.php?file='.urlencode($file_path).'&hash='.$hash
|
||||
);
|
||||
|
||||
$date_format = (isset($config['date_format']) === true) ? io_safe_output($config['date_format']) : 'F j, Y - H:m';
|
||||
|
||||
$data[0] = '<a href="'.$url_get_file.'" target="_blank">'.$file['name'].'</a>';
|
||||
// Name.
|
||||
$data[1] = ui_print_truncate_text(
|
||||
$file['description'],
|
||||
'description',
|
||||
true,
|
||||
true
|
||||
);
|
||||
// Description.
|
||||
$data[2] = ui_format_filesize($file['size']);
|
||||
// Size.
|
||||
$data[3] = date($date_format, $file['mtime']);
|
||||
// Last modification.
|
||||
// Public URL.
|
||||
$data[4] = '';
|
||||
$table->cellclass[][4] = 'table_action_buttons';
|
||||
if (empty($file['hash']) === false) {
|
||||
$url_get_public_file = ui_get_full_url(
|
||||
'godmode/files_repo/files_repo_get_file.php?file='.$file['hash']
|
||||
);
|
||||
|
||||
$message = __('Copy to clipboard').': Ctrl+C -> Enter';
|
||||
$action = 'window.prompt(\''.$message.'\', \''.$url_get_public_file.'\');';
|
||||
$data[4] .= '<a href="javascript:;" onclick="'.$action.'">';
|
||||
$data[4] .= html_print_image(
|
||||
'images/world.png',
|
||||
true,
|
||||
['title' => __('Public link')]
|
||||
);
|
||||
// Public link image.
|
||||
$data[4] .= '</a> ';
|
||||
}
|
||||
|
||||
$data[4] .= '<a href="'.$url_get_file.'" target="_blank">';
|
||||
$data[4] .= html_print_image(
|
||||
'images/download.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Download'),
|
||||
'style' => 'padding:3px',
|
||||
]
|
||||
);
|
||||
// Download image.
|
||||
$data[4] .= '</a>';
|
||||
|
||||
$config_url = $url.'&tab=configuration&file_id='.$file_id;
|
||||
$data[4] .= '<a href="'.$config_url.'">';
|
||||
$data[4] .= html_print_image(
|
||||
'images/edit.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('Edit'),
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
);
|
||||
// Edit image.
|
||||
$data[4] .= '</a>';
|
||||
|
||||
$delete_url = $url.'&delete=1&file_id='.$file_id;
|
||||
$data[4] .= '<a href="'.$delete_url.'" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
|
||||
$data[4] .= html_print_image(
|
||||
'images/delete.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('Delete'),
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
);
|
||||
// Delete image.
|
||||
$data[4] .= '</a>';
|
||||
|
||||
$table->data[] = $data;
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
} else {
|
||||
ui_print_info_message(__('No items'));
|
||||
}
|
@ -243,10 +243,15 @@ switch ($action) {
|
||||
$map_default_altitude = get_parameter('map_default_altitude');
|
||||
$map_group_id = get_parameter('map_group_id');
|
||||
$map_levels_zoom = get_parameter('map_levels_zoom', 16);
|
||||
|
||||
$map_connection_list_temp = explode(',', get_parameter('map_connection_list'));
|
||||
$map_connection_list_temp_string = implode(',', $map_connection_list_temp);
|
||||
if (strlen($map_connection_list_temp_string) > 0) {
|
||||
$where_map_connection = ' WHERE id_tmap_connection IN('.$map_connection_list_temp_string.')';
|
||||
} else {
|
||||
$where_map_connection = '';
|
||||
}
|
||||
|
||||
$listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection');
|
||||
$listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection'.$where_map_connection);
|
||||
|
||||
foreach ($map_connection_list_temp as $index => $value) {
|
||||
$cleanValue = trim($value);
|
||||
@ -256,7 +261,6 @@ switch ($action) {
|
||||
}
|
||||
|
||||
$map_connection_default = get_parameter('map_connection_default');
|
||||
|
||||
$map_connection_list = [];
|
||||
foreach ($listConnectionTemp as $idMapConnection) {
|
||||
$default = 0;
|
||||
@ -345,7 +349,7 @@ function deleteConnectionMap(idConnectionMap) {
|
||||
|
||||
checked = $("#radiobtn0001", $("#map_connection_" + idConnectionMap)).attr('checked');
|
||||
$("#map_connection_" + idConnectionMap).remove();
|
||||
|
||||
|
||||
if (checked) {
|
||||
//Checked first, but not is index = 0 maybe.
|
||||
|
||||
@ -485,7 +489,7 @@ foreach ($listConnectionTemp as $connectionTemp) {
|
||||
$table->data[1][0] = __('Add Map connection').$iconError;
|
||||
$table->data[1][1] = "<table class='no-class' border='0' id='map_connection'>
|
||||
<tr>
|
||||
<td>".html_print_select($listConnection, 'map_connection_list', '', '', '', '0', true)."
|
||||
<td>".html_print_select($listConnection, 'select-map_connection_list', '', '', '', '0', true)."
|
||||
</td>
|
||||
<td >
|
||||
<a href='javascript: addConnectionMap();'>".html_print_image(
|
||||
|
@ -154,7 +154,7 @@ if ($is_management_allowed === true && $update_group === true) {
|
||||
$subcheck = db_get_value('name', 'tmodule_group', 'id_mg', $id_group);
|
||||
|
||||
if ($name) {
|
||||
if (!$check || $subcheck == $name) {
|
||||
if ($check === false || strcasecmp($subcheck, $name) === 0) {
|
||||
$result = db_process_sql_update(
|
||||
'tmodule_group',
|
||||
['name' => $name],
|
||||
|
@ -111,7 +111,8 @@ if ($delete) {
|
||||
$alerts_agent_modules = [];
|
||||
foreach ($agent_alerts['simple'] as $agent_alert) {
|
||||
if ((in_array($agent_alert['id_alert_template'], $id_alert_templates)) && (in_array($agent_alert['id_agent_module'], $modules_id))) {
|
||||
$alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module($agent_alert['id_agent_module'], true, false, 'id'));
|
||||
// $alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module($agent_alert['id_agent_module'], true, false, 'id'));
|
||||
$alerts_agent_modules[] = $agent_alert['id'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +127,7 @@ if ($delete) {
|
||||
$agent_module_actions = [];
|
||||
|
||||
foreach ($alerts_agent_modules as $alert_agent_module) {
|
||||
$agent_module_actions = alerts_get_alert_agent_module_actions($alert_agent_module['id'], ['id', 'id_alert_action']);
|
||||
$agent_module_actions = alerts_get_alert_agent_module_actions($alert_agent_module, ['id', 'id_alert_action']);
|
||||
|
||||
foreach ($agent_module_actions as $agent_module_action) {
|
||||
foreach ($actions as $action) {
|
||||
|
@ -478,8 +478,8 @@ if ($access_console_node === true) {
|
||||
}
|
||||
}
|
||||
|
||||
$sub2['godmode/setup/setup§ion=ehorus']['text'] = __('Pandora RC');
|
||||
$sub2['godmode/setup/setup§ion=ehorus']['refr'] = 0;
|
||||
$sub2['godmode/setup/setup§ion=pandorarc']['text'] = __('Pandora RC');
|
||||
$sub2['godmode/setup/setup§ion=pandorarc']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup§ion=ITSM']['text'] = __('ITSM');
|
||||
$sub2['godmode/setup/setup§ion=ITSM']['refr'] = 0;
|
||||
@ -511,6 +511,8 @@ if ($access_console_node === true) {
|
||||
|
||||
enterprise_hook('skins_submenu');
|
||||
|
||||
enterprise_hook('translate_string_submenu');
|
||||
|
||||
$menu_godmode['gsetup']['sub'] = $sub;
|
||||
}
|
||||
}
|
||||
@ -578,12 +580,13 @@ if ($access_console_node === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$extmenu = [];
|
||||
if ($extension['godmode_menu']['name'] !== __('DB Schema check') && $extension['godmode_menu']['name'] !== __('DB interface')) {
|
||||
$extmenu = $extension['godmode_menu'];
|
||||
}
|
||||
|
||||
// Check the ACL for this user.
|
||||
if ((bool) check_acl($config['id_user'], 0, $extmenu['acl']) === false) {
|
||||
if ((bool) check_acl($config['id_user'], 0, ($extmenu['acl'] ?? '')) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -713,15 +716,25 @@ if ($access_console_node === true) {
|
||||
}
|
||||
|
||||
if ($access_console_node === true) {
|
||||
// Tools
|
||||
// Tools.
|
||||
$menu_godmode['tools']['text'] = __('Tools');
|
||||
$menu_godmode['tools']['sec2'] = 'operation/extensions';
|
||||
$menu_godmode['tools']['id'] = 'oper-extensions';
|
||||
$sub = [];
|
||||
$sub['operation/agentes/exportdata']['text'] = __('Export data');
|
||||
$sub['operation/agentes/exportdata']['id'] = 'export_data';
|
||||
$sub['extensions/files_repo']['text'] = __('File repository');
|
||||
$sub['extensions/files_repo']['id'] = 'file_repository';
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'RR')
|
||||
|| check_acl($config['id_user'], 0, 'RW')
|
||||
|| check_acl($config['id_user'], 0, 'RM')
|
||||
) {
|
||||
$sub['operation/agentes/exportdata']['text'] = __('Export data');
|
||||
$sub['operation/agentes/exportdata']['id'] = 'export_data';
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$sub['godmode/files_repo/files_repo']['text'] = __('File repository');
|
||||
$sub['godmode/files_repo/files_repo']['id'] = 'file_repository';
|
||||
}
|
||||
|
||||
$menu_godmode['tools']['sub'] = $sub;
|
||||
|
||||
// About.
|
||||
@ -735,7 +748,7 @@ if ((bool) $config['pure'] === false) {
|
||||
|
||||
echo '<div id="about-div"></div>';
|
||||
// Need to be here because the translate string.
|
||||
if (check_acl($config['id_user'], $group, 'AW')) {
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$("#conf_wizard").click(function() {
|
||||
|
@ -729,7 +729,7 @@ if ($search_id_group) {
|
||||
}
|
||||
|
||||
if ($search_string != '') {
|
||||
$filter[] = '(name LIKE '."'%".$search_string."%'".'OR description LIKE '."'%".$search_string."%'".'OR tcp_send LIKE '."'%".$search_string."%'".'OR tcp_rcv LIKE '."'%".$search_string."%'".')';
|
||||
$filter[] = '(REPLACE(name, " ", " ") LIKE '."'%".$search_string."%'".' OR REPLACE(REPLACE(description, " ", " "), " ", " ")LIKE '."'%".$search_string."%'".' OR REPLACE(tcp_send, " ", " ") LIKE '."'%".$search_string."%'".'OR REPLACE(tcp_rcv, " ", " ") LIKE '."'%".$search_string."%'".')';
|
||||
}
|
||||
|
||||
$total_components = network_components_get_network_components(
|
||||
|
@ -117,6 +117,8 @@ $exception_condition = REPORT_EXCEPTION_CONDITION_EVERYTHING;
|
||||
$exception_condition_value = 10;
|
||||
$modulegroup = 0;
|
||||
$period = SECONDS_1DAY;
|
||||
$period_time_service_level = '28800';
|
||||
$show_agents = false;
|
||||
$search = '';
|
||||
$full_text = 0;
|
||||
$log_number = 1000;
|
||||
@ -882,6 +884,28 @@ switch ($action) {
|
||||
$idAgentModule = $module;
|
||||
break;
|
||||
|
||||
case 'service_level':
|
||||
$description = $item['description'];
|
||||
$es = json_decode($item['external_source'], true);
|
||||
$period_time_service_level = $es['period_time_service_level'];
|
||||
$show_agents = $es['show_agents'];
|
||||
// Decode agents and modules.
|
||||
$id_agents = json_decode(
|
||||
io_safe_output(base64_decode($es['id_agents'])),
|
||||
true
|
||||
);
|
||||
$module = json_decode(
|
||||
io_safe_output(base64_decode($es['module'])),
|
||||
true
|
||||
);
|
||||
|
||||
$recursion = $item['recursion'];
|
||||
|
||||
$group = $item['id_group'];
|
||||
$modulegroup = $item['id_module_group'];
|
||||
$idAgentModule = $module;
|
||||
break;
|
||||
|
||||
case 'end_of_life':
|
||||
$es = json_decode($item['external_source'], true);
|
||||
|
||||
@ -1038,7 +1062,13 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'ncm':
|
||||
$idAgent = $item['id_agent'];
|
||||
$id_agent_ncm = json_decode($item['ncm_agents']);
|
||||
$ncm_group = $item['id_group'];
|
||||
break;
|
||||
|
||||
case 'ncm_backups':
|
||||
$id_agent_ncm = json_decode($item['ncm_agents']);
|
||||
$ncm_group = $item['id_group'];
|
||||
break;
|
||||
|
||||
case 'top_n_agents_sh':
|
||||
@ -1146,6 +1176,7 @@ switch ($action) {
|
||||
case 'sumatory':
|
||||
case 'database_serialized':
|
||||
case 'last_value':
|
||||
case 'service_level':
|
||||
case 'monitor_report':
|
||||
case 'min_value':
|
||||
case 'max_value':
|
||||
@ -1642,7 +1673,7 @@ if (is_metaconsole() === true) {
|
||||
10,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
@ -1656,6 +1687,53 @@ if (is_metaconsole() === true) {
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_period_service_level" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Time lapse');
|
||||
ui_print_help_tip(
|
||||
__('This is the range, or period of time over which the report renders the information for this report type. For example, a week means data from a week ago from now. ')
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
<td >
|
||||
<?php
|
||||
$fields_time_service_level = [
|
||||
'604800' => __('1 week'),
|
||||
'172800' => __('48 hours'),
|
||||
'86400' => __('24 hours'),
|
||||
'43200' => __('12 hours'),
|
||||
'28800' => __('8 hours'),
|
||||
|
||||
];
|
||||
html_print_select(
|
||||
$fields_time_service_level,
|
||||
'period_time_service_level',
|
||||
$period_time_service_level,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_show_agents" class="datos">
|
||||
<td class="bolder" class="datos">
|
||||
<?php
|
||||
echo __('Show agents');
|
||||
?>
|
||||
</td>
|
||||
<td >
|
||||
<?php
|
||||
html_print_checkbox_switch(
|
||||
'show_agents',
|
||||
'1',
|
||||
$show_agents,
|
||||
false,
|
||||
false,
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_period_range" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
@ -1676,7 +1754,7 @@ if (is_metaconsole() === true) {
|
||||
10,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
@ -1730,7 +1808,7 @@ if (is_metaconsole() === true) {
|
||||
10,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
@ -1755,7 +1833,7 @@ if (is_metaconsole() === true) {
|
||||
<td >
|
||||
<?php
|
||||
html_print_extended_select_for_time(
|
||||
'period',
|
||||
'period3',
|
||||
(string) $period,
|
||||
'onselect=loadLogAgents();',
|
||||
'',
|
||||
@ -1793,7 +1871,7 @@ if (is_metaconsole() === true) {
|
||||
10,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
@ -2007,6 +2085,71 @@ if (is_metaconsole() === true) {
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row_ncm_group" class="datos">
|
||||
<td class="bolder"><?php echo __('Group NCM'); ?></td>
|
||||
<td >
|
||||
<?php
|
||||
echo '<div class="w250px inline padding-right-2-imp">';
|
||||
$url = ui_get_full_url('ajax.php');
|
||||
html_print_input_hidden('url_ajax', $url, false, false, false, 'url_ajax');
|
||||
if (check_acl($config['id_user'], 0, 'RW')) {
|
||||
html_print_select_groups(
|
||||
$config['id_user'],
|
||||
'RW',
|
||||
true,
|
||||
'ncm_group',
|
||||
$ncm_group,
|
||||
'filterNcmAgentChange()',
|
||||
);
|
||||
} else if (check_acl($config['id_user'], 0, 'RM')) {
|
||||
html_print_select_groups(
|
||||
$config['id_user'],
|
||||
'RM',
|
||||
true,
|
||||
'ncm_group',
|
||||
$ncm_group,
|
||||
'filterNcmAgentChange()',
|
||||
);
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row_ncm_agent">
|
||||
<td class="bolder"><?php echo __('Agent NCM'); ?></td>
|
||||
<td >
|
||||
<?php
|
||||
echo '<div class="w250px inline padding-right-2-imp">';
|
||||
$all_agents = agents_get_agents_selected($ncm_group);
|
||||
html_print_select(
|
||||
$all_agents,
|
||||
'agent_ncm[]',
|
||||
$id_agent_ncm,
|
||||
'',
|
||||
__('Any'),
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 100%;',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
);
|
||||
echo '</div>';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row_source" class="datos">
|
||||
<td class="bolder"><?php echo __('Source'); ?></td>
|
||||
<td >
|
||||
@ -2263,7 +2406,7 @@ if (is_metaconsole() === true) {
|
||||
$modulegroup,
|
||||
$id_agents,
|
||||
!$selection_a_m,
|
||||
false
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -5862,8 +6005,13 @@ $(document).ready (function () {
|
||||
switch (type){
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
case 'service_level':
|
||||
case 'alert_report_actions':
|
||||
var agents_multiple = $('#id_agents2').val();
|
||||
if (agents_multiple.length == 0) {
|
||||
dialog_message('#message_no_agent');
|
||||
return false;
|
||||
}
|
||||
var modules_multiple = $('#module').val();
|
||||
$('#hidden-id_agents2-multiple-text').val(JSON.stringify(agents_multiple));
|
||||
$('#hidden-module-multiple-text').val(JSON.stringify(modules_multiple));
|
||||
@ -5889,6 +6037,7 @@ $(document).ready (function () {
|
||||
case 'agent_configuration':
|
||||
case 'module_histogram_graph':
|
||||
case 'increment':
|
||||
case 'service_level':
|
||||
if ($("#hidden-id_agent").val() == 0) {
|
||||
dialog_message('#message_no_agent');
|
||||
return false;
|
||||
@ -6049,8 +6198,13 @@ $(document).ready (function () {
|
||||
switch (type){
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
case 'service_level':
|
||||
case 'alert_report_actions':
|
||||
var agents_multiple = $('#id_agents2').val();
|
||||
if (agents_multiple.length == 0) {
|
||||
dialog_message('#message_no_agent');
|
||||
return false;
|
||||
}
|
||||
var modules_multiple = $('#module').val();
|
||||
$('#hidden-id_agents2-multiple-text').val(JSON.stringify(agents_multiple));
|
||||
$('#hidden-module-multiple-text').val(JSON.stringify(modules_multiple));
|
||||
@ -6076,6 +6230,7 @@ $(document).ready (function () {
|
||||
case 'agent_configuration':
|
||||
case 'module_histogram_graph':
|
||||
case 'increment':
|
||||
case 'service_level':
|
||||
if ($("#hidden-id_agent").val() == 0) {
|
||||
dialog_message('#message_no_agent');
|
||||
return false;
|
||||
@ -7030,7 +7185,7 @@ function loadLogAgents() {
|
||||
params["get_agent_source"] = 1;
|
||||
params["log_alert"] = 1;
|
||||
params["page"] = "enterprise/include/ajax/log_viewer.ajax";
|
||||
params["date"] = $('#period_select').val();
|
||||
params["date"] = $('#period3_select').val();
|
||||
jQuery.ajax({
|
||||
data: params,
|
||||
dataType: "json",
|
||||
@ -7071,6 +7226,9 @@ function chooseType() {
|
||||
$("#row_agent").hide();
|
||||
$("#row_module").hide();
|
||||
$("#row_search").hide();
|
||||
$("#row_period").hide();
|
||||
$("#row_period_service_level").hide();
|
||||
$("#row_show_agents").hide();
|
||||
$("#row_log_number").hide();
|
||||
$("#row_period1").hide();
|
||||
$("#row_period2").hide();
|
||||
@ -7218,6 +7376,10 @@ function chooseType() {
|
||||
|
||||
$('#agent_autocomplete_events').show();
|
||||
|
||||
// NCM fields.
|
||||
$("#row_ncm_group").hide();
|
||||
$("#row_ncm_agent").hide();
|
||||
|
||||
switch (type) {
|
||||
case 'event_report_group':
|
||||
$("#row_description").show();
|
||||
@ -7767,6 +7929,22 @@ function chooseType() {
|
||||
}
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'service_level':
|
||||
$("#row_period_service_level").show();
|
||||
$("#row_show_agents").show();
|
||||
$("#row_description").show();
|
||||
$("#row_group").show();
|
||||
$("#select_agent_modules").show();
|
||||
$("#agents_modules_row").show();
|
||||
$("#modules_row").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
loadGeneralAgents();
|
||||
$("#combo_group").change(function() {
|
||||
loadGeneralAgents($(this).val());
|
||||
});
|
||||
$("#row_module_group").show();
|
||||
break;
|
||||
|
||||
case 'agent_module':
|
||||
$("#row_module_group").show();
|
||||
@ -8065,7 +8243,13 @@ function chooseType() {
|
||||
break;
|
||||
|
||||
case 'ncm':
|
||||
$("#row_agent").show();
|
||||
$("#row_ncm_group").show();
|
||||
$("#row_ncm_agent").show();
|
||||
break;
|
||||
|
||||
case 'ncm_backups':
|
||||
$("#row_ncm_group").show();
|
||||
$("#row_ncm_agent").show();
|
||||
break;
|
||||
|
||||
case 'top_n_agents_sh':
|
||||
@ -8448,4 +8632,43 @@ $(document).ready(function () {
|
||||
});
|
||||
});
|
||||
|
||||
// Ncm agent filter by group.
|
||||
function filterNcmAgentChange() {
|
||||
var idGroup = $("#ncm_group").val();
|
||||
const url_ajax = $("#url_ajax").val();
|
||||
|
||||
$.ajax({
|
||||
url: url_ajax,
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: {
|
||||
page: "operation/agentes/ver_agente",
|
||||
get_ncm_agents: 1,
|
||||
id_group: idGroup,
|
||||
privilege: "AW",
|
||||
keys_prefix: "_"
|
||||
},
|
||||
success: function(data) {
|
||||
$("#agent_ncm").empty();
|
||||
var optionAny = $("<option></option>")
|
||||
.attr("value",0)
|
||||
.html("Any");
|
||||
// Add any option.
|
||||
$("#agent_ncm").append(optionAny);
|
||||
|
||||
data.map(item => {
|
||||
var option = $("<option></option>")
|
||||
.attr("value", item.id_agent)
|
||||
.html(item.alias);
|
||||
// Add agents options.
|
||||
$("#agent_ncm").append(option);
|
||||
});
|
||||
},
|
||||
error: function(err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -1643,7 +1643,7 @@ switch ($action) {
|
||||
$es['log_number'] = $log_number;
|
||||
|
||||
$values['external_source'] = json_encode($es);
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['period'] = get_parameter('period3');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
@ -1661,7 +1661,7 @@ switch ($action) {
|
||||
$es['log_number'] = $log_number;
|
||||
|
||||
$values['external_source'] = json_encode($es);
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['period'] = get_parameter('period3');
|
||||
$values['period_range'] = get_parameter('period_range');
|
||||
$values['show_graph'] = get_parameter('combo_graph_options');
|
||||
$values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent');
|
||||
@ -1730,10 +1730,20 @@ switch ($action) {
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'service_level':
|
||||
$es['period_time_service_level'] = get_parameter('period_time_service_level', '28800');
|
||||
$es['show_agents'] = get_parameter('show_agents', false);
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
$agents_to_report_text = get_parameter('id_agents2-multiple-text', '');
|
||||
if ($agents_to_report_text === '' || $agents_to_report_text === 'null') {
|
||||
$agents_to_report_text = io_safe_input(json_encode(get_parameter('id_agents2', '')));
|
||||
}
|
||||
|
||||
$modules_to_report_text = get_parameter('module-multiple-text', '');
|
||||
if ($modules_to_report_text === '' || $modules_to_report_text === 'null') {
|
||||
$modules_to_report_text = io_safe_input(json_encode(get_parameter('module', '')));
|
||||
}
|
||||
|
||||
// Decode json check modules.
|
||||
$agents_to_report = json_decode(
|
||||
@ -1745,11 +1755,16 @@ switch ($action) {
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
$es['module'] = get_same_modules_all(
|
||||
$agents_to_report,
|
||||
$modules_to_report
|
||||
);
|
||||
|
||||
if ((bool) is_metaconsole() === true) {
|
||||
$es['module'] = $modules_to_report;
|
||||
}
|
||||
|
||||
// Encode json modules and agents.
|
||||
$es['module'] = base64_encode(json_encode($es['module']));
|
||||
$es['id_agents'] = base64_encode(json_encode($agents_to_report));
|
||||
@ -2046,6 +2061,20 @@ switch ($action) {
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'ncm_backups':
|
||||
$agents_ncm = get_parameter('agent_ncm');
|
||||
$values['ncm_agents'] = json_encode($agents_ncm);
|
||||
$values['id_group'] = get_parameter('ncm_group');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'ncm':
|
||||
$agents_ncm = get_parameter('agent_ncm');
|
||||
$values['ncm_agents'] = json_encode($agents_ncm);
|
||||
$values['id_group'] = get_parameter('ncm_group');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'vuls_severity_graph':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$good_format = true;
|
||||
@ -2116,7 +2145,10 @@ switch ($action) {
|
||||
break;
|
||||
}
|
||||
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
if (isset($values['id_agent']) === false) {
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
}
|
||||
|
||||
$values['id_gs'] = get_parameter('id_custom_graph');
|
||||
|
||||
$values['id_agent_module'] = '';
|
||||
@ -2232,7 +2264,10 @@ switch ($action) {
|
||||
$values['id_module_group'] = get_parameter(
|
||||
'combo_modulegroup'
|
||||
);
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
|
||||
if (isset($values['id_group']) === false) {
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
}
|
||||
|
||||
if ($values['server_name'] == '') {
|
||||
$values['server_name'] = get_parameter(
|
||||
@ -2755,7 +2790,7 @@ switch ($action) {
|
||||
$es['log_number'] = $log_number;
|
||||
|
||||
$values['external_source'] = json_encode($es);
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['period'] = get_parameter('period3');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
@ -2773,17 +2808,27 @@ switch ($action) {
|
||||
$es['log_number'] = $log_number;
|
||||
|
||||
$values['external_source'] = json_encode($es);
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['period'] = get_parameter('period3');
|
||||
$values['period_range'] = get_parameter('period_range');
|
||||
$values['show_graph'] = get_parameter('combo_graph_options');
|
||||
$values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'service_level':
|
||||
$es['period_time_service_level'] = get_parameter('period_time_service_level', '28800');
|
||||
$es['show_agents'] = get_parameter('show_agents', false);
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
$agents_to_report_text = get_parameter('id_agents2-multiple-text');
|
||||
$agents_to_report_text = get_parameter('id_agents2-multiple-text', '');
|
||||
if ($agents_to_report_text === '' || $agents_to_report_text === 'null') {
|
||||
$agents_to_report_text = io_safe_input(json_encode(get_parameter('id_agents2', '')));
|
||||
}
|
||||
|
||||
$modules_to_report_text = get_parameter('module-multiple-text', '');
|
||||
if ($modules_to_report_text === '' || $modules_to_report_text === 'null') {
|
||||
$modules_to_report_text = io_safe_input(json_encode(get_parameter('module', '')));
|
||||
}
|
||||
|
||||
// Decode json check modules.
|
||||
$agents_to_report = json_decode(
|
||||
@ -2800,11 +2845,14 @@ switch ($action) {
|
||||
$modules_to_report
|
||||
);
|
||||
|
||||
if ((bool) is_metaconsole() === true) {
|
||||
$es['module'] = $modules_to_report;
|
||||
}
|
||||
|
||||
// Encode json modules and agents.
|
||||
$es['module'] = base64_encode(json_encode($es['module']));
|
||||
$es['id_agents'] = base64_encode(json_encode($agents_to_report));
|
||||
$es['show_type'] = get_parameter('show_type', 0);
|
||||
|
||||
$values['external_source'] = json_encode($es);
|
||||
$good_format = true;
|
||||
break;
|
||||
@ -3029,6 +3077,21 @@ switch ($action) {
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'ncm_backups':
|
||||
$agents_ncm = get_parameter('agent_ncm');
|
||||
$values['ncm_agents'] = json_encode($agents_ncm);
|
||||
$values['id_group'] = get_parameter('ncm_group');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'ncm':
|
||||
$agents_ncm = get_parameter('agent_ncm');
|
||||
$values['ncm_agents'] = json_encode($agents_ncm);
|
||||
$values['id_agent'] = get_parameter('agent_ncm');
|
||||
$values['id_group'] = get_parameter('ncm_group');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'vuls_severity_graph':
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$good_format = true;
|
||||
@ -3105,7 +3168,10 @@ switch ($action) {
|
||||
);
|
||||
}
|
||||
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
if (isset($values['id_agent']) === false) {
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
}
|
||||
|
||||
$values['id_gs'] = get_parameter('id_custom_graph');
|
||||
if (($values['type'] == 'alert_report_agent')
|
||||
|| ($values['type'] == 'event_report_agent')
|
||||
@ -3219,7 +3285,9 @@ switch ($action) {
|
||||
$values['id_module_group'] = get_parameter(
|
||||
'combo_modulegroup'
|
||||
);
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
if (isset($values['id_group']) === false) {
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
}
|
||||
|
||||
|
||||
if ((($values['type'] == 'custom_graph')
|
||||
|
@ -539,6 +539,7 @@ foreach ($layoutDatas as $layoutData) {
|
||||
$table->data[($i + 1)][5] .= html_print_checkbox('multiple_delete_items', $idLayoutData, false, true);
|
||||
$table->data[($i + 1)][5] .= '<a href="'.$url_delete.'"onclick="javascript: if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>';
|
||||
$table->data[($i + 1)][5] .= html_print_input_hidden('updated_'.$idLayoutData, '0', true);
|
||||
$table->data[($i + 1)][5] .= html_print_input_hidden('rowtype_'.$idLayoutData, $layoutData['type'], true);
|
||||
|
||||
// Second row
|
||||
$table->data[($i + 2)]['icon'] = '';
|
||||
@ -789,14 +790,6 @@ if ($x > ini_get('max_input_vars')) {
|
||||
|
||||
$pure = get_parameter('pure', 0);
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
echo '<form id="vc_elem_form" method="post" action="index.php?sec=network&sec2=godmode/reporting/visual_console_builder&tab='.$activeTab.'&id_visual_console='.$visualConsole['id'].'">';
|
||||
html_print_input_hidden('action', 'update');
|
||||
} else {
|
||||
echo "<form id='vc_elem_form' method='post' action='index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=0&tab=list_elements&id_visual_console=".$idVisualConsole."'>";
|
||||
html_print_input_hidden('action2', 'update');
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
// Form for multiple delete.
|
||||
@ -806,15 +799,14 @@ if (is_metaconsole() === false) {
|
||||
$url_multiple_delete = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&tab='.$activeTab.'&id_visual_console='.$visualConsole['id'];
|
||||
}
|
||||
|
||||
echo '</form>';
|
||||
|
||||
$buttons = html_print_submit_button(
|
||||
__('Update'),
|
||||
'go',
|
||||
false,
|
||||
[
|
||||
'icon' => 'next',
|
||||
'form' => 'vc_elem_form',
|
||||
'icon' => 'next',
|
||||
'form' => 'vc_elem_form',
|
||||
'onclick' => 'submit_update_json()',
|
||||
],
|
||||
true
|
||||
);
|
||||
@ -976,4 +968,76 @@ ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function submit_update_json() {
|
||||
var array_update = [];
|
||||
$('input[id^=hidden-updated_]').each(function(){
|
||||
var id = $(this).attr('id').split('_')[1];
|
||||
|
||||
var label = $('#hidden-label_'+id).val();
|
||||
var image = $('#image_'+id).val();
|
||||
var width = $('#text-width_'+id).val();
|
||||
var height = $('#text-height_'+id).val();
|
||||
var pos_x = $('#text-left_'+id).val();
|
||||
var pos_y = $('#text-top_'+id).val();
|
||||
var parent = $('#parent_'+id).val();
|
||||
var agent = $('#hidden-agent_'+id).val();
|
||||
var module = $('#module_'+id).val();
|
||||
var period = $('#hidden-period_'+id).val();
|
||||
var map_linked = $('#map_linked_'+id).val();
|
||||
var id_server = $('#id_server_id_'+id).val();
|
||||
var rowtype = $('rowtype_'+id).val();
|
||||
var custom_graph = $('#custom_graph_'+id).val();
|
||||
|
||||
array_update.push({
|
||||
'id': id,
|
||||
'label': label,
|
||||
'image': image,
|
||||
'width': width,
|
||||
'height': height,
|
||||
'pos_x': pos_x,
|
||||
'pos_y': pos_y,
|
||||
'parent': parent,
|
||||
'agent': agent,
|
||||
'module': module,
|
||||
'period': period,
|
||||
'map_linked': map_linked,
|
||||
'rowtype': rowtype,
|
||||
'custom_graph': custom_graph,
|
||||
'id_server': id_server,
|
||||
});
|
||||
});
|
||||
|
||||
var background_width = $('#text-width').val();
|
||||
var background_height = $('#text-height').val();
|
||||
|
||||
if (background_height > 0 && background_width > 0){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: "godmode/reporting/visual_console_builder",
|
||||
action: "update_json",
|
||||
tab: "list_elements",
|
||||
array_update: JSON.stringify(array_update),
|
||||
id_visual_console: "<?php echo (is_metaconsole() === true) ? $idVisualConsole : $visualConsole['id']; ?>",
|
||||
background: $('#background').val(),
|
||||
background_width: $('#text-width').val(),
|
||||
background_height: $('#text-height').val(),
|
||||
},
|
||||
dataType: "json",
|
||||
complete: function (data) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
confirmDialog({
|
||||
title: "<?php echo __('Error.'); ?>",
|
||||
message: "<?php echo __('The width and height property is required and should greater than 0'); ?>",
|
||||
strOKButton: "<?php echo __('Close'); ?>",
|
||||
hideCancelButton: true,
|
||||
size: 300,
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -78,6 +78,7 @@ $action = get_parameterBetweenListValues(
|
||||
'update',
|
||||
'delete',
|
||||
'multiple_delete',
|
||||
'update_json',
|
||||
],
|
||||
'new'
|
||||
);
|
||||
@ -526,6 +527,110 @@ switch ($activeTab) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update_json':
|
||||
// Update background.
|
||||
$background = get_parameter('background');
|
||||
$width = get_parameter('background_width');
|
||||
$height = get_parameter('background_height');
|
||||
|
||||
if ($width == 0 && $height == 0) {
|
||||
$sizeBackground = getimagesize(
|
||||
$config['homedir'].'/images/console/background/'.$background
|
||||
);
|
||||
$width = $sizeBackground[0];
|
||||
$height = $sizeBackground[1];
|
||||
}
|
||||
|
||||
db_process_sql_update(
|
||||
'tlayout',
|
||||
[
|
||||
'background' => $background,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
],
|
||||
['id' => $idVisualConsole]
|
||||
);
|
||||
|
||||
// Return the updated visual console.
|
||||
$visualConsole = db_get_row_filter(
|
||||
'tlayout',
|
||||
['id' => $idVisualConsole]
|
||||
);
|
||||
|
||||
// Update elements in visual map.
|
||||
$idsElements = db_get_all_rows_filter(
|
||||
'tlayout_data',
|
||||
['id_layout' => $idVisualConsole],
|
||||
[
|
||||
'id',
|
||||
'type',
|
||||
]
|
||||
);
|
||||
|
||||
$array_update = json_decode(io_safe_output(get_parameter('array_update')), true);
|
||||
|
||||
if (count($array_update)) {
|
||||
foreach ($array_update as $row) {
|
||||
$id = $row['id'];
|
||||
$values = [];
|
||||
$values['label'] = $row['label'];
|
||||
$values['image'] = $row['image'];
|
||||
$values['width'] = $row['width'];
|
||||
$values['height'] = $row['height'];
|
||||
$values['pos_x'] = $row['pos_x'];
|
||||
$values['pos_y'] = $row['pos_y'];
|
||||
|
||||
switch ($row['rowtype']) {
|
||||
case NETWORK_LINK:
|
||||
case LINE_ITEM:
|
||||
continue 2;
|
||||
|
||||
break;
|
||||
|
||||
case SIMPLE_VALUE_MAX:
|
||||
case SIMPLE_VALUE_MIN:
|
||||
case SIMPLE_VALUE_AVG:
|
||||
$values['period'] = $row['period'];
|
||||
break;
|
||||
|
||||
case MODULE_GRAPH:
|
||||
$values['period'] = $row['period'];
|
||||
unset($values['image']);
|
||||
break;
|
||||
|
||||
case GROUP_ITEM:
|
||||
$values['id_group'] = $row['group'];
|
||||
break;
|
||||
|
||||
case CIRCULAR_PROGRESS_BAR:
|
||||
case CIRCULAR_INTERIOR_PROGRESS_BAR:
|
||||
case PERCENTILE_BUBBLE:
|
||||
case PERCENTILE_BAR:
|
||||
unset($values['height']);
|
||||
break;
|
||||
}
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
$values['id_metaconsole'] = $row['id_server'];
|
||||
}
|
||||
|
||||
$values['id_agent'] = $row['agent'];
|
||||
$values['id_agente_modulo'] = $row['module'];
|
||||
$values['id_custom_graph'] = $row['custom_graph'];
|
||||
$values['parent_item'] = $row['parent'];
|
||||
$values['id_layout_linked'] = $row['map_linked'];
|
||||
|
||||
if (enterprise_installed()) {
|
||||
enterprise_visual_map_update_action_from_list_elements($row['rowtype'], $values, $id);
|
||||
}
|
||||
|
||||
db_process_sql_update('tlayout_data', $values, ['id' => $id]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$id_element = get_parameter('id_element');
|
||||
$result = db_process_sql_delete('tlayout_data', ['id' => $id_element]);
|
||||
|
@ -184,7 +184,7 @@ $buttons['ITSM'] = [
|
||||
|
||||
$buttons['ehorus'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=ehorus').'">'.html_print_image(
|
||||
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=pandorarc').'">'.html_print_image(
|
||||
'images/RC.png',
|
||||
true,
|
||||
[
|
||||
@ -302,7 +302,7 @@ switch ($section) {
|
||||
$help_header = 'setup_flow_tab';
|
||||
break;
|
||||
|
||||
case 'ehorus':
|
||||
case 'pandorarc':
|
||||
$buttons['ehorus']['active'] = true;
|
||||
$subpage = __('Pandora RC');
|
||||
$help_header = 'setup_ehorus_tab';
|
||||
@ -453,7 +453,7 @@ switch ($section) {
|
||||
include_once $config['homedir'].'/godmode/setup/setup_visuals.php';
|
||||
break;
|
||||
|
||||
case 'ehorus':
|
||||
case 'pandorarc':
|
||||
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
|
||||
break;
|
||||
|
||||
|
@ -764,6 +764,16 @@ $table->data[$i++][] = html_print_label_input_block(
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[$i][] = html_print_label_input_block(
|
||||
__('Easter eggs'),
|
||||
html_print_checkbox_switch(
|
||||
'eastern_eggs_disabled',
|
||||
1,
|
||||
$config['eastern_eggs_disabled'],
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
echo '<form class="max_floating_element_size" id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general&pure='.$config['pure'].'">';
|
||||
|
||||
@ -896,6 +906,35 @@ echo '<legend>'.__('Mail configuration').'</legend>';
|
||||
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<fieldset class="margin-bottom-10">';
|
||||
echo '<legend>'.__('NCM Configuration').'</legend>';
|
||||
|
||||
$table_ncm_config = new stdClass();
|
||||
$table_ncm_config->width = '100%';
|
||||
$table_ncm_config->class = 'databox filter-table-adv';
|
||||
$table_ncm_config->size = [];
|
||||
$table_ncm_config->size[0] = '50%';
|
||||
$table_ncm_config->data = [];
|
||||
|
||||
$table_ncm_config->data[0][] = html_print_label_input_block(
|
||||
__('FTP server IP').ui_print_help_tip(__('This value will be used by TFTP_SERVER_IP macro in NCM scripts.'), true),
|
||||
html_print_input_text(
|
||||
'tftp_server_ip',
|
||||
$config['tftp_server_ip'],
|
||||
'',
|
||||
false,
|
||||
255,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'w50p'
|
||||
)
|
||||
);
|
||||
|
||||
html_print_table($table_ncm_config);
|
||||
|
||||
echo '</fieldset>';
|
||||
|
||||
html_print_action_buttons(
|
||||
html_print_submit_button(
|
||||
@ -1113,9 +1152,9 @@ $(document).ready (function () {
|
||||
id_imodule = $(value).attr('value');
|
||||
$("select[name='inventory_changes_blacklist[]']")
|
||||
.append(
|
||||
$("<option></option>")
|
||||
$("<option selected='selected'></option>")
|
||||
.val(id_imodule)
|
||||
.html('<i>' + imodule_name + '</i>')
|
||||
.text(imodule_name)
|
||||
);
|
||||
$("#inventory_changes_blacklist_out")
|
||||
.find("option[value='" + id_imodule + "']").remove();
|
||||
@ -1141,7 +1180,7 @@ $(document).ready (function () {
|
||||
.append(
|
||||
$("<option></option>")
|
||||
.val(id_imodule)
|
||||
.html('<i>' + imodule_name + '</i>')
|
||||
.text(imodule_name)
|
||||
);
|
||||
$("#inventory_changes_blacklist")
|
||||
.find("option[value='" + id_imodule + "']").remove();
|
||||
@ -1157,12 +1196,15 @@ $(document).ready (function () {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#inventory_changes_blacklist > option").each(function(key, value) {
|
||||
$(value).prop('selected',true).trigger('change');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$("#submit-update_button").click(function () {
|
||||
$('#inventory_changes_blacklist option').map(function(){
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
$("#inventory_changes_blacklist > option").each(function(key, value) {
|
||||
$(value).prop('selected',true).trigger('change');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -212,6 +212,27 @@ class Applications extends Wizard
|
||||
|
||||
Wizard::printBigButtonsList($wiz_data);
|
||||
|
||||
$not_defined_extensions = $extensions->loadExtensions(true);
|
||||
|
||||
$output = html_print_div(
|
||||
[
|
||||
'class' => 'agent_details_line',
|
||||
'content' => ui_toggle(
|
||||
Wizard::printBigButtonsList($not_defined_extensions, true),
|
||||
'<span class="subsection_header_title">'.__('Not installed').'</span>',
|
||||
'not_defined_apps',
|
||||
'not_defined_apps',
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
'',
|
||||
'box-flat white_table_graph w100p'
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
echo $output;
|
||||
|
||||
echo '<div class="app_mssg"><i>*'.__('All company names used here are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.').'</i></div>';
|
||||
}
|
||||
|
||||
|
@ -232,6 +232,27 @@ class Cloud extends Wizard
|
||||
|
||||
Wizard::printBigButtonsList($wiz_data);
|
||||
|
||||
$not_defined_extensions = $extensions->loadExtensions(true);
|
||||
|
||||
$output = html_print_div(
|
||||
[
|
||||
'class' => 'agent_details_line',
|
||||
'content' => ui_toggle(
|
||||
Wizard::printBigButtonsList($not_defined_extensions, true),
|
||||
'<span class="subsection_header_title">'.__('Not installed').'</span>',
|
||||
'not_defined_apps',
|
||||
'not_defined_apps',
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
'',
|
||||
'box-flat white_table_graph w100p'
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
echo $output;
|
||||
|
||||
echo '<div class="app_mssg"><i>*'.__('All company names used here are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.').'</i></div>';
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,27 @@ class Custom extends Wizard
|
||||
|
||||
Wizard::printBigButtonsList($wiz_data);
|
||||
|
||||
$not_defined_extensions = $extensions->loadExtensions(true);
|
||||
|
||||
$output = html_print_div(
|
||||
[
|
||||
'class' => 'agent_details_line',
|
||||
'content' => ui_toggle(
|
||||
Wizard::printBigButtonsList($not_defined_extensions, true),
|
||||
'<span class="subsection_header_title">'.__('Not installed').'</span>',
|
||||
'not_defined_apps',
|
||||
'not_defined_apps',
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
'',
|
||||
'box-flat white_table_graph w100p'
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
echo $output;
|
||||
|
||||
echo '<div class="app_mssg"><i>*'.__('All company names used here are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.').'</i></div>';
|
||||
return $result;
|
||||
}
|
||||
|
@ -1422,6 +1422,14 @@ class DiscoveryTaskList extends HTML
|
||||
$table->rowid = [];
|
||||
$table->data = [];
|
||||
|
||||
$countErrors = 1;
|
||||
$tableErrors = new StdClasS();
|
||||
$tableErrors->class = 'databox data';
|
||||
$tableErrors->width = '75%';
|
||||
$tableErrors->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;';
|
||||
$tableErrors->rowid = [];
|
||||
$tableErrors->data = [];
|
||||
|
||||
if ($task['review_mode'] == DISCOVERY_RESULTS) {
|
||||
$agents_review = db_get_all_rows_filter(
|
||||
'tdiscovery_tmp_agents',
|
||||
@ -1476,11 +1484,11 @@ class DiscoveryTaskList extends HTML
|
||||
$countSummary = 1;
|
||||
if (is_array($task['stats']) === true && count(array_filter(array_keys($task['stats']), 'is_numeric')) === count($task['stats'])) {
|
||||
foreach ($task['stats'] as $key => $summary) {
|
||||
$table->data[$i][0] = '<b>'.__('Summary').' '.$countSummary.'</b>';
|
||||
$table->data[$i][1] = '';
|
||||
$countSummary++;
|
||||
$i++;
|
||||
if (is_array($summary) === true) {
|
||||
$table->data[$i][0] = '<b>'.__('Summary').' '.$countSummary.'</b>';
|
||||
$table->data[$i][1] = '';
|
||||
$countSummary++;
|
||||
$i++;
|
||||
if (empty($summary['summary']) === true && empty($summary['info']) === true) {
|
||||
$table->data[$i][0] = json_encode($summary, JSON_PRETTY_PRINT);
|
||||
$table->data[$i][1] = '';
|
||||
@ -1517,8 +1525,12 @@ class DiscoveryTaskList extends HTML
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
$table->data[$i][0] = $summary;
|
||||
$table->data[$i][1] = '';
|
||||
$tableErrors->data[$i][0] = '<b>'.__('Error %s', $countErrors).'</b>';
|
||||
$tableErrors->data[$i][1] = '';
|
||||
$i++;
|
||||
$tableErrors->data[$i][0] = $summary;
|
||||
$tableErrors->data[$i][1] = '';
|
||||
$countErrors++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -1560,12 +1572,26 @@ class DiscoveryTaskList extends HTML
|
||||
$table->data[$i++][1] .= '</span>';
|
||||
}
|
||||
} else {
|
||||
$table->data[$i][0] = $task['stats']['summary'];
|
||||
$tableErrors->data[$i][0] = '<b>'.__('Error %s', $countErrors).'</b>';
|
||||
$tableErrors->data[$i][1] = '';
|
||||
$i++;
|
||||
$tableErrors->data[$i][0] = $task['stats']['summary'];
|
||||
$tableErrors->data[$i][1] = '';
|
||||
$countErrors++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$output = '<div class="subtitle"><span>'.__('Summary').'</span></div>';
|
||||
$output .= html_print_table($table, true).'</div>';
|
||||
if (is_array($table->data) === true && count($table->data) > 0) {
|
||||
$output .= html_print_table($table, true);
|
||||
}
|
||||
|
||||
if (is_array($tableErrors->data) === true && count($tableErrors->data) > 0) {
|
||||
$output .= html_print_table($tableErrors, true);
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
@ -697,6 +697,9 @@ class ManageExtensions extends HTML
|
||||
$order,
|
||||
);
|
||||
|
||||
$appsMetadata = self::loadDiscoveryAppsMetadata();
|
||||
$flattenMetadata = array_merge(...array_values($appsMetadata));
|
||||
|
||||
$count = db_get_num_rows($sqlCount);
|
||||
|
||||
foreach ($data as $key => $row) {
|
||||
@ -705,6 +708,15 @@ class ManageExtensions extends HTML
|
||||
$logo = $this->defaultLogo;
|
||||
}
|
||||
|
||||
$metadataImage = $flattenMetadata[$row['short_name']]['image'];
|
||||
|
||||
if (isset($metadataImage) === true
|
||||
&& file_exists($config['homedir'].'/images/discovery/'.$metadataImage) === true
|
||||
&& file_exists($this->path.'/'.$row['short_name'].'/logo.png') === false
|
||||
) {
|
||||
$logo = '/images/discovery/'.$metadataImage;
|
||||
}
|
||||
|
||||
$logo = html_print_image($logo, true, ['style' => 'max-width: 30px; margin-right: 15px;']);
|
||||
$data[$key]['name'] = $logo.io_safe_output($row['name']);
|
||||
$data[$key]['short_name'] = $row['short_name'];
|
||||
@ -1490,4 +1502,55 @@ class ManageExtensions extends HTML
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read metadata CSV from system and store data structure in memory.
|
||||
*
|
||||
* @return array Data structure.
|
||||
*/
|
||||
private static function loadDiscoveryAppsMetadata()
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Open the CSV file for reading.
|
||||
$fileHandle = fopen($config['homedir'].'/extras/discovery/DiscoveryApps.csv', 'r');
|
||||
|
||||
// Check if the file was opened successfully.
|
||||
if ($fileHandle !== false) {
|
||||
$csvData = [];
|
||||
|
||||
// Loop through each line in the CSV file.
|
||||
while (($data = fgetcsv($fileHandle)) !== false) {
|
||||
$csvData[] = explode(';', $data[0]);
|
||||
}
|
||||
|
||||
// Close the file handle.
|
||||
fclose($fileHandle);
|
||||
}
|
||||
|
||||
$groupedArray = [];
|
||||
|
||||
foreach ($csvData as $item) {
|
||||
$key = $item[2];
|
||||
if (isset($groupedArray[$key]) === false) {
|
||||
$groupedArray[$key] = [];
|
||||
}
|
||||
|
||||
$itemShortName = $item[0];
|
||||
unset($item[0]);
|
||||
unset($item[2]);
|
||||
|
||||
$itemIns = [
|
||||
'name' => $item[1],
|
||||
'enterprise' => $item[3],
|
||||
'image' => $item[4],
|
||||
'url' => $item[5],
|
||||
];
|
||||
|
||||
$groupedArray[$key][$itemShortName] = $itemIns;
|
||||
}
|
||||
|
||||
return $groupedArray;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -492,14 +492,43 @@ class Wizard
|
||||
$data['url'] = '#';
|
||||
}
|
||||
|
||||
$cnt_class = 'data_container';
|
||||
$ent_icon = '';
|
||||
$label_class = '';
|
||||
|
||||
if (isset($data['ghost_mode']) === true
|
||||
&& $data['ghost_mode'] === true
|
||||
) {
|
||||
$cnt_class .= ' alpha50';
|
||||
}
|
||||
|
||||
if (isset($data['mark_as_enterprise']) === true
|
||||
&& $data['mark_as_enterprise'] === true
|
||||
) {
|
||||
$ent_icon .= html_print_div(
|
||||
[
|
||||
'class' => 'w20px inline margin-lr-10',
|
||||
'content' => html_print_image(
|
||||
'images/ent_icon.png',
|
||||
true,
|
||||
['class' => 'max-width-100p height_auto_important']
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$label_class = 'inline';
|
||||
}
|
||||
|
||||
?>
|
||||
<li class="discovery">
|
||||
<a href="<?php echo $data['url']; ?>">
|
||||
<div class="data_container">
|
||||
<div class="<?php echo $cnt_class; ?> ">
|
||||
<?php html_print_image($data['icon']); ?>
|
||||
<br><label id="text_wizard">
|
||||
<br><label id="text_wizard" class="<?php echo $label_class; ?>">
|
||||
<?php echo io_safe_output($data['label']); ?>
|
||||
</label>
|
||||
<?php echo $ent_icon; ?>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
@ -514,11 +543,18 @@ class Wizard
|
||||
*
|
||||
* @return void Print the full list.
|
||||
*/
|
||||
public static function printBigButtonsList($list_data)
|
||||
public static function printBigButtonsList($list_data, $return=false)
|
||||
{
|
||||
if ($return === true) {
|
||||
ob_start();
|
||||
}
|
||||
echo '<ul class="bigbuttonlist">';
|
||||
array_map('self::printBigButtonElement', $list_data);
|
||||
echo '</ul>';
|
||||
|
||||
if ($return === true) {
|
||||
return ob_get_clean();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
BIN
pandora_console/images/discovery/pandorafms.aws.ec2.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
pandora_console/images/discovery/pandorafms.aws.rds.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
pandora_console/images/discovery/pandorafms.aws.s3.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
pandora_console/images/discovery/pandorafms.azure.mc.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
pandora_console/images/discovery/pandorafms.db2.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
pandora_console/images/discovery/pandorafms.gcp.ce.png
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
pandora_console/images/discovery/pandorafms.kubernetes.png
Normal file
After Width: | Height: | Size: 239 KiB |
BIN
pandora_console/images/discovery/pandorafms.mongodb.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
pandora_console/images/discovery/pandorafms.mssql.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
pandora_console/images/discovery/pandorafms.mysql.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
pandora_console/images/discovery/pandorafms.oracle.png
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
pandora_console/images/discovery/pandorafms.ovh.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
pandora_console/images/discovery/pandorafms.postgresql.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
pandora_console/images/discovery/pandorafms.proxmox.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
pandora_console/images/discovery/pandorafms.sap.deset.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
pandora_console/images/discovery/pandorafms.vmware.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
pandora_console/images/discovery/pandorafms.vulnscan.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
pandora_console/images/discovery/pandorafms.xenserver.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
7
pandora_console/images/donut.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>donut</title>
|
||||
<g id="donut" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M10,1 C14.9705627,1 19,5.02943725 19,10 C19,14.9705627 14.9705627,19 10,19 C5.02943725,19 1,14.9705627 1,10 C1,5.02943725 5.02943725,1 10,1 Z M10,6 C7.790861,6 6,7.790861 6,10 C6,12.209139 7.790861,14 10,14 C12.209139,14 14,12.209139 14,10 C14,7.790861 12.209139,6 10,6 Z" id="Oval" fill="#484848" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 649 B |
BIN
pandora_console/images/ent_icon.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
pandora_console/images/widgets/service_level.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
@ -652,30 +652,30 @@ if ($get_agent_alerts_datatable === true) {
|
||||
if (is_metaconsole() === true) {
|
||||
include_once $config['homedir'].'/enterprise/meta/include/functions_alerts_meta.php';
|
||||
if ($idAgent !== 0) {
|
||||
$alerts['alerts_simple'] = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter);
|
||||
$alerts['alerts_simple'] = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter, $action_filter);
|
||||
|
||||
$countAlertsSimple = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter);
|
||||
$countAlertsSimple = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter, $action_filter);
|
||||
} else {
|
||||
$id_groups = array_keys(
|
||||
users_get_groups($config['id_user'], 'AR', false)
|
||||
);
|
||||
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, $search_sg);
|
||||
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter, $action_filter, $search_sg);
|
||||
|
||||
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, $search_sg);
|
||||
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter, $action_filter, $search_sg);
|
||||
}
|
||||
} else {
|
||||
if ($idAgent !== 0) {
|
||||
$alerts['alerts_simple'] = agents_get_alerts_simple($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter);
|
||||
$alerts['alerts_simple'] = agents_get_alerts_simple($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter);
|
||||
|
||||
$countAlertsSimple = agents_get_alerts_simple($idAgent, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter);
|
||||
$countAlertsSimple = agents_get_alerts_simple($idAgent, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter);
|
||||
} else {
|
||||
$id_groups = array_keys(
|
||||
users_get_groups($config['id_user'], $access, false)
|
||||
);
|
||||
|
||||
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, false, $search_sg);
|
||||
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter, $action_filter, false, $search_sg);
|
||||
|
||||
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false, $search_sg);
|
||||
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter, $action_filter, false, $search_sg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -756,6 +756,7 @@ if (check_login()) {
|
||||
$access = ($agent_a === true) ? 'AR' : (($agent_w === true) ? 'AW' : 'AR');
|
||||
$id_agent = (int) get_parameter('id_agente');
|
||||
$id_agente = $id_agent;
|
||||
$id_grupo = agents_get_agent_group($id_agent);
|
||||
$show_notinit = (bool) get_parameter('show_notinit');
|
||||
$cluster_list = (int) get_parameter('cluster_list');
|
||||
$sortField = (string) get_parameter('sort_field');
|
||||
|
@ -251,7 +251,7 @@ if ($change_custom_fields_macros_report === true) {
|
||||
}
|
||||
|
||||
if ($get_agents === true) {
|
||||
$agents_id = str_replace('"', '', $agents_id);
|
||||
$agents_id = str_replace('"', '"', $agents_id);
|
||||
|
||||
try {
|
||||
$agents_id = json_decode($agents_id, true);
|
||||
|
@ -189,7 +189,8 @@ if (is_ajax() === true) {
|
||||
$serverID,
|
||||
$childrenMethod,
|
||||
$access,
|
||||
$metaID
|
||||
$metaID,
|
||||
$filter['groupID']
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -118,7 +118,7 @@ class ConfigPEN extends HTML
|
||||
if (is_array($filter)) {
|
||||
if (!empty($filter['free_search'])) {
|
||||
$sql_filters[] = vsprintf(
|
||||
' AND (lower(`manufacturer`) like lower("%%%s%%")
|
||||
' AND (lower(REPLACE(manufacturer, " ", " ")) like lower("%%%s%%")
|
||||
OR pen = "%s") ',
|
||||
array_fill(0, 2, $filter['free_search'])
|
||||
);
|
||||
|
@ -701,6 +701,10 @@ class Diagnostics extends Wizard
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Get version comment DB.
|
||||
$sql_version_comment = 'select @@version_comment as version_comment';
|
||||
$version_comment = db_get_sql($sql_version_comment);
|
||||
|
||||
$result = [
|
||||
'error' => false,
|
||||
'data' => [
|
||||
@ -716,6 +720,14 @@ class Diagnostics extends Wizard
|
||||
'name' => __('DB Schema Build'),
|
||||
'value' => $config['db_scheme_build'],
|
||||
],
|
||||
'dbVersion' => [
|
||||
'name' => __('Engine version'),
|
||||
'value' => $config['dbconnection']->server_info,
|
||||
],
|
||||
'dbVersionComment' => [
|
||||
'name' => __('Version comment'),
|
||||
'value' => $version_comment,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -195,28 +195,200 @@ class ExtensionsDiscovery extends Wizard
|
||||
/**
|
||||
* Return array extensions filtered by section
|
||||
*
|
||||
* @return array Extensions for
|
||||
* @param boolean $not_defined_only Get only those extensions that are defined in the metadata CSV and not in db.
|
||||
*
|
||||
* @return array Extensions
|
||||
*/
|
||||
public function loadExtensions()
|
||||
public function loadExtensions($not_defined_only=false)
|
||||
{
|
||||
global $config;
|
||||
// Check access.
|
||||
check_login();
|
||||
$extensions = [];
|
||||
$rows = $this->getExtensionsApps();
|
||||
foreach ($rows as $key => $extension) {
|
||||
$logo = $this->path.'/'.$extension['short_name'].'/'.$this->icon;
|
||||
if (file_exists($config['homedir'].$logo) === false) {
|
||||
$logo = $this->defaultLogo;
|
||||
|
||||
define('NOT_FOUND_MSG', 1);
|
||||
define('ENTERPRISE_MSG', 2);
|
||||
define('URL_MSG', 3);
|
||||
|
||||
$appsMetadata = self::loadDiscoveryAppsMetadata();
|
||||
$sectionMetadata = $appsMetadata[$this->section];
|
||||
|
||||
$anchor = html_print_anchor(
|
||||
[
|
||||
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert',
|
||||
'content' => __('here'),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
// Print JS required for message management.
|
||||
echo '<script>
|
||||
function showExtensionMsg(msgs, url, title) {
|
||||
var msgs_json = JSON.parse(msgs);
|
||||
|
||||
var url_str = "";
|
||||
if (url != false) {
|
||||
url_str = `<a target="_blank" class="link-important" href="${url}">'.__('here').'</a>`;
|
||||
}
|
||||
|
||||
$extensions[] = [
|
||||
'icon' => $logo,
|
||||
'label' => $extension['name'],
|
||||
'url' => ui_get_full_url(
|
||||
var markup = "<ul class=\'\'>";
|
||||
|
||||
if (msgs_json.includes('.NOT_FOUND_MSG.')) {
|
||||
markup += "<li> '.__('The required files for the application were not found.').'</li>";
|
||||
}
|
||||
|
||||
if (msgs_json.includes('.ENTERPRISE_MSG.')) {
|
||||
markup += "<li> '.__('This discovery application is for Enterprise customers only.').'</li>";
|
||||
}
|
||||
|
||||
if (msgs_json.includes('.URL_MSG.')) {
|
||||
markup += \'<li> '.__('You can download this application from').' \'+url_str+\'.</li>\';
|
||||
}
|
||||
|
||||
markup += "</ul>";
|
||||
|
||||
confirmDialog({
|
||||
title: title,
|
||||
message: markup,
|
||||
hideOkButton: true,
|
||||
ok: "'.__('OK').'",
|
||||
cancel: "'.__('Cancel').'",
|
||||
size: 550,
|
||||
maxHeight: 500
|
||||
});
|
||||
}
|
||||
</script>';
|
||||
|
||||
if ($not_defined_only === true) {
|
||||
// Case: search for those extensions defined in metadata CSV which are not in database.
|
||||
$short_names_list = array_column($rows, 'short_name');
|
||||
|
||||
// Traverse apps in CSV metadata file and set properly those that do not exist in database.
|
||||
foreach ($sectionMetadata as $short_name => $val) {
|
||||
if (in_array($short_name, $short_names_list) === false) {
|
||||
$logo = $this->path.'/'.$short_name.'/'.$val['image'];
|
||||
if (file_exists($config['homedir'].$logo) === false) {
|
||||
$logo = $this->defaultLogo;
|
||||
}
|
||||
|
||||
$error_msgs = [];
|
||||
|
||||
if (isset($val['image']) === true
|
||||
&& file_exists($config['homedir'].'/images/discovery/'.$val['image']) === true
|
||||
&& file_exists($config['homedir'].$this->path.'/'.$short_name.'/'.$val['image']) === false
|
||||
) {
|
||||
$logo = '/images/discovery/'.$val['image'];
|
||||
}
|
||||
|
||||
$url = ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz='.$this->section.'&mode='.$extension['short_name']
|
||||
);
|
||||
|
||||
if (enterprise_installed() === false && ((bool) $val['enterprise'] === true)) {
|
||||
// Display enterprise message if console is open and extension is enterprise.
|
||||
$error_msgs[] = ENTERPRISE_MSG;
|
||||
}
|
||||
|
||||
$url_href = false;
|
||||
if (isset($val['url']) === true
|
||||
&& $val['url'] !== ''
|
||||
) {
|
||||
$url_href = $val['url'];
|
||||
// Display URL message if an URL is defined in the metadata.
|
||||
$error_msgs[] = URL_MSG;
|
||||
}
|
||||
|
||||
if (empty($error_msgs) === false) {
|
||||
$json_errors = json_encode($error_msgs);
|
||||
// Display messages dialog if there are some.
|
||||
$url = 'javascript: showExtensionMsg(\''.$json_errors.'\', \''.$url_href.'\', \''.io_safe_input($val['name']).'\');';
|
||||
}
|
||||
|
||||
$extensions[] = [
|
||||
'icon' => $logo,
|
||||
'label' => io_safe_input($val['name']),
|
||||
'url' => $url,
|
||||
'ghost_mode' => true,
|
||||
'mark_as_enterprise' => (bool) $val['enterprise'],
|
||||
'defined' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($rows as $key => $extension) {
|
||||
$error_msgs = [];
|
||||
|
||||
$logo = $this->path.'/'.$extension['short_name'].'/'.$this->icon;
|
||||
if (file_exists($config['homedir'].$logo) === false) {
|
||||
$logo = $this->defaultLogo;
|
||||
}
|
||||
|
||||
$mark_as_enterprise = false;
|
||||
$ghostMode = false;
|
||||
$url = ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz='.$this->section.'&mode='.$extension['short_name']
|
||||
),
|
||||
];
|
||||
);
|
||||
$url_href = false;
|
||||
|
||||
$iniFileExists = self::iniFileExists($extension['short_name']);
|
||||
|
||||
// Access metadata for current extension.
|
||||
if (isset($sectionMetadata[$extension['short_name']]) === true) {
|
||||
$itemData = $sectionMetadata[$extension['short_name']];
|
||||
|
||||
if (isset($itemData) === true) {
|
||||
if (isset($itemData['image']) === true
|
||||
&& file_exists($config['homedir'].'/images/discovery/'.$itemData['image']) === true
|
||||
&& file_exists($config['homedir'].$this->path.'/'.$extension['short_name'].'/'.$this->icon) === false
|
||||
) {
|
||||
$logo = '/images/discovery/'.$itemData['image'];
|
||||
}
|
||||
|
||||
$mark_as_enterprise = (bool) $itemData['enterprise'];
|
||||
|
||||
if ($iniFileExists === false
|
||||
&& isset($itemData['url']) === true
|
||||
&& $itemData['url'] !== ''
|
||||
) {
|
||||
$url_href = $itemData['url'];
|
||||
// Display URL message if an URL is defined in the metadata.
|
||||
$error_msgs[] = URL_MSG;
|
||||
}
|
||||
|
||||
if (enterprise_installed() === false
|
||||
&& (bool) $itemData['enterprise'] === true
|
||||
) {
|
||||
// Set ghost mode and display enterprise message if console is open and extension is enterprise.
|
||||
$error_msgs[] = ENTERPRISE_MSG;
|
||||
$ghostMode = true;
|
||||
}
|
||||
|
||||
$itemName = $itemData['name'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($iniFileExists === false) {
|
||||
// Set ghost mode and display not found message if ini file does not exist for extension.
|
||||
$error_msgs[] = NOT_FOUND_MSG;
|
||||
$ghostMode = true;
|
||||
}
|
||||
|
||||
if (empty($error_msgs) === false) {
|
||||
$json_errors = json_encode($error_msgs);
|
||||
// Display messages dialog if there are some.
|
||||
$url = 'javascript: showExtensionMsg(\''.$json_errors.'\', \''.$url_href.'\', \''.io_safe_input($itemName).'\');';
|
||||
}
|
||||
|
||||
$extensions[] = [
|
||||
'icon' => $logo,
|
||||
'label' => $extension['name'],
|
||||
'url' => $url,
|
||||
'ghost_mode' => $ghostMode,
|
||||
'mark_as_enterprise' => $mark_as_enterprise,
|
||||
'defined' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $extensions;
|
||||
@ -2553,4 +2725,69 @@ class ExtensionsDiscovery extends Wizard
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read metadata CSV from system and store data structure in memory.
|
||||
*
|
||||
* @return array Data structure.
|
||||
*/
|
||||
private static function loadDiscoveryAppsMetadata()
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Open the CSV file for reading.
|
||||
$fileHandle = fopen($config['homedir'].'/extras/discovery/DiscoveryApps.csv', 'r');
|
||||
|
||||
// Check if the file was opened successfully.
|
||||
if ($fileHandle !== false) {
|
||||
$csvData = [];
|
||||
|
||||
// Loop through each line in the CSV file.
|
||||
while (($data = fgetcsv($fileHandle)) !== false) {
|
||||
$csvData[] = explode(';', $data[0]);
|
||||
}
|
||||
|
||||
// Close the file handle.
|
||||
fclose($fileHandle);
|
||||
}
|
||||
|
||||
$groupedArray = [];
|
||||
|
||||
foreach ($csvData as $item) {
|
||||
$key = $item[2];
|
||||
if (isset($groupedArray[$key]) === false) {
|
||||
$groupedArray[$key] = [];
|
||||
}
|
||||
|
||||
$itemShortName = $item[0];
|
||||
unset($item[0]);
|
||||
unset($item[2]);
|
||||
|
||||
$itemIns = [
|
||||
'name' => $item[1],
|
||||
'enterprise' => $item[3],
|
||||
'image' => $item[4],
|
||||
'url' => $item[5],
|
||||
];
|
||||
|
||||
$groupedArray[$key][$itemShortName] = $itemIns;
|
||||
}
|
||||
|
||||
return $groupedArray;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if ini file exists for extension.
|
||||
*
|
||||
* @param string $shortName Extension short name.
|
||||
*
|
||||
* @return boolean Whether or not ini file exists.
|
||||
*/
|
||||
public static function iniFileExists($shortName)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$path = $config['homedir'].'/attachment/discovery/'.$shortName.'/discovery_definition.ini';
|
||||
return file_exists($path);
|
||||
}
|
||||
}
|
||||
|
@ -549,8 +549,12 @@ class Heatmap
|
||||
global $config;
|
||||
|
||||
$filter_group = '';
|
||||
if (empty($this->filter) === false && current($this->filter) != -1) {
|
||||
if (empty($this->filter) === false && current($this->filter) != -1
|
||||
&& implode(',', $this->filter) !== ''
|
||||
) {
|
||||
$filter_group = 'AND am.id_module_group IN ('.implode(',', $this->filter).')';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
$filter_name = '';
|
||||
|
@ -761,7 +761,7 @@ class TipsWindow
|
||||
);
|
||||
$table->data[1][1] = html_print_label_input_block(
|
||||
__('Url'),
|
||||
html_print_input_text('url', '', '', 35, 100, true)
|
||||
html_print_input_text('url', '', '', 35, 255, true)
|
||||
);
|
||||
$table->data[2][0] = html_print_label_input_block(
|
||||
__('Text'),
|
||||
@ -928,7 +928,7 @@ class TipsWindow
|
||||
);
|
||||
$table->data[1][1] = html_print_label_input_block(
|
||||
__('Url'),
|
||||
html_print_input_text('url', $tip['url'], '', 35, 100, true)
|
||||
html_print_input_text('url', $tip['url'], '', 35, 255, true)
|
||||
);
|
||||
$table->data[2][0] = html_print_label_input_block(
|
||||
__('Text'),
|
||||
|
@ -32,6 +32,8 @@ class Tree
|
||||
|
||||
protected $rootType = null;
|
||||
|
||||
protected $idGroup = null;
|
||||
|
||||
protected $id = -1;
|
||||
|
||||
protected $rootID = -1;
|
||||
@ -87,13 +89,15 @@ class Tree
|
||||
$serverID=false,
|
||||
$childrenMethod='on_demand',
|
||||
$access='AR',
|
||||
$id_meta_server=0
|
||||
$id_meta_server=0,
|
||||
$id_group=0
|
||||
) {
|
||||
$this->type = $type;
|
||||
$this->rootType = !empty($rootType) ? $rootType : $type;
|
||||
$this->id = $id;
|
||||
$this->rootID = !empty($rootID) ? $rootID : $id;
|
||||
$this->serverID = $serverID;
|
||||
$this->idGroup = $id_group;
|
||||
if (is_metaconsole() && $id_meta_server == 0) {
|
||||
$this->serverName = metaconsole_get_server_by_id($serverID);
|
||||
}
|
||||
|