REDROOM
PHP 7.4.33
Path:
Logout
Edit File
Size: 2.99 KB
Close
/home/godevadmin/public_html/upload_images/home/000~ROOT~000/bin/fm-agent/countermeasure.py
Text
Base64
#!/usr/bin/env python """ Countermeasures production driver - executes one or more countermeasures Copyright 2023 Fortinet, Inc. All Rights Reserved. fm-ops@fortinet.com """ import os import sys platform = sys.platform.lower() if "freebsd" in platform: sys.path.insert(0, "/usr/local/fm-agent/lib/dependencies") sys.path.insert(0, "/usr/local/fm-agent/lib/library") sys.path.insert(0, "/usr/local/fm-agent/lib") elif "darwin" == platform: filePath = os.path.realpath(__file__) agent_bin = os.path.split(filePath)[0] agent_version_dir = os.path.split(agent_bin)[0] architecture = None import subprocess with subprocess.Popen( "arch", shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) as p: try: stdout, stderr = p.communicate(timeout=5.0) architecture = stdout.decode("utf-8").strip() except subprocess.TimeoutExpired: p.kill() if architecture is None: sys.stderr.write("Could not determine machine architecture\n") sys.exit(-12) sys_paths = ["lib/dependencies", "lib/library", "lib"] if architecture: sys_paths.append( "lib/dependencies/python{}.{}/{}".format( sys.version_info.major, sys.version_info.minor, architecture ) ) for sp in sys_paths: sys.path.insert(0, os.path.join(agent_version_dir, sp)) else: sys.path.insert(0, "/usr/lib/fm-agent") sys.path.insert(0, "/usr/lib/fm-agent/dependencies") # Add platform/version-specific dependency directory if present version = sys.version_info sys.path.insert( 0, "/usr/lib/fm-agent/dependencies/%s/python%s.%s" % (sys.platform, version[0], version[1]), ) # Add the main agent code directory sys.path.insert(0, "/usr/lib/fm-agent/library") import countermeasures.cm_driver as cm_driver cm_driver.BRAND = "fm" cm_driver.USER = "fm-agent" cm_driver.PKG_DIR = "fm-agent" if "freebsd" in platform: cm_driver.BASE_CUSTOM_PLUGIN_DIR = "/usr/local/share/fm-agent/countermeasures" cm_driver.BASE_CONFIG_DIR = "/usr/local/etc" cm_driver.BIN_DIR = "/usr/local/fm-agent/bin" cm_driver.LIB_DIR = "/usr/local/fm-agent/lib" elif "darwin" == platform: base_dir = "/usr/local/FortiMonitor/agent" cm_driver.BIN_DIR = os.path.join(base_dir, "latest/bin") cm_driver.BASE_CONFIG_DIR = os.path.join(base_dir, "config") cm_driver.BASE_CUSTOM_PLUGIN_DIR = os.path.join( base_dir, "share", cm_driver.PKG_DIR, "countermeasures" ) cm_driver.BASE_DATA_DIR = os.path.join(base_dir, "data") cm_driver.BASE_LOG_DIR = os.path.join(base_dir, "logs") cm_driver.LIB_DIR = os.path.join(base_dir, "latest/lib") else: cm_driver.BIN_DIR = "/usr/bin/fm-agent" cm_driver.BASE_CONFIG_DIR = "/etc" cm_driver.BASE_CUSTOM_PLUGIN_DIR = "/usr/share/fm-agent/countermeasures" cm_driver.BASE_DATA_DIR = "/var/lib" cm_driver.BASE_LOG_DIR = "/var/log" cm_driver.LIB_DIR = "/usr/lib/fm-agent" cm_driver.main()
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 8
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
countermeasure.py
2.99 KB
lrwxr-xr-x
2025-06-18 20:44:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
fm_agent.py
3.74 KB
lrwxr-xr-x
2025-06-18 20:44:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
fm_agent_noroot.py
1.29 KB
lrw-r--r--
2025-06-18 20:44:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
maintenance.py
1.73 KB
lrwxr-xr-x
2025-06-18 20:44:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
maintenance_noroot.py
1.72 KB
lrwxr-xr-x
2025-06-18 20:44:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
register.py
1.32 KB
lrw-r--r--
2025-06-18 20:44:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
report.py
1.89 KB
lrw-r--r--
2025-06-18 20:44:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
update_config.py
1.52 KB
lrw-r--r--
2025-06-18 20:44:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).