403Webshell
Server IP : 68.178.202.69  /  Your IP : 216.73.216.174
Web Server : Apache
System : Linux 69.202.178.68.host.secureserver.net 3.10.0-1160.139.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Nov 3 13:30:41 UTC 2025 x86_64
User : ikioworld ( 1005)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/self/root/usr/bin/fm-agent/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/usr/bin/fm-agent/register.py
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])

Youez - 2016 - github.com/yon3zu
LinuXploit