Update firewall_api.py

pull/109/head
Mr Chen 6 years ago
parent c7deeec29a
commit ce55a84265
  1. 16
      class/core/firewall_api.py

@ -39,10 +39,24 @@ class firewall_api:
rep = "#*Port\s+([0-9]+)\s*\n"
port = re.search(rep, conf).groups(0)[0]
isPing = True
try:
if public.isAppleSystem():
isPing = True
else:
file = '/etc/sysctl.conf'
conf = public.readFile(file)
rep = "#*net\.ipv4\.icmp_echo_ignore_all\s*=\s*([0-9]+)"
tmp = re.search(rep, conf).groups(0)[0]
if tmp == '1':
isPing = False
except:
isPing = True
data = {}
data['port'] = port
data['status'] = True
data['ping'] = True
data['ping'] = isPing
if public.isAppleSystem():
data['firewall_status'] = False
else:

Loading…
Cancel
Save