[smb] smbexec: try in 'hRCreateServiceW'

Signed-off-by: XiaoliChan <2209553467@qq.com>
main
XiaoliChan 2023-08-16 18:00:10 +08:00
parent b9ef2d1b91
commit ed0a295435
1 changed files with 18 additions and 10 deletions

View File

@ -127,6 +127,8 @@ class SMBEXEC:
self.logger.debug("Command to execute: " + command)
self.logger.debug(f"Remote service {self.__serviceName} created.")
try:
resp = scmr.hRCreateServiceW(
self.__scmr,
self.__scHandle,
@ -136,6 +138,12 @@ class SMBEXEC:
dwStartType=scmr.SERVICE_DEMAND_START,
)
service = resp["lpServiceHandle"]
except Exception as e:
if "rpc_s_access_denied" in str(e):
self.logger.fail("SMBEXEC: Create services got blocked.")
return self.__outputBuffer
else:
pass
try:
self.logger.debug(f"Remote service {self.__serviceName} started.")