180180}
181181DCE_RPC_INTERFACES_NAMES = {}
182182DCE_RPC_INTERFACES_NAMES_rev = {}
183+ COM_INTERFACES_NAMES = {}
184+ COM_INTERFACES_NAMES_rev = {}
183185
184186
185187class DCERPC_Transport (IntEnum ):
@@ -1350,6 +1352,8 @@ def register_com_interface(name, uuid, opnums):
13501352 # bind for build
13511353 for opnum , operations in opnums .items ():
13521354 bind_top_down (DceRpc5Request , operations .request , opnum = opnum )
1355+ COM_INTERFACES_NAMES [uuid ] = name
1356+ COM_INTERFACES_NAMES_rev [name .lower ()] = uuid
13531357
13541358
13551359def find_com_interface (name ) -> ComInterface :
@@ -2824,6 +2828,7 @@ def __init__(self, *args, **kwargs):
28242828 self .sent_cont_ids = []
28252829 self .cont_id = 0 # Currently selected context
28262830 self .auth_context_id = 0 # Currently selected authentication context
2831+ self .assoc_group_id = 0 # Currently selected association group
28272832 self .map_callid_opnum = {}
28282833 self .frags = collections .defaultdict (lambda : b"" )
28292834 self .sniffsspcontexts = {} # Unfinished contexts for passive
@@ -2869,6 +2874,8 @@ def _up_pkt(self, pkt):
28692874 finally :
28702875 self .sent_cont_ids = []
28712876
2877+ self .assoc_group_id = pkt .assoc_group_id
2878+
28722879 # Endianness
28732880 self .ndrendian = {0 : "big" , 1 : "little" }[pkt [DceRpc5 ].endian ]
28742881
@@ -2878,18 +2885,20 @@ def _up_pkt(self, pkt):
28782885 elif DceRpc5Request in pkt :
28792886 # request => match opnum with callID
28802887 opnum = pkt .opnum
2888+ uid = (self .assoc_group_id , pkt .call_id )
28812889 if self .rpc_bind_is_com :
2882- self .map_callid_opnum [pkt . call_id ] = (
2890+ self .map_callid_opnum [uid ] = (
28832891 opnum ,
28842892 pkt [DceRpc5Request ].payload .payload ,
28852893 )
28862894 else :
2887- self .map_callid_opnum [pkt . call_id ] = opnum , pkt [DceRpc5Request ].payload
2895+ self .map_callid_opnum [uid ] = opnum , pkt [DceRpc5Request ].payload
28882896 elif DceRpc5Response in pkt :
28892897 # response => get opnum from table
2898+ uid = (self .assoc_group_id , pkt .call_id )
28902899 try :
2891- opnum , opts ["request_packet" ] = self .map_callid_opnum [pkt . call_id ]
2892- del self .map_callid_opnum [pkt . call_id ]
2900+ opnum , opts ["request_packet" ] = self .map_callid_opnum [uid ]
2901+ del self .map_callid_opnum [uid ]
28932902 except KeyError :
28942903 log_runtime .info ("Unknown call_id %s in DCE/RPC session" % pkt .call_id )
28952904 # Bind / Alter request/response specific
@@ -2912,7 +2921,7 @@ def _defragment(self, pkt, body=None):
29122921 """
29132922 Function to defragment DCE/RPC packets.
29142923 """
2915- uid = pkt .call_id
2924+ uid = ( self . assoc_group_id , pkt .call_id )
29162925 if pkt .pfc_flags .PFC_FIRST_FRAG and pkt .pfc_flags .PFC_LAST_FRAG :
29172926 # Not fragmented
29182927 return body
0 commit comments