Linux 120.141.167.72.host.secureserver.net 4.18.0-553.150.1.el8_10.x86_64 #1 SMP Fri Jul 31 15:23:31 EDT 2026 x86_64
Apache
: 72.167.141.120 | : 216.73.217.14
808 Domain
7.4.33
bestseocompany
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
lib /
fm-agent /
plugins /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
__init__.py
0
B
-rw-r--r--
apache.py
20.07
KB
-rw-r--r--
apache_kafka.py
13.66
KB
-rw-r--r--
apache_zookeeper.py
6.34
KB
-rw-r--r--
bandwidth.py
22.59
KB
-rw-r--r--
cassandra.py
9.46
KB
-rw-r--r--
cert.py
2.89
KB
-rw-r--r--
couch.py
9.56
KB
-rw-r--r--
cpu_usage.py
32.09
KB
-rw-r--r--
dem_plugin.py
7.48
KB
-rw-r--r--
disk.py
16.8
KB
-rw-r--r--
docker.py
38.95
KB
-rw-r--r--
elasticsearch.py
2.9
KB
-rw-r--r--
entropy.py
930
B
-rw-r--r--
exim.py
1
KB
-rw-r--r--
file_presence.py
5.07
KB
-rw-r--r--
fortisase_connection.py
6.99
KB
-rw-r--r--
haproxy.py
13.46
KB
-rw-r--r--
io_stats.py
13.39
KB
-rw-r--r--
jboss.py
13.66
KB
-rw-r--r--
jmx.py
8.39
KB
-rw-r--r--
linux_logs.py
3.34
KB
-rw-r--r--
lm_sensors.py
2.54
KB
-rw-r--r--
logstash_forwarder.py
1.64
KB
-rw-r--r--
memcache.py
6.04
KB
-rw-r--r--
memory_usage.py
26.56
KB
-rw-r--r--
mongo.py
16.61
KB
-rw-r--r--
mysql.py
20.4
KB
-rw-r--r--
nagios.py
5.58
KB
-rw-r--r--
nginx.py
12.33
KB
-rw-r--r--
nodejs.py
6.44
KB
-rw-r--r--
ntp.py
1.98
KB
-rw-r--r--
opcache.py
2.3
KB
-rw-r--r--
oracle.py
15.6
KB
-rw-r--r--
package_upgrade.py
8.88
KB
-rw-r--r--
phpfpm.py
5.61
KB
-rw-r--r--
ping.py
2.6
KB
-rw-r--r--
postfix.py
1.99
KB
-rw-r--r--
postgresql.py
21.37
KB
-rw-r--r--
process.py
17.23
KB
-rw-r--r--
rabbitmq.py
19.85
KB
-rw-r--r--
redis.py
11.31
KB
-rw-r--r--
sendmail.py
2.42
KB
-rw-r--r--
sysctl.py
1.42
KB
-rw-r--r--
tcp.py
6.59
KB
-rw-r--r--
template.py
3.28
KB
-rw-r--r--
tomcat.py
7.09
KB
-rw-r--r--
tomcat_jmx.py
19.11
KB
-rw-r--r--
unbound_dns.py
4.62
KB
-rw-r--r--
uptime.py
3.61
KB
-rw-r--r--
users.py
1.09
KB
-rw-r--r--
uwsgi.py
4.73
KB
-rw-r--r--
varnish.py
4.91
KB
-rw-r--r--
weblogic.py
13.84
KB
-rw-r--r--
weblogic12c.py
19.2
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : process.py
import os import sys import agent_util try: import psutil except: psutil = None import re class ProcessPlugin(agent_util.Plugin): textkey = "process" label = "Process" @classmethod def get_metadata(self, config): status = agent_util.SUPPORTED msg = None if "aix" in sys.platform: status = agent_util.SUPPORTED msg = None elif "darwin" in sys.platform: status = agent_util.SUPPORTED msg = None elif "vmware" in sys.platform: status = agent_util.SUPPORTED msg = None elif psutil is None: # Unable to import psutil self.log.info( "Unable to import psutil library, no process metrics available" ) status = agent_util.UNSUPPORTED msg = "Unable to import psutil library, please install and rebuild metadata" elif not os.path.exists("/proc"): self.log.info("/proc not found") status = agent_util.UNSUPPORTED msg = "Enable procfs." return {} if "vmware" in sys.platform: metadata = { "process.named_count": { "label": "Number of processes - name", "options": None, "status": status, "error_message": msg, "unit": "processes", "option_string": True, }, "process.named_count.full": { "label": "Number of processes - full command line", "options": None, "status": status, "error_message": msg, "unit": "processes", "option_string": True, }, "process.exists": { "label": "Process is running", "options": None, "status": status, "error_message": msg, "unit": "boolean", "option_string": True, }, "process.exists.full": { "label": "Process is running - full command line", "options": None, "status": status, "error_message": msg, "unit": "boolean", "option_string": True, }, } else: metadata = { "process.running_count": { "label": "Number of processes running", "options": None, "status": status, "error_message": msg, "unit": "processes", }, "process.named_count": { "label": "Number of processes - name", "options": None, "status": status, "error_message": msg, "unit": "processes", "option_string": True, }, "process.named_memory_percentage": { "label": "Memory percentage of processes - name", "options": None, "status": status, "error_message": msg, "unit": "percent", "option_string": True, }, "process.named_cpu_percentage": { "label": "CPU percentage of processes - name", "options": None, "status": status, "error_message": msg, "unit": "percent", "option_string": True, }, "process.exists": { "label": "Process is running", "options": None, "status": status, "error_message": msg, "unit": "boolean", "option_string": True, }, "process.thread_count": { "label": "Process Thread Count - executable name only", "options": None, "status": status, "error_message": msg, "unit": "threads", "option_string": True, }, "process.named_count.full": { "label": "Number of processes - full command line", "options": None, "status": status, "error_message": msg, "unit": "processes", "option_string": True, }, "process.named_memory_percentage.full": { "label": "Memory percentage of processes - full command line", "options": None, "status": status, "error_message": msg, "unit": "percent", "option_string": True, }, "process.named_memory_raw_mb.full": { "label": "MB of memory used by processes - full command line", "options": None, "status": status, "error_message": msg, "unit": "MB", "option_string": True, }, "process.named_cpu_percentage.full": { "label": "CPU percentage of processes - full command line", "options": None, "status": status, "error_message": msg, "unit": "percent", "option_string": True, }, "process.exists.full": { "label": "Process is running - full command line", "options": None, "status": status, "error_message": msg, "unit": "boolean", "option_string": True, }, "process.thread_count.full": { "label": "Process Thread Count - executable name and args", "options": None, "status": status, "error_message": msg, "unit": "threads", "option_string": True, }, } return metadata def check(self, textkey, data, config): if "aix" in sys.platform or "sunos" in sys.platform: # ps_cmd = "ps -eo %p' '%a" if "aix" in sys.platform: ps_cmd = "ps axww" elif "sunos" in sys.platform: ps_cmd = "ps -eo pid' 'args" retcode, output = agent_util.execute_command(ps_cmd) output = output.split("\n") if textkey.endswith(".full"): textkey = textkey.rstrip(".full") if textkey == "process.running_count": return len(output) - 1 else: count = 0 pids = [] for line in output[1:]: if data in line: count += 1 pids.append(line.split()[0]) if textkey == "process.named_count": return count elif textkey == "process.exists": if count: return 1 else: return 0 elif textkey in [ "process.named_memory_percentage", "process.named_cpu_percentage", "named_memory_raw_mb", ]: all_cpu = 0 all_mem = 0 all_raw_kb = 0 for pid in pids: if "aix" in sys.platform: ps = "ps -fp %s -o pcpu,pmem,rss" % pid elif "sunos" in sys.platform: ps = "ps -fp %s -o pcpu,pmem,rss" % pid ret, output = agent_util.execute_command(ps) output = output.strip().split("\n") if len(output) < 2: continue fields = output[1].split() cpu = float(fields[0]) mem = float(fields[1]) raw_kb = float(fields[2]) all_cpu += cpu all_mem += mem all_raw_kb += raw_kb if textkey == "process.named_memory_percentage": return all_mem if textkey == "process.named_memory_raw_mb": return float(all_raw_kb) / 1024 else: return all_cpu # Unknown AIX/Solaris textkey return None # vmware logic elif "vmware" in sys.platform: pgrep = agent_util.which("pgrep") cmd = "" if not pgrep: self.log.error("Unable to find 'pgrep'! Unable to check for processes") return None if textkey.endswith(".full"): cmd = "%s -f" % (pgrep) else: cmd = "%s" % (pgrep) cmd += " %s" % data ret, output = agent_util.execute_command(cmd) out = output.split("\n") if textkey.startswith("process.named_count"): return len(out) - 1 if textkey.startswith("process.exists"): if len(out) - 1 > 0: return 1 else: return 0 if psutil is None: # Unable to import psutil, log and move on self.log.info( "Unable to import psutil library, no process metrics available" ) return None # Default Linux/FreeBSD logic search = "name" if textkey.endswith(".full"): textkey = textkey.rstrip(".full") search = "cmdline_str" # updated to use psutil library to get all processes and pull the name, pid and cmdline # this gets all the processes as objects process_objs = psutil.process_iter() processes = [] data = str(data) if textkey.startswith("process.named_cpu_percentage") and search == "name": for proc in process_objs: try: if re.search(data, proc.name()): processes.append( proc.as_dict(attrs=["pid", "cmdline", "name", "cpu_times"]) ) except psutil.NoSuchProcess: self.log.exception("Unable to get process.") continue elif ( textkey.startswith("process.named_cpu_percentage") and search == "cmdline_str" ): for proc in process_objs: try: if re.search(data, " ".join(proc.cmdline())): processes.append( proc.as_dict(attrs=["pid", "cmdline", "name", "cpu_times"]) ) except psutil.NoSuchProcess: self.log.exception("Unable to get process.") continue else: # this iterates through and shaves off infomation that isn't needed so we can filter on it later for proc in process_objs: try: processes.append( proc.as_dict( attrs=[ "pid", "cmdline", "name", "cpu_percent", "memory_percent", "memory_info", "num_threads", ] ) ) except psutil.NoSuchProcess: self.log.exception("Unable to get process.") continue # setting up a process list for us to transform the split cmdline entires into cmdline_str for proc in processes: if not proc["cmdline"]: proc["cmdline_str"] = "" continue proc["cmdline_str"] = " ".join(proc["cmdline"]) self.log.debug("All running processes:\n%s\n" % processes) if textkey == "process.running_count" or textkey == "count": return len(psutil.pids()) if textkey == "process.named_count": found_procs = [] self.log.info("Searching processes for '%s'" % data) for proc in processes: if proc[search] is not None and re.search(data, proc[search]): found_procs.append(proc) self.log.debug(found_procs) return len(found_procs) elif textkey == "process.exists": found_procs = [] self.log.info("Searching processes for '%s'" % data) for proc in processes: if proc[search] is not None and re.search(data, proc[search]): found_procs.append(proc) self.log.debug(found_procs) if found_procs: return 1 else: return 0 elif textkey in [ "process.named_memory_percentage", "process.named_memory_raw_mb", "process.thread_count", ]: found_procs = [] self.log.info("Searching processes for '%s'" % data) for proc in processes: if proc[search] is not None and re.search(data, proc[search]): found_procs.append(proc) self.log.debug(found_procs) self.log.debug( "Found matching processes: %s" % [p[search] for p in found_procs] ) # return 0 if no procs found if not found_procs: return 0 all_cpu = 0 all_mem = 0 all_raw_mem = 0 all_thread_count = 0 if "darwin" == sys.platform: rv = self.findDarwinProcInfo(found_procs) all_cpu = rv["cpu_percent"] all_mem = rv["memory_percent"] all_raw_mem = rv["memory_info"] all_thread_count = rv["num_threads"] else: for pid in found_procs: cpu = pid["cpu_percent"] mem = pid["memory_percent"] mem_raw = pid["memory_info"].rss thread_count = pid["num_threads"] all_cpu += cpu all_mem += mem all_raw_mem += mem_raw all_thread_count += thread_count all_raw_mem = float(all_raw_mem) / (1024 * 1024) if textkey == "process.named_memory_percentage": return all_mem if textkey == "process.named_memory_raw_mb": return all_raw_mem if textkey == "process.thread_count": return all_thread_count else: return all_cpu elif textkey in [ "process.named_cpu_percentage", "process.named_cpu_percentage.full", ]: if processes: user_sum = sum( [ p.get("cpu_times").user + p.get("cpu_times").system for p in processes ] ) else: return 0.0 last_result = self.get_cache_results(textkey, data) if not last_result: self.cache_result(textkey, data, user_sum) return None delta, previous = last_result[0] time_used_result = (user_sum - previous) / delta self.cache_result(textkey, data, user_sum) number_of_cores = psutil.cpu_count() if not number_of_cores: number_of_cores = 1 return (time_used_result / number_of_cores) * 100 return 0 def findDarwinProcInfo(self, found_procs): """ On OSX, psutil will not report process information on processes belonging to other users, unless the requesting process is privileged. https://github.com/giampaolo/psutil/issues/883 """ pids = [] for fp in found_procs: pids.append(str(fp["pid"])) rc, output = agent_util.execute_command("ps uM -p {}".format(",".join(pids))) lines = output.split("\n") procLines = lines[1:] rv = { "cpu_percent": float(0), "memory_percent": float(0), "memory_info": float(0), "num_threads": len(procLines), } for l in procLines: info = l.split() if len(info) == 14: # Full info line for process rv["cpu_percent"] += float(info[2]) rv["memory_percent"] += float(info[3]) rv["memory_info"] += float(info[5]) m = rv["memory_info"] rv["memory_info"] = float(m) / 1024 return rv
Close