Hackfut Security File Manager
Current Path:
/usr/local/lib/python3.6/site-packages/agent360/plugins
usr
/
local
/
lib
/
python3.6
/
site-packages
/
agent360
/
plugins
/
📁
..
📄
__init__.py
(0 B)
📁
__pycache__
📄
apt-updates.py
(1.23 KB)
📄
asterisk.py
(1012 B)
📄
bind.py
(732 B)
📄
bird.py
(841 B)
📄
bitninja.py
(1.27 KB)
📄
cloudlinux-dbgov.py
(1.04 KB)
📄
cloudlinux.py
(1020 B)
📄
cpanel.py
(1.41 KB)
📄
cpu.py
(1.97 KB)
📄
cpu_freq.py
(583 B)
📄
dirsize.py
(617 B)
📄
diskinodes.py
(652 B)
📄
diskstatus-nvme.py
(1.58 KB)
📄
diskstatus.py
(1.96 KB)
📄
diskusage.py
(4.04 KB)
📄
docker.py
(3.36 KB)
📄
dovecot.py
(1.27 KB)
📄
elasticsearch.py
(4.24 KB)
📄
exim.py
(484 B)
📄
fail2ban.py
(831 B)
📄
gpu.py
(959 B)
📄
haproxy.py
(4.17 KB)
📄
httpd.py
(2.73 KB)
📄
iostat.py
(5.1 KB)
📄
janus.py
(705 B)
📄
kamailio.py
(556 B)
📄
litespeed.py
(3.04 KB)
📄
loadavg.py
(332 B)
📄
loggedin.py
(400 B)
📄
mailq.py
(528 B)
📄
mdstat.py
(1.36 KB)
📄
megacli.py
(2.72 KB)
📄
memcached.py
(3.09 KB)
📄
memory.py
(932 B)
📄
minecraft.py
(2.35 KB)
📄
mongodb.py
(5.63 KB)
📄
mysql.py
(5.13 KB)
📄
network.py
(2.72 KB)
📄
nginx.py
(3.2 KB)
📄
openvpn.py
(2.17 KB)
📄
phpfpm.py
(2.72 KB)
📄
ping.py
(3.09 KB)
📄
plesk-cgroups.py
(6.18 KB)
📄
plugins.py
(2.48 KB)
📄
postfix.py
(1.73 KB)
📄
powerdns.py
(4.56 KB)
📄
process.py
(4.26 KB)
📄
proftpd.py
(1.1 KB)
📄
rabbitmq.py
(3.49 KB)
📄
redis_stat.py
(5.48 KB)
📄
sleeper.py
(244 B)
📄
swap.py
(364 B)
📄
system.py
(5.67 KB)
📄
tcpports.py
(1.08 KB)
📄
temp.py
(1.45 KB)
📄
unbound.py
(3.24 KB)
📄
vms.py
(6.2 KB)
📄
wp-toolkit.py
(1.8 KB)
📄
yum-updates.py
(810 B)
Editing: ping.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re from subprocess import Popen, PIPE, CalledProcessError import sys import plugins def _get_match_groups(ping_output, regex): match = regex.search(ping_output) if not match: return False else: return match.groups() def system_command(Command, newlines=True): Output = "" Error = "" try: proc = Popen(Command.split(), stdout=PIPE) Output = proc.communicate()[0] except Exception: pass if Output: if newlines is True: Stdout = Output.split("\\n") else: Stdout = Output else: Stdout = [] if Error: Stderr = Error.split("\n") else: Stderr = [] return (Stdout, Stderr) def collect_ping(hostname): if sys.platform.startswith('linux') or sys.platform.startswith('freebsd'): #if sys.platform == "linux" or sys.platform == "linux2": response = str(system_command("ping -W 5 -c 1 " + hostname, False)[0]) try: matcher = re.compile(r'(\d+.\d+)/(\d+.\d+)/(\d+.\d+)/(\d+.\d+)') minping, avgping, maxping, jitter = _get_match_groups(response, matcher) response = avgping except Exception: #response = 9999 response = -1 elif sys.platform == "darwin": response = str(system_command("ping -c 1 " + hostname, False)[0]) # matcher = re.compile(r'min/avg/max/stddev = (\d+)/(\d+)/(\d+)/(\d+) ms') # min, avg, max, stddev = _get_match_groups(response, matcher) matcher = re.compile(r'(\d+.\d+)/(\d+.\d+)/(\d+.\d+)/(\d+.\d+)') matched = _get_match_groups(response, matcher) if matched is False: #response = 0 response = -1 else: minping, avgping, maxping, jitter = matched response = avgping elif sys.platform == "win32": #response = 0 response = -1 try: ping = Popen(["ping", "-n", "1 ", hostname], stdout=PIPE, stderr=PIPE) out, error = ping.communicate() if out: try: response = int(re.findall(r"Average = (\d+)", out)[0]) except Exception: pass else: #response = 0 response = -1 except CalledProcessError: pass if response == -1: try: rxresponse = re.findall(br" + .+ = [0-9]{1,9}ms, .+ = [0-9]{1,9}ms, .+ = (\d+){1,9}ms", out) response = rxresponse[0].decode() except Exception: pass else: #response = float(system_command("ping -W -c 1 " + hostname)) response = -1 return {'avgping': response, 'host': hostname} class Plugin(plugins.BasePlugin): __name__ = 'ping' def run(self, config): data = {} my_hosts = config.get('ping', 'hosts').split(',') data['ping'] = [] for host in my_hosts: data['ping'].append(collect_ping(host)) return data['ping'] if __name__ == '__main__': Plugin().execute()
Upload File
Create Folder