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) cmd = subprocess.Popen('netsh advfirewall show currentprofile', stdout=subprocess.PIPE)
out = cmd.stdout.readlines() out = cmd.stdout.readlines()
for l in out: for line in out:
if l.startswith('State'): if line.startswith('State'):
state = l.split()[-1].strip() state = line.split()[-1].strip()
return state == "ON" return state == "ON"
except Exception: except Exception:
@ -107,10 +107,10 @@ class WinFirewall(FirewallApp):
cmd = subprocess.Popen('netsh firewall show state', stdout=subprocess.PIPE) cmd = subprocess.Popen('netsh firewall show state', stdout=subprocess.PIPE)
out = cmd.stdout.readlines() out = cmd.stdout.readlines()
for l in out: for line in out:
if l.startswith('Operational mode'): if line.startswith('Operational mode'):
state = l.split('=')[-1].strip() state = line.split('=')[-1].strip()
elif l.startswith('The service has not been started.'): elif line.startswith('The service has not been started.'):
return False return False
return state == "Enable" return state == "Enable"

View File

@ -75,8 +75,8 @@ else:
ifaddr = socket.inet_ntoa(ifreq[20:24]) ifaddr = socket.inet_ntoa(ifreq[20:24])
routes.append((dst, msk, "0.0.0.0", LOOPBACK_NAME, ifaddr)) routes.append((dst, msk, "0.0.0.0", LOOPBACK_NAME, ifaddr))
for l in f.readlines()[1:]: for line in f.readlines()[1:]:
iff, dst, gw, flags, x, x, x, msk, x, x, x = [var.encode() for var in l.split()] iff, dst, gw, flags, x, x, x, msk, x, x, x = [var.encode() for var in line.split()]
flags = int(flags, 16) flags = int(flags, 16)
if flags & RTF_UP == 0: if flags & RTF_UP == 0:
continue continue