forked from p15670423/monkey
agent: resolve E741 flake8 warnings
This commit is contained in:
parent
07afa27ec1
commit
46be7ae0d4
|
@ -41,9 +41,9 @@ class WinAdvFirewall(FirewallApp):
|
|||
cmd = subprocess.Popen('netsh advfirewall show currentprofile', stdout=subprocess.PIPE)
|
||||
out = cmd.stdout.readlines()
|
||||
|
||||
for l in out:
|
||||
if l.startswith('State'):
|
||||
state = l.split()[-1].strip()
|
||||
for line in out:
|
||||
if line.startswith('State'):
|
||||
state = line.split()[-1].strip()
|
||||
|
||||
return state == "ON"
|
||||
except Exception:
|
||||
|
@ -107,10 +107,10 @@ class WinFirewall(FirewallApp):
|
|||
cmd = subprocess.Popen('netsh firewall show state', stdout=subprocess.PIPE)
|
||||
out = cmd.stdout.readlines()
|
||||
|
||||
for l in out:
|
||||
if l.startswith('Operational mode'):
|
||||
state = l.split('=')[-1].strip()
|
||||
elif l.startswith('The service has not been started.'):
|
||||
for line in out:
|
||||
if line.startswith('Operational mode'):
|
||||
state = line.split('=')[-1].strip()
|
||||
elif line.startswith('The service has not been started.'):
|
||||
return False
|
||||
|
||||
return state == "Enable"
|
||||
|
|
|
@ -75,8 +75,8 @@ else:
|
|||
ifaddr = socket.inet_ntoa(ifreq[20:24])
|
||||
routes.append((dst, msk, "0.0.0.0", LOOPBACK_NAME, ifaddr))
|
||||
|
||||
for l in f.readlines()[1:]:
|
||||
iff, dst, gw, flags, x, x, x, msk, x, x, x = [var.encode() for var in l.split()]
|
||||
for line in f.readlines()[1:]:
|
||||
iff, dst, gw, flags, x, x, x, msk, x, x, x = [var.encode() for var in line.split()]
|
||||
flags = int(flags, 16)
|
||||
if flags & RTF_UP == 0:
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue