mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
u
This commit is contained in:
@@ -169,9 +169,32 @@ class firewall_api:
|
||||
except:
|
||||
isPing = True
|
||||
|
||||
import system_api
|
||||
panelsys = system_api.system_api()
|
||||
version = panelsys.getSystemVersion()
|
||||
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"
|
||||
status = public.execShell(cmd)
|
||||
else:
|
||||
cmd = "service ssh status | grep -P '(dead|stop)'|grep -v grep"
|
||||
status = public.execShell(cmd)
|
||||
else:
|
||||
if version.find(' 7.') != -1:
|
||||
cmd = "systemctl status sshd.service | grep 'dead'|grep -v grep"
|
||||
status = public.execShell(cmd)
|
||||
else:
|
||||
cmd = "/etc/init.d/sshd status | grep -e 'stopped' -e '已停'|grep -v grep"
|
||||
status = public.execShell(cmd)
|
||||
if len(status[0]) > 3:
|
||||
status = False
|
||||
else:
|
||||
status = True
|
||||
|
||||
data = {}
|
||||
data['port'] = port
|
||||
data['status'] = True
|
||||
|
||||
data['status'] = status
|
||||
data['ping'] = isPing
|
||||
if public.isAppleSystem():
|
||||
data['firewall_status'] = False
|
||||
|
||||
Reference in New Issue
Block a user