Merge remote-tracking branch 'origin/develop' into ent-9640-agrupacion-de-graficas-en-periodos-de-tiempo
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
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.774-231215
|
Version: 7.0NG.774-231218
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.774-231215"
|
pandora_version="7.0NG.774-231218"
|
||||||
|
|
||||||
echo "Test if you has the tools for to make the packages."
|
echo "Test if you has the tools for to make the packages."
|
||||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||||
|
@ -1039,7 +1039,7 @@ my $Sem = undef;
|
|||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.774';
|
use constant AGENT_VERSION => '7.0NG.774';
|
||||||
use constant AGENT_BUILD => '231215';
|
use constant AGENT_BUILD => '231218';
|
||||||
|
|
||||||
# Agent log default file size maximum and instances
|
# Agent log default file size maximum and instances
|
||||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
%global __os_install_post %{nil}
|
%global __os_install_post %{nil}
|
||||||
%define name pandorafms_agent_linux
|
%define name pandorafms_agent_linux
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231215
|
%define release 231218
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
%define name pandorafms_agent_linux_bin
|
%define name pandorafms_agent_linux_bin
|
||||||
%define source_name pandorafms_agent_linux
|
%define source_name pandorafms_agent_linux
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231215
|
%define release 231218
|
||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, binary version
|
Summary: Pandora FMS Linux agent, binary version
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
%define name pandorafms_agent_linux_bin
|
%define name pandorafms_agent_linux_bin
|
||||||
%define source_name pandorafms_agent_linux
|
%define source_name pandorafms_agent_linux
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231215
|
%define release 231218
|
||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, binary version
|
Summary: Pandora FMS Linux agent, binary version
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
%define name pandorafms_agent_linux_bin
|
%define name pandorafms_agent_linux_bin
|
||||||
%define source_name pandorafms_agent_linux
|
%define source_name pandorafms_agent_linux
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231215
|
%define release 231218
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, binary version
|
Summary: Pandora FMS Linux agent, binary version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
%global __os_install_post %{nil}
|
%global __os_install_post %{nil}
|
||||||
%define name pandorafms_agent_linux
|
%define name pandorafms_agent_linux
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231215
|
%define release 231218
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.774"
|
PI_VERSION="7.0NG.774"
|
||||||
PI_BUILD="231215"
|
PI_BUILD="231218"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
@ -538,3 +538,8 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
|
|||||||
#module_regexp C:\server\logs\xserver.log
|
#module_regexp C:\server\logs\xserver.log
|
||||||
#module_pattern .*
|
#module_pattern .*
|
||||||
#module_end
|
#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
|
Version
|
||||||
{231215}
|
{231218}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("7.0NG.774 Build 231215")
|
#define PANDORA_VERSION ("7.0NG.774 Build 231218")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
@ -11,7 +11,7 @@ BEGIN
|
|||||||
VALUE "LegalCopyright", "Pandora FMS"
|
VALUE "LegalCopyright", "Pandora FMS"
|
||||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||||
VALUE "ProductVersion", "(7.0NG.774(Build 231215))"
|
VALUE "ProductVersion", "(7.0NG.774(Build 231218))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.774-231215
|
Version: 7.0NG.774-231218
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.774-231215"
|
pandora_version="7.0NG.774-231218"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -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;
|
|
@ -1720,4 +1720,19 @@ include/functions_integriaims.php
|
|||||||
include/ajax/integria_incidents.ajax.php
|
include/ajax/integria_incidents.ajax.php
|
||||||
enterprise/operation/log/log_source.php
|
enterprise/operation/log/log_source.php
|
||||||
enterprise/include/class/LogSource.class.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
|
||||||
|
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/
|
|
@ -1,5 +1,34 @@
|
|||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
|
DELETE FROM `tconfig` WHERE `token` LIKE 'translate_string_extension_installed';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `textension_translate_string` (
|
||||||
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`lang` VARCHAR(10) NOT NULL ,
|
||||||
|
`string` TEXT ,
|
||||||
|
`translation` TEXT ,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `lang_index` (`lang`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
|
DELETE FROM `tconfig` WHERE `token` LIKE 'files_repo_installed';
|
||||||
|
|
||||||
|
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=UTF8MB4;
|
||||||
|
|
||||||
|
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=UTF8MB4;
|
||||||
|
|
||||||
ALTER TABLE `tncm_queue`
|
ALTER TABLE `tncm_queue`
|
||||||
ADD COLUMN `id_agent_data` bigint unsigned AFTER `id_script`;
|
ADD COLUMN `id_agent_data` bigint unsigned AFTER `id_script`;
|
||||||
|
|
||||||
|
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
|
<?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;
|
global $config;
|
||||||
|
|
||||||
$full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/';
|
|
||||||
require_once $full_extensions_dir.'files_repo/functions_files_repo.php';
|
|
||||||
|
|
||||||
$file = [];
|
$file = [];
|
||||||
$file['name'] = '';
|
$file['name'] = '';
|
||||||
@ -117,6 +124,10 @@ if ($file_id > 0) {
|
|||||||
'file_id',
|
'file_id',
|
||||||
$file_id,
|
$file_id,
|
||||||
true
|
true
|
||||||
|
).html_print_input_hidden(
|
||||||
|
'update_file',
|
||||||
|
1,
|
||||||
|
true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -150,8 +161,8 @@ if ($file_id > 0) {
|
|||||||
|
|
||||||
$table->data[] = $row;
|
$table->data[] = $row;
|
||||||
|
|
||||||
$url = ui_get_full_url('index.php?sec=godmode/extensions&sec2=extensions/files_repo');
|
$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'>";
|
echo '<form method="post" action="'.$url.'" enctype="multipart/form-data">';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
html_print_action_buttons($submit_button);
|
html_print_action_buttons($submit_button);
|
||||||
echo '</form>';
|
echo '</form>';
|
@ -1,54 +1,60 @@
|
|||||||
<?php
|
<?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';
|
require_once '../../include/config.php';
|
||||||
|
|
||||||
$file_hash = (string) get_parameter('file');
|
$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_request = (count($_REQUEST) === 1) ? true : false;
|
||||||
$check_get = (count($_GET) === 1) ? true : false;
|
$check_get = (count($_GET) === 1) ? true : false;
|
||||||
$check_post = (count($_POST) === 0) ? 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;
|
$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);
|
$checks = ($check_request && $check_get && $check_post && $check_parameter && $check_string);
|
||||||
if (!$checks) {
|
if (!$checks) {
|
||||||
throw_error(15);
|
throw_error(15);
|
||||||
// ERROR
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the db file row
|
// Get the db file row.
|
||||||
$file = db_get_row_filter('tfiles_repo', ['hash' => $file_hash]);
|
$file = db_get_row_filter('tfiles_repo', ['hash' => $file_hash]);
|
||||||
if (!$file) {
|
if (!$file) {
|
||||||
throw_error(10);
|
throw_error(10);
|
||||||
// ERROR
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Case sensitive check
|
// Case sensitive check.
|
||||||
$check_hash = ($file['hash'] == $file_hash) ? true : false;
|
$check_hash = ($file['hash'] == $file_hash) ? true : false;
|
||||||
if (!$check_hash) {
|
if (!$check_hash) {
|
||||||
throw_error(10);
|
throw_error(10);
|
||||||
// ERROR
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the location
|
// Get the location.
|
||||||
$files_repo_path = io_safe_output($config['attachment_store']).'/files_repo';
|
$files_repo_path = io_safe_output($config['attachment_store']).'/files_repo';
|
||||||
$location = $files_repo_path.'/'.$file['id'].'_'.$file['name'];
|
$location = $files_repo_path.'/'.$file['id'].'_'.$file['name'];
|
||||||
if (!file_exists($location) || !is_readable($location) || !is_file($location)) {
|
if (!file_exists($location) || !is_readable($location) || !is_file($location)) {
|
||||||
throw_error(5);
|
throw_error(5);
|
||||||
// ERROR
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// All checks are fine. Download the file!
|
// All checks are fine. Download the file!
|
||||||
@ -58,6 +64,13 @@ header('Content-Disposition: attachment; filename="'.$file['name'].'"');
|
|||||||
readfile($location);
|
readfile($location);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show errors
|
||||||
|
*
|
||||||
|
* @param integer $time Sleep.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
function throw_error($time=15)
|
function throw_error($time=15)
|
||||||
{
|
{
|
||||||
sleep($time);
|
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'));
|
||||||
|
}
|
@ -508,6 +508,8 @@ if ($access_console_node === true) {
|
|||||||
|
|
||||||
enterprise_hook('skins_submenu');
|
enterprise_hook('skins_submenu');
|
||||||
|
|
||||||
|
enterprise_hook('translate_string_submenu');
|
||||||
|
|
||||||
$menu_godmode['gsetup']['sub'] = $sub;
|
$menu_godmode['gsetup']['sub'] = $sub;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -711,15 +713,25 @@ if ($access_console_node === true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($access_console_node === true) {
|
if ($access_console_node === true) {
|
||||||
// Tools
|
// Tools.
|
||||||
$menu_godmode['tools']['text'] = __('Tools');
|
$menu_godmode['tools']['text'] = __('Tools');
|
||||||
$menu_godmode['tools']['sec2'] = 'operation/extensions';
|
$menu_godmode['tools']['sec2'] = 'operation/extensions';
|
||||||
$menu_godmode['tools']['id'] = 'oper-extensions';
|
$menu_godmode['tools']['id'] = 'oper-extensions';
|
||||||
$sub = [];
|
$sub = [];
|
||||||
$sub['operation/agentes/exportdata']['text'] = __('Export data');
|
|
||||||
$sub['operation/agentes/exportdata']['id'] = 'export_data';
|
if (check_acl($config['id_user'], 0, 'RR')
|
||||||
$sub['extensions/files_repo']['text'] = __('File repository');
|
|| check_acl($config['id_user'], 0, 'RW')
|
||||||
$sub['extensions/files_repo']['id'] = 'file_repository';
|
|| 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;
|
$menu_godmode['tools']['sub'] = $sub;
|
||||||
|
|
||||||
// About.
|
// About.
|
||||||
|
@ -212,6 +212,27 @@ class Applications extends Wizard
|
|||||||
|
|
||||||
Wizard::printBigButtonsList($wiz_data);
|
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>';
|
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);
|
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>';
|
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);
|
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>';
|
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;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -697,6 +697,9 @@ class ManageExtensions extends HTML
|
|||||||
$order,
|
$order,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$appsMetadata = self::loadDiscoveryAppsMetadata();
|
||||||
|
$flattenMetadata = array_merge(...array_values($appsMetadata));
|
||||||
|
|
||||||
$count = db_get_num_rows($sqlCount);
|
$count = db_get_num_rows($sqlCount);
|
||||||
|
|
||||||
foreach ($data as $key => $row) {
|
foreach ($data as $key => $row) {
|
||||||
@ -705,6 +708,15 @@ class ManageExtensions extends HTML
|
|||||||
$logo = $this->defaultLogo;
|
$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;']);
|
$logo = html_print_image($logo, true, ['style' => 'max-width: 30px; margin-right: 15px;']);
|
||||||
$data[$key]['name'] = $logo.io_safe_output($row['name']);
|
$data[$key]['name'] = $logo.io_safe_output($row['name']);
|
||||||
$data[$key]['short_name'] = $row['short_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'] = '#';
|
$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">
|
<li class="discovery">
|
||||||
<a href="<?php echo $data['url']; ?>">
|
<a href="<?php echo $data['url']; ?>">
|
||||||
<div class="data_container">
|
<div class="<?php echo $cnt_class; ?> ">
|
||||||
<?php html_print_image($data['icon']); ?>
|
<?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']); ?>
|
<?php echo io_safe_output($data['label']); ?>
|
||||||
</label>
|
</label>
|
||||||
|
<?php echo $ent_icon; ?>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@ -514,11 +543,18 @@ class Wizard
|
|||||||
*
|
*
|
||||||
* @return void Print the full list.
|
* @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">';
|
echo '<ul class="bigbuttonlist">';
|
||||||
array_map('self::printBigButtonElement', $list_data);
|
array_map('self::printBigButtonElement', $list_data);
|
||||||
echo '</ul>';
|
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 |
BIN
pandora_console/images/ent_icon.png
Normal file
After Width: | Height: | Size: 34 KiB |
@ -195,28 +195,200 @@ class ExtensionsDiscovery extends Wizard
|
|||||||
/**
|
/**
|
||||||
* Return array extensions filtered by section
|
* 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;
|
global $config;
|
||||||
// Check access.
|
// Check access.
|
||||||
check_login();
|
check_login();
|
||||||
$extensions = [];
|
$extensions = [];
|
||||||
$rows = $this->getExtensionsApps();
|
$rows = $this->getExtensionsApps();
|
||||||
foreach ($rows as $key => $extension) {
|
|
||||||
$logo = $this->path.'/'.$extension['short_name'].'/'.$this->icon;
|
define('NOT_FOUND_MSG', 1);
|
||||||
if (file_exists($config['homedir'].$logo) === false) {
|
define('ENTERPRISE_MSG', 2);
|
||||||
$logo = $this->defaultLogo;
|
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[] = [
|
var markup = "<ul class=\'\'>";
|
||||||
'icon' => $logo,
|
|
||||||
'label' => $extension['name'],
|
if (msgs_json.includes('.NOT_FOUND_MSG.')) {
|
||||||
'url' => ui_get_full_url(
|
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']
|
'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;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* Pandora build version and version
|
* Pandora build version and version
|
||||||
*/
|
*/
|
||||||
$build_version = 'PC231215';
|
$build_version = 'PC231218';
|
||||||
$pandora_version = 'v7.0NG.774';
|
$pandora_version = 'v7.0NG.774';
|
||||||
|
|
||||||
// Do not overwrite default timezone set if defined.
|
// Do not overwrite default timezone set if defined.
|
||||||
|
@ -169,13 +169,21 @@ function extensions_get_extensions($enterprise=false, $rel_path='')
|
|||||||
$file = readdir($handle);
|
$file = readdir($handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load extensions in enterprise directory
|
if (isset($extensions['ipam.php']) === true) {
|
||||||
if (! $enterprise && file_exists($master_dir)) {
|
unset($extensions['ipam.php']);
|
||||||
return array_merge($extensions, extensions_get_extensions(true, $rel_path));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($extensions['ipam.php'])) {
|
if (isset($extensions['translate_string.php']) === true) {
|
||||||
unset($extensions['ipam.php']);
|
unset($extensions['translate_string.php']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($extensions['files_repo.php']) === true) {
|
||||||
|
unset($extensions['files_repo.php']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load extensions in enterprise directory.
|
||||||
|
if (! $enterprise && file_exists($master_dir)) {
|
||||||
|
return array_merge($extensions, extensions_get_extensions(true, $rel_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $extensions;
|
return $extensions;
|
||||||
|
@ -1,17 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Functions 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
|
global $config;
|
||||||
// ==================================================
|
|
||||||
// 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
|
* Check repository writable.
|
||||||
// modify it under the terms of the GNU General Public License
|
*
|
||||||
// as published by the Free Software Foundation; version 2
|
* @return mixed
|
||||||
// This program is distributed in the hope that it will be useful,
|
*/
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
function files_repo_check_directory()
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
function files_repo_check_directory($print_messages=false)
|
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -21,11 +38,18 @@ function files_repo_check_directory($print_messages=false)
|
|||||||
$result = false;
|
$result = false;
|
||||||
$messages = '';
|
$messages = '';
|
||||||
|
|
||||||
// attachment/ check
|
$msg_error = __('Attachment directory is not writable by HTTP Server');
|
||||||
if (!is_writable($attachment_path)) {
|
$msg_error .= '</h3><p>';
|
||||||
|
$msg_error .= sprintf(
|
||||||
|
__('Please check that the web server has write rights on the %s directory'),
|
||||||
|
$attachment_path
|
||||||
|
);
|
||||||
|
|
||||||
|
// Attachment/ check.
|
||||||
|
if (is_writable($attachment_path) === false) {
|
||||||
$messages .= ui_print_error_message(
|
$messages .= ui_print_error_message(
|
||||||
[
|
[
|
||||||
'message' => __('Attachment directory is not writable by HTTP Server').'</h3>'.'<p>'.sprinf(__('Please check that the web server has write rights on the %s directory'), $attachment_path),
|
'message' => $msg_error,
|
||||||
'no_close' => true,
|
'no_close' => true,
|
||||||
'force_style' => 'color: #000000 !important',
|
'force_style' => 'color: #000000 !important',
|
||||||
],
|
],
|
||||||
@ -33,17 +57,17 @@ function files_repo_check_directory($print_messages=false)
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// attachment/agent_packages/ check
|
// Attachment/agent_packages/ check.
|
||||||
if (!file_exists($files_repo_path) || !is_writable($files_repo_path)) {
|
if (file_exists($files_repo_path) === false || is_writable($files_repo_path) === false) {
|
||||||
// Create the directoty if not exist
|
// Create the directoty if not exist.
|
||||||
if (!file_exists($files_repo_path)) {
|
if (file_exists($files_repo_path) === false) {
|
||||||
mkdir($files_repo_path);
|
mkdir($files_repo_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_writable($files_repo_path)) {
|
if (is_writable($files_repo_path) === false) {
|
||||||
$messages .= ui_print_error_message(
|
$messages .= ui_print_error_message(
|
||||||
[
|
[
|
||||||
'message' => __('Attachment directory is not writable by HTTP Server').'</h3>'.'<p>'.sprintf(__('Please check that the web server has write rights on the %s directory'), $attachment_path),
|
'message' => $msg_error,
|
||||||
'no_close' => true,
|
'no_close' => true,
|
||||||
'force_style' => 'color: #000000 !important',
|
'force_style' => 'color: #000000 !important',
|
||||||
],
|
],
|
||||||
@ -58,48 +82,60 @@ function files_repo_check_directory($print_messages=false)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($print_messages) {
|
echo $messages;
|
||||||
echo $messages;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function files_repo_check_file_acl($file_id, $user_id=false, $file_groups=false, $user_groups=false)
|
/**
|
||||||
{
|
* Check acl file
|
||||||
|
*
|
||||||
|
* @param integer $file_id ID.
|
||||||
|
* @param boolean $user_id Users.
|
||||||
|
* @param boolean $file_groups File Groups.
|
||||||
|
* @param boolean $user_groups User Groups.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function files_repo_check_file_acl(
|
||||||
|
$file_id,
|
||||||
|
$user_id=false,
|
||||||
|
$file_groups=false,
|
||||||
|
$user_groups=false
|
||||||
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$result = false;
|
$result = false;
|
||||||
if (!$user_id) {
|
if (empty($user_id) === true) {
|
||||||
$user_id = $config['id_user'];
|
$user_id = $config['id_user'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_user_admin($user_id)) {
|
if (is_user_admin($user_id) === true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$file_groups) {
|
if (!$file_groups) {
|
||||||
$file_groups = files_repo_get_file_groups($file_id);
|
$file_groups = files_repo_get_file_groups($file_id);
|
||||||
if (empty($file_groups)) {
|
if (empty($file_groups) === true) {
|
||||||
$file_groups = [];
|
$file_groups = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array(0, $file_groups)) {
|
if (in_array(0, $file_groups) === true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user_groups) {
|
if (!$user_groups) {
|
||||||
$user_groups = users_get_groups($user_id, false, true);
|
$user_groups = users_get_groups($user_id, false, true);
|
||||||
if (empty($user_groups)) {
|
if (empty($user_groups) === true) {
|
||||||
$user_groups = [];
|
$user_groups = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($file_groups as $group_id) {
|
foreach ($file_groups as $group_id) {
|
||||||
// $user_groups has the id in the array keys
|
// $user_groups has the id in the array keys.
|
||||||
if (in_array($group_id, $user_groups)) {
|
if (in_array($group_id, $user_groups) === true) {
|
||||||
$result = true;
|
$result = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -109,13 +145,19 @@ function files_repo_check_file_acl($file_id, $user_id=false, $file_groups=false,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File groups.
|
||||||
|
*
|
||||||
|
* @param integer $file_id File.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
function files_repo_get_file_groups($file_id)
|
function files_repo_get_file_groups($file_id)
|
||||||
{
|
{
|
||||||
$groups = [];
|
$groups = [];
|
||||||
$filter = ['id_file' => $file_id];
|
$filter = ['id_file' => $file_id];
|
||||||
$result = db_get_all_rows_filter('tfiles_repo_group', $filter, 'id_group');
|
$result = db_get_all_rows_filter('tfiles_repo_group', $filter, 'id_group');
|
||||||
|
if (empty($result) === false) {
|
||||||
if (!empty($result)) {
|
|
||||||
foreach ($result as $key => $value) {
|
foreach ($result as $key => $value) {
|
||||||
$groups[] = $value['id_group'];
|
$groups[] = $value['id_group'];
|
||||||
}
|
}
|
||||||
@ -125,13 +167,19 @@ function files_repo_get_file_groups($file_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File user groups.
|
||||||
|
*
|
||||||
|
* @param string $user_id User id.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
function files_repo_get_user_groups($user_id)
|
function files_repo_get_user_groups($user_id)
|
||||||
{
|
{
|
||||||
$groups = [];
|
$groups = [];
|
||||||
$filter = ['id_usuario' => $user_id];
|
$filter = ['id_usuario' => $user_id];
|
||||||
$result = db_get_all_rows_filter('tusuario_perfil', $filter, 'id_grupo');
|
$result = db_get_all_rows_filter('tusuario_perfil', $filter, 'id_grupo');
|
||||||
|
if (empty($result) === false) {
|
||||||
if (!empty($result)) {
|
|
||||||
foreach ($result as $key => $value) {
|
foreach ($result as $key => $value) {
|
||||||
$groups[] = $value['id_grupo'];
|
$groups[] = $value['id_grupo'];
|
||||||
}
|
}
|
||||||
@ -141,7 +189,15 @@ function files_repo_get_user_groups($user_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function files_repo_get_files($filter=false, $count=false)
|
/**
|
||||||
|
* Get files.
|
||||||
|
*
|
||||||
|
* @param array $filter Filters.
|
||||||
|
* @param boolean $count Count.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function files_repo_get_files($filter=[], $count=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -171,9 +227,9 @@ function files_repo_get_files($filter=false, $count=false)
|
|||||||
$data['name'] = $file['name'];
|
$data['name'] = $file['name'];
|
||||||
$data['description'] = $file['description'];
|
$data['description'] = $file['description'];
|
||||||
$data['location'] = $files_repo_path.'/'.$file['id'].'_'.$data['name'];
|
$data['location'] = $files_repo_path.'/'.$file['id'].'_'.$data['name'];
|
||||||
// Size in bytes
|
// Size in bytes.
|
||||||
$data['size'] = filesize($data['location']);
|
$data['size'] = filesize($data['location']);
|
||||||
// Last modification time in unix timestamp
|
// Last modification time in unix timestamp.
|
||||||
$data['mtime'] = filemtime($data['location']);
|
$data['mtime'] = filemtime($data['location']);
|
||||||
$data['groups'] = $file_groups;
|
$data['groups'] = $file_groups;
|
||||||
$data['hash'] = $file['hash'];
|
$data['hash'] = $file['hash'];
|
||||||
@ -188,6 +244,16 @@ function files_repo_get_files($filter=false, $count=false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add file.
|
||||||
|
*
|
||||||
|
* @param string $file_input_name Name.
|
||||||
|
* @param string $description Description.
|
||||||
|
* @param array $groups Groups.
|
||||||
|
* @param boolean $public Mode.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
function files_repo_add_file($file_input_name='upfile', $description='', $groups=[], $public=false)
|
function files_repo_add_file($file_input_name='upfile', $description='', $groups=[], $public=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
@ -210,10 +276,10 @@ function files_repo_add_file($file_input_name='upfile', $description='', $groups
|
|||||||
$invalid_extensions = '/^(php|php1|php2|php3|php4|php5|php7|php8|phar|phptml|phps)$/i';
|
$invalid_extensions = '/^(php|php1|php2|php3|php4|php5|php7|php8|phar|phptml|phps)$/i';
|
||||||
|
|
||||||
if (preg_match($invalid_extensions, $extension) === 0) {
|
if (preg_match($invalid_extensions, $extension) === 0) {
|
||||||
// Replace conflictive characters
|
// Replace conflictive characters.
|
||||||
$filename = str_replace([' ', '=', '?', '&'], '_', $filename);
|
$filename = str_replace([' ', '=', '?', '&'], '_', $filename);
|
||||||
$filename = filter_var($filename, FILTER_SANITIZE_URL);
|
$filename = filter_var($filename, FILTER_SANITIZE_URL);
|
||||||
// The filename should not be larger than 200 characters
|
// The filename should not be larger than 200 characters.
|
||||||
if (mb_strlen($filename, 'UTF-8') > 200) {
|
if (mb_strlen($filename, 'UTF-8') > 200) {
|
||||||
$filename = mb_substr($filename, 0, 200, 'UTF-8');
|
$filename = mb_substr($filename, 0, 200, 'UTF-8');
|
||||||
}
|
}
|
||||||
@ -267,6 +333,16 @@ function files_repo_add_file($file_input_name='upfile', $description='', $groups
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update file.
|
||||||
|
*
|
||||||
|
* @param string $file_id File Name.
|
||||||
|
* @param string $description Description.
|
||||||
|
* @param array $groups Groups.
|
||||||
|
* @param boolean $public Mode.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
function files_repo_update_file($file_id, $description='', $groups=[], $public=false)
|
function files_repo_update_file($file_id, $description='', $groups=[], $public=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
@ -308,6 +384,13 @@ function files_repo_update_file($file_id, $description='', $groups=[], $public=f
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete File
|
||||||
|
*
|
||||||
|
* @param string $file_id File Name.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
function files_repo_delete_file($file_id)
|
function files_repo_delete_file($file_id)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
@ -410,32 +410,14 @@ function __($string /*, variable arguments */)
|
|||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (defined('METACONSOLE')) {
|
enterprise_include_once('include/functions_setup.php');
|
||||||
enterprise_include_once('meta/include/functions_meta.php');
|
$tranlateString = call_user_func_array(
|
||||||
|
'get_defined_translation',
|
||||||
|
array_values(func_get_args())
|
||||||
|
);
|
||||||
|
|
||||||
$tranlateString = call_user_func_array(
|
if ($tranlateString !== false) {
|
||||||
'meta_get_defined_translation',
|
return $tranlateString;
|
||||||
array_values(func_get_args())
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($tranlateString !== false) {
|
|
||||||
return $tranlateString;
|
|
||||||
}
|
|
||||||
} else if (enterprise_installed()
|
|
||||||
&& isset($config['translate_string_extension_installed'])
|
|
||||||
&& $config['translate_string_extension_installed'] == 1
|
|
||||||
&& array_key_exists('translate_string.php', $extensions)
|
|
||||||
) {
|
|
||||||
enterprise_include_once('extensions/translate_string/functions.php');
|
|
||||||
|
|
||||||
$tranlateString = call_user_func_array(
|
|
||||||
'get_defined_translation',
|
|
||||||
array_values(func_get_args())
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($tranlateString !== false) {
|
|
||||||
return $tranlateString;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($string == '') {
|
if ($string == '') {
|
||||||
|
@ -82,10 +82,9 @@ if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$c
|
|||||||
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/'.$file;
|
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/'.$file;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'extensions/files_repo':
|
case 'godmode/files_repo/files_repo':
|
||||||
$attachment_path = io_safe_output($config['attachment_store']);
|
$attachment_path = io_safe_output($config['attachment_store']);
|
||||||
$downloadable_file = $attachment_path.'/files_repo/'.$file;
|
$downloadable_file = $attachment_path.'/files_repo/'.$file;
|
||||||
// $downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/files_repo/'.$file;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'godmode/servers/plugin':
|
case 'godmode/servers/plugin':
|
||||||
|
@ -109,21 +109,13 @@ td > input[id^="checkbox-multi"] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.info_table.events tr > td span:not(.invisible) {
|
.info_table.events tr > td span:not(.invisible) {
|
||||||
display: block;
|
display: inline-block;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
max-height: 6em;
|
max-height: 6em;
|
||||||
line-height: 2em;
|
line-height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info_table.events tr > td span:not(.invisible) {
|
|
||||||
display: block;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
max-height: 6em;
|
|
||||||
line-height: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
th.column-estado {
|
th.column-estado {
|
||||||
padding: 0px 0px 0px 12px !important;
|
padding: 0px 0px 0px 12px !important;
|
||||||
max-width: fit-content;
|
max-width: fit-content;
|
||||||
|
@ -8159,6 +8159,10 @@ div.graph div.legend table {
|
|||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.height_auto_important {
|
||||||
|
height: auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
.mx_height50px {
|
.mx_height50px {
|
||||||
max-height: 50px;
|
max-height: 50px;
|
||||||
}
|
}
|
||||||
@ -12322,6 +12326,12 @@ div.parent_graph > p.legend_background > table > tbody > tr {
|
|||||||
color: #82b92e;
|
color: #82b92e;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.link-important {
|
||||||
|
color: #82b92e !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
.signature a {
|
.signature a {
|
||||||
color: #82b92e;
|
color: #82b92e;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
@ -131,7 +131,7 @@
|
|||||||
<div style='padding-bottom: 50px'>
|
<div style='padding-bottom: 50px'>
|
||||||
<?php
|
<?php
|
||||||
$version = '7.0NG.774';
|
$version = '7.0NG.774';
|
||||||
$build = '231215';
|
$build = '231218';
|
||||||
$banner = "v$version Build $build";
|
$banner = "v$version Build $build";
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
|
||||||
|
@ -1381,8 +1381,6 @@ $sql = 'SELECT
|
|||||||
ORDER BY '.$order['field'].' '.$order['order'].'
|
ORDER BY '.$order['field'].' '.$order['order'].'
|
||||||
LIMIT '.$limit_sql.' OFFSET '.$offset;
|
LIMIT '.$limit_sql.' OFFSET '.$offset;
|
||||||
|
|
||||||
hd($sql);
|
|
||||||
|
|
||||||
// We do not show the modules until the user searches with the filter.
|
// We do not show the modules until the user searches with the filter.
|
||||||
if ($autosearch) {
|
if ($autosearch) {
|
||||||
if (is_metaconsole() === false) {
|
if (is_metaconsole() === false) {
|
||||||
|
@ -523,17 +523,6 @@ if (is_ajax() === true) {
|
|||||||
$tmp->b64 = base64_encode(json_encode($tmp));
|
$tmp->b64 = base64_encode(json_encode($tmp));
|
||||||
$tmp->evento = $output_event_name;
|
$tmp->evento = $output_event_name;
|
||||||
|
|
||||||
$tmp->evento = ui_print_truncate_text(
|
|
||||||
$tmp->evento,
|
|
||||||
(empty($compact_name_event) === true) ? 'description' : GENERIC_SIZE_TEXT,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
'…',
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (empty($tmp->module_name) === false) {
|
if (empty($tmp->module_name) === false) {
|
||||||
$tmp->module_name = ui_print_truncate_text(
|
$tmp->module_name = ui_print_truncate_text(
|
||||||
$tmp->module_name,
|
$tmp->module_name,
|
||||||
@ -771,18 +760,31 @@ if (is_ajax() === true) {
|
|||||||
$evn = '<a href="javascript:" onclick="show_event_dialog(\''.$tmp->b64.'\')">';
|
$evn = '<a href="javascript:" onclick="show_event_dialog(\''.$tmp->b64.'\')">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$number = '';
|
||||||
// Grouped events.
|
// Grouped events.
|
||||||
if ((int) $filter['group_rep'] === EVENT_GROUP_REP_EXTRAIDS) {
|
if ((int) $filter['group_rep'] === EVENT_GROUP_REP_EXTRAIDS) {
|
||||||
$counter_extra_id = event_get_counter_extraId($item, $filter);
|
$counter_extra_id = event_get_counter_extraId($item, $filter);
|
||||||
if (empty($counter_extra_id) === false && $counter_extra_id > 1) {
|
if (empty($counter_extra_id) === false && $counter_extra_id > 1) {
|
||||||
$evn .= '('.$counter_extra_id.') ';
|
$number = '('.$counter_extra_id.') ';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isset($tmp->event_rep) === true && $tmp->event_rep > 1) {
|
if (isset($tmp->event_rep) === true && $tmp->event_rep > 1) {
|
||||||
$evn .= '('.$tmp->event_rep.') ';
|
$number = '('.$tmp->event_rep.') ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tmp->evento = $number.$tmp->evento;
|
||||||
|
$tmp->evento = ui_print_truncate_text(
|
||||||
|
$tmp->evento,
|
||||||
|
(empty($compact_name_event) === true) ? 'description' : GENERIC_SIZE_TEXT,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'…',
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
|
||||||
$evn .= $tmp->evento.'</a>';
|
$evn .= $tmp->evento.'</a>';
|
||||||
|
|
||||||
// Add event severity format to itself.
|
// Add event severity format to itself.
|
||||||
|
@ -734,24 +734,8 @@ if ($access_console_node === true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($access_console_node === true) {
|
if ($access_console_node === true) {
|
||||||
// Rest of options, all with AR privilege (or should events be with incidents?)
|
|
||||||
// ~ if (check_acl ($config['id_user'], 0, "AR")) {
|
|
||||||
// Extensions menu additions.
|
// Extensions menu additions.
|
||||||
if (is_array($config['extensions'])) {
|
if (is_array($config['extensions'])) {
|
||||||
$sub = [];
|
|
||||||
$sub2 = [];
|
|
||||||
|
|
||||||
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';
|
|
||||||
$sub['operation/agentes/exportdata']['subsecs'] = ['operation/agentes/exportdata'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (check_acl($config['id_user'], 0, 'AR') || check_acl($config['id_user'], 0, 'AD') || check_acl($config['id_user'], 0, 'AW')) {
|
|
||||||
$sub['godmode/agentes/planned_downtime.list']['text'] = __('Scheduled downtime');
|
|
||||||
$sub['godmode/agentes/planned_downtime.list']['id'] = 'Scheduled_downtime';
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($config['extensions'] as $extension) {
|
foreach ($config['extensions'] as $extension) {
|
||||||
// If no operation_menu is a godmode extension.
|
// If no operation_menu is a godmode extension.
|
||||||
if ($extension['operation_menu'] == '') {
|
if ($extension['operation_menu'] == '') {
|
||||||
@ -772,39 +756,19 @@ if ($access_console_node === true) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if was displayed inside other menu.
|
if (array_key_exists('fatherId', $extension_menu)) {
|
||||||
if ($extension['operation_menu']['fatherId'] == '') {
|
// Check that extension father ID exists previously on the menu.
|
||||||
if ($extension_menu['name'] == 'Warp update') {
|
if ((strlen($extension_menu['fatherId']) > 0)) {
|
||||||
continue;
|
if (array_key_exists('subfatherId', $extension_menu) && empty($extension_menu['subfatherId']) === false) {
|
||||||
}
|
if ((strlen($extension_menu['subfatherId']) > 0)) {
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['text'] = __($extension_menu['name']);
|
||||||
$sub[$extension_menu['sec2']]['text'] = $extension_menu['name'];
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
||||||
$sub[$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['refr'] = 0;
|
||||||
$sub[$extension_menu['sec2']]['refr'] = 0;
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['icon'] = $extension_menu['icon'];
|
||||||
} else {
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['sec'] = 'extensions';
|
||||||
if (array_key_exists('fatherId', $extension_menu)) {
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['extension'] = true;
|
||||||
// Check that extension father ID exists previously on the menu.
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['enterprise'] = $extension['enterprise'];
|
||||||
if ((strlen($extension_menu['fatherId']) > 0)) {
|
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
|
||||||
if (array_key_exists('subfatherId', $extension_menu) && empty($extension_menu['subfatherId']) === false) {
|
|
||||||
if ((strlen($extension_menu['subfatherId']) > 0)) {
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['text'] = __($extension_menu['name']);
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['refr'] = 0;
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['icon'] = $extension_menu['icon'];
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['sec'] = 'extensions';
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['extension'] = true;
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['enterprise'] = $extension['enterprise'];
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
|
|
||||||
} else {
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['text'] = __($extension_menu['name']);
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['refr'] = 0;
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['icon'] = $extension_menu['icon'];
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['sec'] = 'extensions';
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['extension'] = true;
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['enterprise'] = $extension['enterprise'];
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['text'] = __($extension_menu['name']);
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['text'] = __($extension_menu['name']);
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
||||||
@ -815,13 +779,20 @@ if ($access_console_node === true) {
|
|||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['enterprise'] = $extension['enterprise'];
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['enterprise'] = $extension['enterprise'];
|
||||||
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
|
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['text'] = __($extension_menu['name']);
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['refr'] = 0;
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['icon'] = $extension_menu['icon'];
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['sec'] = 'extensions';
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['extension'] = true;
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['enterprise'] = $extension['enterprise'];
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$menu_operation['about_operation']['text'] = __('About');
|
$menu_operation['about_operation']['text'] = __('About');
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231215
|
%define release 231218
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231215
|
%define release 231218
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231215
|
%define release 231218
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name apache2
|
%define httpd_name apache2
|
||||||
|
@ -4558,4 +4558,26 @@ CREATE TABLE IF NOT EXISTS `tpandora_cve` (
|
|||||||
`cvss_score` DOUBLE DEFAULT NULL,
|
`cvss_score` DOUBLE DEFAULT NULL,
|
||||||
`cvss_vector` VARCHAR(255) DEFAULT NULL,
|
`cvss_vector` VARCHAR(255) DEFAULT NULL,
|
||||||
PRIMARY KEY (`cve_id`)
|
PRIMARY KEY (`cve_id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `tfiles_repo`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
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;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `tfiles_repo_group`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
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;
|
@ -125,10 +125,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||||||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||||
('custom_report_front_header', ''),
|
('custom_report_front_header', ''),
|
||||||
('custom_report_front_footer', ''),
|
('custom_report_front_footer', ''),
|
||||||
('MR', 66),
|
('MR', 67),
|
||||||
('identification_reminder', 1),
|
('identification_reminder', 1),
|
||||||
('identification_reminder_timestamp', 0),
|
('identification_reminder_timestamp', 0),
|
||||||
('current_package', 774),
|
('current_package', 775),
|
||||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.00097656250000":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'),
|
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.00097656250000":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'),
|
||||||
('custom_docs_logo', 'default_docs.png'),
|
('custom_docs_logo', 'default_docs.png'),
|
||||||
('custom_support_logo', 'default_support.png'),
|
('custom_support_logo', 'default_support.png'),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-server
|
package: pandorafms-server
|
||||||
Version: 7.0NG.774-231215
|
Version: 7.0NG.774-231218
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.774-231215"
|
pandora_version="7.0NG.774-231218"
|
||||||
|
|
||||||
package_cpan=0
|
package_cpan=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
|||||||
|
|
||||||
# version: Defines actual version of Pandora Server for this module only
|
# version: Defines actual version of Pandora Server for this module only
|
||||||
my $pandora_version = "7.0NG.774";
|
my $pandora_version = "7.0NG.774";
|
||||||
my $pandora_build = "231215";
|
my $pandora_build = "231218";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
# Setup hash
|
# Setup hash
|
||||||
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||||||
|
|
||||||
# version: Defines actual version of Pandora Server for this module only
|
# version: Defines actual version of Pandora Server for this module only
|
||||||
my $pandora_version = "7.0NG.774";
|
my $pandora_version = "7.0NG.774";
|
||||||
my $pandora_build = "231215";
|
my $pandora_build = "231218";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231215
|
%define release 231218
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
%global __os_install_post %{nil}
|
%global __os_install_post %{nil}
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231215
|
%define release 231218
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.774"
|
PI_VERSION="7.0NG.774"
|
||||||
PI_BUILD="231215"
|
PI_BUILD="231218"
|
||||||
|
|
||||||
MODE=$1
|
MODE=$1
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
|
@ -38,7 +38,7 @@ use PandoraFMS::Config;
|
|||||||
use PandoraFMS::DB;
|
use PandoraFMS::DB;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.774 Build 231215";
|
my $version = "7.0NG.774 Build 231218";
|
||||||
|
|
||||||
# Pandora server configuration
|
# Pandora server configuration
|
||||||
my %conf;
|
my %conf;
|
||||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||||||
Encode::Locale::decode_argv;
|
Encode::Locale::decode_argv;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.774 Build 231215";
|
my $version = "7.0NG.774 Build 231218";
|
||||||
|
|
||||||
# save program name for logging
|
# save program name for logging
|
||||||
my $progname = basename($0);
|
my $progname = basename($0);
|
||||||
|