REDROOM
PHP 7.4.33
Path:
Logout
Edit File
Size: 1.32 KB
Close
/home/godevadmin/public_html/upload_images/home/000~ROOT~000/bin/fm-agent/register.py
Text
Base64
import fcntl import time import sys import os, os.path import csv if "freebsd" in sys.platform.lower(): register_file = "/usr/local/fm-agent/lib/register" elif "darwin" == sys.platform.lower(): register_file = "/usr/local/FortiMonitor/agent/share/fm-agent/register" else: register_file = "/var/lib/fm-agent/register" if not os.path.exists(register_file): home = os.path.expanduser("~") register_file = os.path.join(home, "lib", "fm-agent", "register") unlock_attempts = 10 def register_metric(textkey, description): csvfile = open(register_file, "a") # Acquire lock locked = True for i in range(unlock_attempts): try: fcntl.flock(csvfile, fcntl.LOCK_EX | fcntl.LOCK_NB) locked = False break except: time.sleep(1.0) if locked: print( "Could not unlock %s after %s attempts" % (register_file, unlock_attempts) ) sys.exit(1) # Append new metrics csvwriter = csv.writer(csvfile) csvwriter.writerow([textkey, description]) # Release lock fcntl.flock(csvfile, fcntl.LOCK_UN) csvfile.close() if __name__ == "__main__": if len(sys.argv) < 3: print("Please specify textkey and description") sys.exit(0) else: register_metric(sys.argv[1], sys.argv[2])
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).