Skip to content

Commit

Permalink
[dcom] add 'set_connect_timeout'
Browse files Browse the repository at this point in the history
Signed-off-by: XiaoliChan <2209553467@qq.com>
  • Loading branch information
XiaoliChan committed Sep 5, 2023
1 parent 70ea9f3 commit 0ccac0a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion impacket/dcerpc/v5/dcomrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
RPC_C_AUTHN_LEVEL_PKT_PRIVACY, RPC_C_AUTHN_GSS_NEGOTIATE, RPC_C_AUTHN_WINNT, DCERPCException
from impacket.dcerpc.v5 import transport

DCOM_TIMEOUT = 300

CLSID_ActivationContextInfo = string_to_bin('000001a5-0000-0000-c000-000000000046')
CLSID_ActivationPropertiesIn = string_to_bin('00000338-0000-0000-c000-000000000046')
CLSID_ActivationPropertiesOut = string_to_bin('00000339-0000-0000-c000-000000000046')
Expand Down Expand Up @@ -1070,6 +1072,10 @@ def initConnection(self):
self.__portmap.set_auth_type(RPC_C_AUTHN_GSS_NEGOTIATE)
self.__portmap.connect()
DCOMConnection.PORTMAPS[self.__target] = self.__portmap

def set_connect_timeout(self, timeout):
global DCOM_TIMEOUT
DCOM_TIMEOUT = timeout

def CoCreateInstanceEx(self, clsid, iid):
scm = IRemoteSCMActivator(self.__portmap)
Expand Down Expand Up @@ -1292,7 +1298,7 @@ def connect(self, iid = None):
dcomInterface.set_credentials(*DCOMConnection.PORTMAPS[self.__target].get_credentials())
dcomInterface.set_kerberos(DCOMConnection.PORTMAPS[self.__target].get_rpc_transport().get_kerberos(),
DCOMConnection.PORTMAPS[self.__target].get_rpc_transport().get_kdcHost())
dcomInterface.set_connect_timeout(300)
dcomInterface.set_connect_timeout(DCOM_TIMEOUT)
dce = dcomInterface.get_dce_rpc()

if iid is None:
Expand Down

0 comments on commit 0ccac0a

Please sign in to comment.