Update firewall_api.py

pull/267/head
midoks 3 years ago
parent 36952614d4
commit 4cd456a76c
  1. 24
      class/core/firewall_api.py

@ -197,25 +197,17 @@ class firewall_api:
except: except:
isPing = True isPing = True
import system_api # sshd 检测
panelsys = system_api.system_api() status = True
if os.path.exists('/usr/bin/apt-get'):
if os.path.exists('/etc/init.d/sshd'):
cmd = "service sshd status | grep -P '(dead|stop)'|grep -v grep" cmd = "service sshd status | grep -P '(dead|stop)'|grep -v grep"
status = mw.execShell(cmd) ssh_status = mw.execShell(cmd)
else: if ssh_status[0] != '':
cmd = "service ssh status | grep -P '(dead|stop)'|grep -v grep" status = False
status = mw.execShell(cmd)
else:
cmd = "systemctl status sshd.service | grep 'dead'|grep -v grep" cmd = "systemctl status sshd.service | grep 'dead'|grep -v grep"
status = mw.execShell(cmd) ssh_status = mw.execShell(cmd)
# cmd = "/etc/init.d/sshd status | grep -e 'stopped' -e '已停'|grep -v grep" if ssh_status[0] != '':
# status = mw.execShell(cmd)
if len(status[0]) > 3:
status = False status = False
else:
status = True
data = {} data = {}
data['port'] = port data['port'] = port

Loading…
Cancel
Save