forked from p15670423/monkey
Fix E722 warnings
This commit is contained in:
parent
7bfdc3c7e5
commit
d0168dfb9e
|
@ -37,12 +37,12 @@ class MongoUtils:
|
||||||
# ISWbemObjectEx interface. Class Uint8Array ?
|
# ISWbemObjectEx interface. Class Uint8Array ?
|
||||||
if str(o._oleobj_.GetTypeInfo().GetTypeAttr().iid) == "{269AD56A-8A67-4129-BC8C-0506DCFE9880}":
|
if str(o._oleobj_.GetTypeInfo().GetTypeAttr().iid) == "{269AD56A-8A67-4129-BC8C-0506DCFE9880}":
|
||||||
return o.Value
|
return o.Value
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return o.GetObjectText_()
|
return o.GetObjectText_()
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return repr(o)
|
return repr(o)
|
||||||
|
|
|
@ -148,7 +148,7 @@ class SmbExploiter(HostExploiter):
|
||||||
try:
|
try:
|
||||||
scmr.hRStartServiceW(scmr_rpc, service)
|
scmr.hRStartServiceW(scmr_rpc, service)
|
||||||
status = ScanStatus.USED
|
status = ScanStatus.USED
|
||||||
except:
|
except Exception:
|
||||||
status = ScanStatus.SCANNED
|
status = ScanStatus.SCANNED
|
||||||
pass
|
pass
|
||||||
T1035Telem(status, UsageEnum.SMB).send()
|
T1035Telem(status, UsageEnum.SMB).send()
|
||||||
|
|
|
@ -42,7 +42,7 @@ class SmbTools(object):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
smb.logoff()
|
smb.logoff()
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
@ -134,7 +134,7 @@ class SmbTools(object):
|
||||||
return remote_full_path
|
return remote_full_path
|
||||||
|
|
||||||
LOG.debug("Remote monkey file is found but different, moving along with attack")
|
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
|
pass # file isn't found on remote victim, moving on
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -163,7 +163,7 @@ class SmbTools(object):
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
smb.logoff()
|
smb.logoff()
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
smb = None
|
smb = None
|
||||||
|
|
|
@ -58,7 +58,7 @@ class WmiTools(object):
|
||||||
try:
|
try:
|
||||||
self._iWbemServices = iWbemLevel1Login.NTLMLogin('//./root/cimv2', NULL, NULL)
|
self._iWbemServices = iWbemLevel1Login.NTLMLogin('//./root/cimv2', NULL, NULL)
|
||||||
self._dcom = dcom
|
self._dcom = dcom
|
||||||
except:
|
except Exception:
|
||||||
dcom.disconnect()
|
dcom.disconnect()
|
||||||
|
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -46,7 +46,7 @@ class WinAdvFirewall(FirewallApp):
|
||||||
state = l.split()[-1].strip()
|
state = l.split()[-1].strip()
|
||||||
|
|
||||||
return state == "ON"
|
return state == "ON"
|
||||||
except:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def add_firewall_rule(self, name="Firewall", direction="in", action="allow", program=sys.executable, **kwargs):
|
def add_firewall_rule(self, name="Firewall", direction="in", action="allow", program=sys.executable, **kwargs):
|
||||||
|
@ -61,7 +61,7 @@ class WinAdvFirewall(FirewallApp):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
except:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def remove_firewall_rule(self, name="Firewall", **kwargs):
|
def remove_firewall_rule(self, name="Firewall", **kwargs):
|
||||||
|
@ -75,7 +75,7 @@ class WinAdvFirewall(FirewallApp):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
except:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def listen_allowed(self, **kwargs):
|
def listen_allowed(self, **kwargs):
|
||||||
|
@ -94,7 +94,7 @@ class WinAdvFirewall(FirewallApp):
|
||||||
try:
|
try:
|
||||||
for rule in list(self._rules.keys()):
|
for rule in list(self._rules.keys()):
|
||||||
self.remove_firewall_rule(name=rule)
|
self.remove_firewall_rule(name=rule)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ class WinFirewall(FirewallApp):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return state == "Enable"
|
return state == "Enable"
|
||||||
except:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def add_firewall_rule(self, rule='allowedprogram', name="Firewall", mode="ENABLE", program=sys.executable,
|
def add_firewall_rule(self, rule='allowedprogram', name="Firewall", mode="ENABLE", program=sys.executable,
|
||||||
|
@ -131,7 +131,7 @@ class WinFirewall(FirewallApp):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
except:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def remove_firewall_rule(self, rule='allowedprogram', name="Firewall", mode="ENABLE", program=sys.executable,
|
def remove_firewall_rule(self, rule='allowedprogram', name="Firewall", mode="ENABLE", program=sys.executable,
|
||||||
|
@ -145,7 +145,7 @@ class WinFirewall(FirewallApp):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
except:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def listen_allowed(self, **kwargs):
|
def listen_allowed(self, **kwargs):
|
||||||
|
@ -161,14 +161,14 @@ class WinFirewall(FirewallApp):
|
||||||
try:
|
try:
|
||||||
for rule in list(self._rules.values()):
|
for rule in list(self._rules.values()):
|
||||||
self.remove_firewall_rule(**rule)
|
self.remove_firewall_rule(**rule)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
try:
|
try:
|
||||||
win_ver = int(platform.version().split('.')[0])
|
win_ver = int(platform.version().split('.')[0])
|
||||||
except:
|
except Exception:
|
||||||
win_ver = 0
|
win_ver = 0
|
||||||
if win_ver > 5:
|
if win_ver > 5:
|
||||||
app = WinAdvFirewall()
|
app = WinAdvFirewall()
|
||||||
|
|
|
@ -47,7 +47,7 @@ class FileServHTTPRequestHandler(http.server.BaseHTTPRequestHandler):
|
||||||
chunk = end_range - start_range
|
chunk = end_range - start_range
|
||||||
try:
|
try:
|
||||||
self.wfile.write(f.read(chunk))
|
self.wfile.write(f.read(chunk))
|
||||||
except:
|
except Exception:
|
||||||
break
|
break
|
||||||
total += chunk
|
total += chunk
|
||||||
start_range += chunk
|
start_range += chunk
|
||||||
|
|
|
@ -32,13 +32,13 @@ class SocketsPipe(Thread):
|
||||||
other = self.dest if r is self.source else self.source
|
other = self.dest if r is self.source else self.source
|
||||||
try:
|
try:
|
||||||
data = r.recv(READ_BUFFER_SIZE)
|
data = r.recv(READ_BUFFER_SIZE)
|
||||||
except:
|
except Exception:
|
||||||
break
|
break
|
||||||
if data:
|
if data:
|
||||||
try:
|
try:
|
||||||
other.sendall(data)
|
other.sendall(data)
|
||||||
update_last_serve_time()
|
update_last_serve_time()
|
||||||
except:
|
except Exception:
|
||||||
break
|
break
|
||||||
self._keep_connection = True
|
self._keep_connection = True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue