File manager - Edit - /home/wwwroot/cybermon/system-v1.py
Back
import os, subprocess, requests, json from uuid import getnode as get_mac mac = get_mac() print(mac) r = requests.get('http://mon.cyberarts.com.hk/get.php?mac='+str(mac)) print(r.text) response = json.loads(r.text) memory = {} tot_m, used_m, free_m, a, b, c = map(int, os.popen('free -t -m').readlines()[1].split()[1:]) memory['total'] = tot_m memory['used'] = used_m memory['free'] = free_m CPU_Pct=str(round(float(os.popen('''grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage }' ''').readline()),2)) uptime=str(round(float(os.popen('''cat /proc/uptime | awk '{uptime=($1)/1.0} END {print uptime}' ''').readline()),0)) p = subprocess.Popen(["ps", "-A"], stdout=subprocess.PIPE) out, err = p.communicate() process = {} list = response['process'].split(',') for proc in list: if (proc in str(out)): process[proc]=1 else: process[proc]=0 data = {} data["mac"] = mac data["memory"] = memory data["cpu"] = CPU_Pct data["process"] = process data["uptime"] = uptime data["device_id"] = response['id'] jsonarray = json.dumps(data) print(jsonarray) t = requests.post("http://mon.cyberarts.com.hk/post.php", data={'data':str(jsonarray)}) print(t.text)
| ver. 1.4 |
Github
|
.
| PHP 7.2.34 | Generation time: 1.29 |
proxy
|
phpinfo
|
Settings