7 from dcerpc
import MSRPCRequestHeader
, MSRPCRespHeader
9 class handler(rpcBase
.rpcBase
):
10 def parseRequest(self
):
11 request
= MSRPCRequestHeader(self
.data
)
13 if self
.config
['debug']:
14 print "RPC Message Request Bytes:", binascii
.b2a_hex(self
.data
)
15 print "RPC Message Request:", request
.dump()
19 def generateResponse(self
):
20 request
= self
.requestData
22 responseData
= kmsBase
.generateKmsResponseData(request
['pduData'], self
.config
)
23 envelopeLength
= len(responseData
)
25 response
= MSRPCRespHeader()
26 response
['ver_major'] = request
['ver_major']
27 response
['ver_minor'] = request
['ver_minor']
28 response
['type'] = self
.packetType
['response']
29 response
['flags'] = self
.packetFlags
['firstFrag'] | self
.packetFlags
['lastFrag']
30 response
['representation'] = request
['representation']
31 response
['call_id'] = request
['call_id']
33 response
['alloc_hint'] = envelopeLength
34 response
['ctx_id'] = request
['ctx_id']
35 response
['cancel_count'] = 0
37 response
['pduData'] = responseData
39 if self
.config
['debug']:
40 print "RPC Message Response:", response
.dump()
41 print "RPC Message Response Bytes:", binascii
.b2a_hex(str(response
))
45 def generateRequest(self
):
46 request
= MSRPCRequestHeader()
48 request
['ver_major'] = 5
49 request
['ver_minor'] = 0
50 request
['type'] = self
.packetType
['request']
51 request
['flags'] = self
.packetFlags
['firstFrag'] | self
.packetFlags
['lastFrag']
52 request
['representation'] = 0x10
53 request
['call_id'] = self
.config
['call_id']
54 request
['alloc_hint'] = len(self
.data
)
55 request
['pduData'] = str(self
.data
)
57 if self
.config
['debug']:
58 print "RPC Message Request:", request
.dump()
59 print "RPC Message Request Bytes:", binascii
.b2a_hex(str(request
))
63 def parseResponse(self
):