mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:19:26 +08:00
@@ -1090,9 +1090,15 @@ class plugins_api:
|
||||
if not os.path.exists(package):
|
||||
return (False, "插件不存在!")
|
||||
|
||||
sys.path.append(package)
|
||||
if not package in sys.path:
|
||||
sys.path.append(package)
|
||||
eval_str = "__import__('" + script + "')." + func + '(' + args + ')'
|
||||
newRet = eval(eval_str)
|
||||
newRet = None
|
||||
try:
|
||||
newRet = eval(eval_str)
|
||||
except Exception as e:
|
||||
print(mw.getTracebackInfo())
|
||||
|
||||
if mw.isDebugMode():
|
||||
print('callback', eval_str)
|
||||
|
||||
|
||||
@@ -849,7 +849,11 @@ class mainClass(object):
|
||||
if p_state == 'running': info['activity'] += 1
|
||||
if p_state in status_ps: p_state = status_ps[p_state]
|
||||
tmp['exe'] = p.exe()
|
||||
tmp['name'] = p.name()
|
||||
|
||||
try:
|
||||
tmp['name'] = p.name()
|
||||
except Exception as e:
|
||||
continue
|
||||
tmp['pid'] = pid
|
||||
tmp['ppid'] = p.ppid()
|
||||
tmp['create_time'] = int(p.create_time())
|
||||
@@ -1565,60 +1569,62 @@ class mainClass(object):
|
||||
print(tmp['cpu_percent'])
|
||||
|
||||
|
||||
mc_instance = mainClass.instance()
|
||||
|
||||
def get_network_list(args = {}):
|
||||
return mc_instance.get_network_list(args)
|
||||
return mainClass.instance().get_network_list(args)
|
||||
|
||||
def get_process_list(args = {}):
|
||||
return mc_instance.get_process_list(args)
|
||||
try:
|
||||
return mainClass.instance().get_process_list(args)
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
|
||||
|
||||
def kill_process(args = {}):
|
||||
return mc_instance.kill_process(args)
|
||||
return mainClass.instance().kill_process(args)
|
||||
|
||||
def kill_process_all(args = {}):
|
||||
if not 'pid' in args:
|
||||
return mw.returnData(False, '缺少参数!')
|
||||
return mc_instance.kill_process_all(int(args['pid']))
|
||||
return mainClass.instance().kill_process_all(int(args['pid']))
|
||||
|
||||
def set_meter_head(args = {}):
|
||||
return mc_instance.set_meter_head(args)
|
||||
return mainClass.instance().set_meter_head(args)
|
||||
|
||||
def remove_service(args = {}):
|
||||
return mc_instance.remove_service(args)
|
||||
return mainClass.instance().remove_service(args)
|
||||
|
||||
def set_runlevel_state(args = {}):
|
||||
return mc_instance.set_runlevel_state(args)
|
||||
return mainClass.instance().set_runlevel_state(args)
|
||||
|
||||
def get_service_list(args = {}):
|
||||
return mc_instance.get_service_list(args)
|
||||
return mainClass.instance().get_service_list(args)
|
||||
|
||||
def get_run_list(args = {}):
|
||||
return mc_instance.get_run_list(args)
|
||||
return mainClass.instance().get_run_list(args)
|
||||
|
||||
def get_cron_list(args = {}):
|
||||
return mc_instance.get_cron_list(args)
|
||||
return mainClass.instance().get_cron_list(args)
|
||||
|
||||
def remove_cron(args = {}):
|
||||
return mc_instance.remove_cron(args)
|
||||
return mainClass.instance().remove_cron(args)
|
||||
|
||||
def pkill_session(args = {}):
|
||||
return mc_instance.pkill_session(args)
|
||||
return mainClass.instance().pkill_session(args)
|
||||
|
||||
def get_who(args = {}):
|
||||
return mc_instance.get_who(args)
|
||||
return mainClass.instance().get_who(args)
|
||||
|
||||
def get_process_info(args = {}):
|
||||
return mc_instance.get_process_info(args)
|
||||
return mainClass.instance().get_process_info(args)
|
||||
|
||||
def get_user_list(args = {}):
|
||||
return mc_instance.get_user_list(args)
|
||||
return mainClass.instance().get_user_list(args)
|
||||
|
||||
def remove_user(args = {}):
|
||||
return mc_instance.remove_user(args)
|
||||
return mainClass.instance().remove_user(args)
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(mc_instance.get_process_list())
|
||||
# if __name__ == "__main__":
|
||||
# print(mc_instance.get_process_list())
|
||||
# print(mc_instance.get_network_list())
|
||||
# print(mc_instance.get_process_info({'pid':66647}))
|
||||
# for x in range(10):
|
||||
|
||||
@@ -54,14 +54,17 @@ else
|
||||
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
apt-get update -y
|
||||
apt update -y
|
||||
apt autoremove -y
|
||||
|
||||
apt install -y wget curl lsof unzip tar cron expect locate lrzsz
|
||||
apt install -y rar
|
||||
apt install -y unrar
|
||||
apt install -y pv
|
||||
apt install -y bc
|
||||
apt install -y python3-pip python3-dev python3-venv
|
||||
|
||||
apt install -y libncurses5
|
||||
apt install -y libncurses5-dev
|
||||
|
||||
if [ -f /usr/sbin/ufw ];then
|
||||
# look
|
||||
@@ -189,7 +192,7 @@ apt install -y dia
|
||||
apt install -y pkg-config
|
||||
apt install -y zlib1g-dev
|
||||
|
||||
apt install -y libevent-dev libncurses5-dev libldap2-dev
|
||||
apt install -y libevent-dev libldap2-dev
|
||||
apt install -y libzip-dev
|
||||
apt install -y libicu-dev
|
||||
apt install -y libyaml-dev
|
||||
|
||||
@@ -10,7 +10,7 @@ if grep -Eq "Ubuntu" /etc/*-release; then
|
||||
fi
|
||||
|
||||
apt update -y
|
||||
apt-get update -y
|
||||
apt autoremove -y
|
||||
|
||||
apt install -y wget curl lsof unzip
|
||||
apt install -y rar unrar
|
||||
|
||||
@@ -47,14 +47,14 @@ elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eqi "AlmaLinux" /etc/*-release; t
|
||||
elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eqi "Amazon Linux" /etc/*-release; then
|
||||
OSNAME='amazon'
|
||||
yum install -y wget zip unzip tar
|
||||
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eqi "Ubuntu" /etc/*-release; then
|
||||
OSNAME='ubuntu'
|
||||
apt install -y wget zip unzip tar
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eqi "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
apt update -y
|
||||
apt install -y devscripts
|
||||
apt install -y wget zip unzip tar
|
||||
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eqi "Ubuntu" /etc/*-release; then
|
||||
OSNAME='ubuntu'
|
||||
apt install -y wget zip unzip tar
|
||||
else
|
||||
OSNAME='unknow'
|
||||
fi
|
||||
@@ -81,6 +81,7 @@ if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
|
||||
fi
|
||||
|
||||
echo "local:${LOCAL_ADDR}"
|
||||
echo "OSNAME:${OSNAME}"
|
||||
|
||||
if [ $OSNAME != "macos" ];then
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,6 @@ rm -rf ${libPath}/lib.pl
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
echo "${OSNAME}:${VERSION_ID}"
|
||||
|
||||
# system judge
|
||||
if [ "$OSNAME" == "macos" ]; then
|
||||
@@ -55,6 +54,7 @@ elif [ "$OSNAME" == "debian" ]; then
|
||||
else
|
||||
echo "OK"
|
||||
fi
|
||||
echo "system:${OSNAME}:${VERSION_ID}"
|
||||
|
||||
|
||||
# HTTP_PREFIX="https://"
|
||||
|
||||
Reference in New Issue
Block a user