From dc76d4136992de64592feb644b72d9de0d694421 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 21:21:36 +0800 Subject: [PATCH 01/16] Update ubuntu.sh --- scripts/install/ubuntu.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install/ubuntu.sh b/scripts/install/ubuntu.sh index 33c677fa9..1837772d8 100644 --- a/scripts/install/ubuntu.sh +++ b/scripts/install/ubuntu.sh @@ -10,7 +10,6 @@ if grep -Eq "Ubuntu" /etc/*-release; then fi apt update -y -apt-get update -y apt install -y wget curl lsof unzip apt install -y rar unrar From af629be9e0ce27a56be2b37f920a6bde16ac0de2 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 21:27:30 +0800 Subject: [PATCH 02/16] Update task_manager_index.py --- plugins/task_manager/task_manager_index.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/task_manager/task_manager_index.py b/plugins/task_manager/task_manager_index.py index f172e4b25..4dde0e3a9 100755 --- a/plugins/task_manager/task_manager_index.py +++ b/plugins/task_manager/task_manager_index.py @@ -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()) From ddacecec9a4db5c11a077dbd43f3ef7a1e2cb1c4 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 22:07:27 +0800 Subject: [PATCH 03/16] Update plugins_api.py --- class/core/plugins_api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/class/core/plugins_api.py b/class/core/plugins_api.py index 160bc657b..b4770017a 100755 --- a/class/core/plugins_api.py +++ b/class/core/plugins_api.py @@ -1090,7 +1090,8 @@ 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) if mw.isDebugMode(): From 692f51fe441425d8e53defd0d559b81857988cec Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 22:11:51 +0800 Subject: [PATCH 04/16] update --- class/core/plugins_api.py | 7 ++++++- plugins/task_manager/task_manager_index.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/class/core/plugins_api.py b/class/core/plugins_api.py index b4770017a..0e5f56fe0 100755 --- a/class/core/plugins_api.py +++ b/class/core/plugins_api.py @@ -1093,7 +1093,12 @@ class plugins_api: if not package in sys.path: sys.path.append(package) eval_str = "__import__('" + script + "')." + func + '(' + args + ')' - newRet = eval(eval_str) + + try: + newRet = eval(eval_str) + except Exception as e: + print(mw.getTracebackInfo()) + if mw.isDebugMode(): print('callback', eval_str) diff --git a/plugins/task_manager/task_manager_index.py b/plugins/task_manager/task_manager_index.py index 4dde0e3a9..d2b82414a 100755 --- a/plugins/task_manager/task_manager_index.py +++ b/plugins/task_manager/task_manager_index.py @@ -1621,8 +1621,8 @@ def get_user_list(args = {}): def remove_user(args = {}): return mc_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): From 189f73e5227ba506b837a73123670cecdd1a0674 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 22:18:09 +0800 Subject: [PATCH 05/16] Update plugins_api.py --- class/core/plugins_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/core/plugins_api.py b/class/core/plugins_api.py index 0e5f56fe0..9579c5fac 100755 --- a/class/core/plugins_api.py +++ b/class/core/plugins_api.py @@ -1093,7 +1093,7 @@ class plugins_api: if not package in sys.path: sys.path.append(package) eval_str = "__import__('" + script + "')." + func + '(' + args + ')' - + newRet = None try: newRet = eval(eval_str) except Exception as e: From 828a0791848394a290105cf81bf5de021dd72abb Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 22:31:36 +0800 Subject: [PATCH 06/16] Update task_manager_index.py --- plugins/task_manager/task_manager_index.py | 38 ++++++++++++---------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/plugins/task_manager/task_manager_index.py b/plugins/task_manager/task_manager_index.py index d2b82414a..a864e3c4a 100755 --- a/plugins/task_manager/task_manager_index.py +++ b/plugins/task_manager/task_manager_index.py @@ -1569,57 +1569,59 @@ 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()) From cc01c5cbc131cbd5b46b6b170ba28f2c0c4b945d Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 22:41:29 +0800 Subject: [PATCH 07/16] Update debian.sh --- scripts/install/debian.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index 14612ee03..4b48cf6d2 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -61,7 +61,8 @@ 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 +190,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 From ed8af0728b404db777bbca262edcdb6a5e574bfa Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 22:43:35 +0800 Subject: [PATCH 08/16] Update ubuntu.sh --- scripts/install/ubuntu.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install/ubuntu.sh b/scripts/install/ubuntu.sh index 1837772d8..3aae94dd8 100644 --- a/scripts/install/ubuntu.sh +++ b/scripts/install/ubuntu.sh @@ -66,7 +66,6 @@ if [ ! -f /usr/sbin/ufw ];then firewall-cmd --permanent --zone=public --add-port=80/tcp firewall-cmd --permanent --zone=public --add-port=443/tcp - firewall-cmd --permanent --zone=public --add-port=443/udp # firewall-cmd --permanent --zone=public --add-port=888/tcp systemctl start firewalld From 2a088241da2deca7ddce93bf6c07daf2f63f041c Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 22:43:46 +0800 Subject: [PATCH 09/16] Update ubuntu.sh --- scripts/install/ubuntu.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install/ubuntu.sh b/scripts/install/ubuntu.sh index 3aae94dd8..1837772d8 100644 --- a/scripts/install/ubuntu.sh +++ b/scripts/install/ubuntu.sh @@ -66,6 +66,7 @@ if [ ! -f /usr/sbin/ufw ];then firewall-cmd --permanent --zone=public --add-port=80/tcp firewall-cmd --permanent --zone=public --add-port=443/tcp + firewall-cmd --permanent --zone=public --add-port=443/udp # firewall-cmd --permanent --zone=public --add-port=888/tcp systemctl start firewalld From 9c3dcaf2ecf5bfdefa5486fc04749e57bee360ca Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 22:51:04 +0800 Subject: [PATCH 10/16] Update debian.sh --- scripts/install/debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index 4b48cf6d2..db709de21 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -54,7 +54,7 @@ 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 install -y wget curl lsof unzip tar cron expect locate lrzsz apt install -y rar apt install -y unrar From a3a44e149452c5dc2e0c2d4d9953353dab45e9e1 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 23:14:37 +0800 Subject: [PATCH 11/16] Update install_dev.sh --- scripts/install_dev.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install_dev.sh b/scripts/install_dev.sh index b9604fae2..751b7322d 100755 --- a/scripts/install_dev.sh +++ b/scripts/install_dev.sh @@ -81,6 +81,7 @@ if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then fi echo "local:${LOCAL_ADDR}" +echo "OSNAME:${OSNAME}" if [ $OSNAME != "macos" ];then From 22fe2477078dd4dfbcc0ff6bb6726ee1047b05a4 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 23:19:11 +0800 Subject: [PATCH 12/16] Update install_dev.sh --- scripts/install_dev.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install_dev.sh b/scripts/install_dev.sh index 751b7322d..364506ef5 100755 --- a/scripts/install_dev.sh +++ b/scripts/install_dev.sh @@ -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 From e72f33b20199643a79076793fa42cd82a45b25ce Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 23:21:59 +0800 Subject: [PATCH 13/16] Update lib.sh --- scripts/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib.sh b/scripts/lib.sh index a1cb36332..2f0dbcc0a 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -24,7 +24,7 @@ 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}" +echo "system:${OSNAME}:${VERSION_ID}" # system judge if [ "$OSNAME" == "macos" ]; then From e3bb8e6463d0ab84d6c5290c4220534501013cbb Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 23:22:12 +0800 Subject: [PATCH 14/16] Update lib.sh --- scripts/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib.sh b/scripts/lib.sh index 2f0dbcc0a..ebe40eacf 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -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 "system:${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://" From b9eee76b6ea3832bf3249e77cda9e3ccbcdd9ea2 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 23:24:36 +0800 Subject: [PATCH 15/16] Update ubuntu.sh --- scripts/install/ubuntu.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install/ubuntu.sh b/scripts/install/ubuntu.sh index 1837772d8..1cfbcc31d 100644 --- a/scripts/install/ubuntu.sh +++ b/scripts/install/ubuntu.sh @@ -10,6 +10,7 @@ if grep -Eq "Ubuntu" /etc/*-release; then fi apt update -y +apt autoremove -y apt install -y wget curl lsof unzip apt install -y rar unrar From 285aa45de8222cb70baa7d003953a8a2ed8b94c8 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 15 Jun 2024 23:25:10 +0800 Subject: [PATCH 16/16] Update debian.sh --- scripts/install/debian.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index db709de21..28b538ae0 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -55,6 +55,8 @@ else fi 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