agent: resolve E741 flake8 warnings

This commit is contained in:
Mike Salvatore 2021-04-05 14:48:33 -04:00
parent 07afa27ec1
commit 46be7ae0d4
2 changed files with 9 additions and 9 deletions

View File

@ -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"

View File

@ -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