REDROOM
PHP 7.4.33
Path:
Logout
Edit File
Size: 1.52 KB
Close
/home/godevadmin/public_html/upload_images/home/000~ROOT~000/bin/fm-agent/update_config.py
Text
Base64
import fcntl import time import sys import os, os.path update_config_file = '/etc/panopta-agent/panopta_agent.cfg' if not os.path.exists(update_config_file): home = os.path.expanduser("~") update_config_file = os.path.join(home, "lib", "fm-agent", "update_config") unlock_attempts = 10 def update_config(manifest_file): if not os.path.exists(manifest_file): print "Manifest file %s does not exist" % manifest_file sys.exit(0) try: mf = open(manifest_file).read().strip().split('\n') props = dict([map(str.strip, line.split("=")) for line in mf]) except: print "Error reading manifest file %s" % manifest_file sys.exit(0) manfile = open(update_config_file, 'wt') # Acquire lock locked = True for i in range(unlock_attempts): try: fcntl.flock(manfile, fcntl.LOCK_EX | fcntl.LOCK_NB) locked = False break except: time.sleep(1.0) if locked: print "Could not unlock %s after %s attempts" % (update_config_file, unlock_attempts) sys.exit(1) # Write new properties manfile.write(open(manifest_file).read()) # Release lock fcntl.flock(manfile, fcntl.LOCK_UN) manfile.close() # Change perms to make sure the agent user can read the config file os.system("chmod 666 %s" % update_config_file) if __name__ == "__main__": if len(sys.argv) < 2: print "Please specify the manifest file" sys.exit(0) else: update_config(sys.argv[1])
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).