Fix E722 warnings

This commit is contained in:
Shreya 2021-04-05 18:22:32 +05:30
parent 7bfdc3c7e5
commit d0168dfb9e
7 changed files with 19 additions and 19 deletions

View File

@ -37,12 +37,12 @@ class MongoUtils:
# ISWbemObjectEx interface. Class Uint8Array ?
if str(o._oleobj_.GetTypeInfo().GetTypeAttr().iid) == "{269AD56A-8A67-4129-BC8C-0506DCFE9880}":
return o.Value
except:
except Exception:
pass
try:
return o.GetObjectText_()
except:
except Exception:
pass
return repr(o)

View File

@ -148,7 +148,7 @@ class SmbExploiter(HostExploiter):
try:
scmr.hRStartServiceW(scmr_rpc, service)
status = ScanStatus.USED
except:
except Exception:
status = ScanStatus.SCANNED
pass
T1035Telem(status, UsageEnum.SMB).send()

View File

@ -42,7 +42,7 @@ class SmbTools(object):
try:
smb.logoff()
except:
except Exception:
pass
return None
@ -134,7 +134,7 @@ class SmbTools(object):
return remote_full_path
LOG.debug("Remote monkey file is found but different, moving along with attack")
except:
except Exception:
pass # file isn't found on remote victim, moving on
try:
@ -163,7 +163,7 @@ class SmbTools(object):
finally:
try:
smb.logoff()
except:
except Exception:
pass
smb = None

View File

@ -58,7 +58,7 @@ class WmiTools(object):
try:
self._iWbemServices = iWbemLevel1Login.NTLMLogin('//./root/cimv2', NULL, NULL)
self._dcom = dcom
except:
except Exception:
dcom.disconnect()
raise

View File

@ -46,7 +46,7 @@ class WinAdvFirewall(FirewallApp):
state = l.split()[-1].strip()
return state == "ON"
except:
except Exception:
return None
def add_firewall_rule(self, name="Firewall", direction="in", action="allow", program=sys.executable, **kwargs):
@ -61,7 +61,7 @@ class WinAdvFirewall(FirewallApp):
return True
else:
return False
except:
except Exception:
return None
def remove_firewall_rule(self, name="Firewall", **kwargs):
@ -75,7 +75,7 @@ class WinAdvFirewall(FirewallApp):
return True
else:
return False
except:
except Exception:
return None
def listen_allowed(self, **kwargs):
@ -94,7 +94,7 @@ class WinAdvFirewall(FirewallApp):
try:
for rule in list(self._rules.keys()):
self.remove_firewall_rule(name=rule)
except:
except Exception:
pass
@ -114,7 +114,7 @@ class WinFirewall(FirewallApp):
return False
return state == "Enable"
except:
except Exception:
return None
def add_firewall_rule(self, rule='allowedprogram', name="Firewall", mode="ENABLE", program=sys.executable,
@ -131,7 +131,7 @@ class WinFirewall(FirewallApp):
return True
else:
return False
except:
except Exception:
return None
def remove_firewall_rule(self, rule='allowedprogram', name="Firewall", mode="ENABLE", program=sys.executable,
@ -145,7 +145,7 @@ class WinFirewall(FirewallApp):
return True
else:
return False
except:
except Exception:
return None
def listen_allowed(self, **kwargs):
@ -161,14 +161,14 @@ class WinFirewall(FirewallApp):
try:
for rule in list(self._rules.values()):
self.remove_firewall_rule(**rule)
except:
except Exception:
pass
if sys.platform == "win32":
try:
win_ver = int(platform.version().split('.')[0])
except:
except Exception:
win_ver = 0
if win_ver > 5:
app = WinAdvFirewall()

View File

@ -47,7 +47,7 @@ class FileServHTTPRequestHandler(http.server.BaseHTTPRequestHandler):
chunk = end_range - start_range
try:
self.wfile.write(f.read(chunk))
except:
except Exception:
break
total += chunk
start_range += chunk

View File

@ -32,13 +32,13 @@ class SocketsPipe(Thread):
other = self.dest if r is self.source else self.source
try:
data = r.recv(READ_BUFFER_SIZE)
except:
except Exception:
break
if data:
try:
other.sendall(data)
update_last_serve_time()
except:
except Exception:
break
self._keep_connection = True