update message send by spykhanat

This commit is contained in:
AleaJactaEst 2020-11-28 18:20:23 +01:00
parent eda02f65b4
commit 30f648d0b0

View file

@ -515,17 +515,17 @@ class SpyPcap():
# Decode the actions received in the impulsions # Decode the actions received in the impulsions
logging.getLogger(LOGGER).debug('=' * 80) logging.getLogger(LOGGER).debug('=' * 80)
actionsbis = [] actionsbis = []
logging.getLogger(LOGGER).info("size[actions] %d" % len(actions)) logging.getLogger(LOGGER).debug("size[actions] %d" % len(actions))
for action in actions: for action in actions:
referenceBis = "%s_%d" % (target, id) referenceBis = "%s_%d" % (target, id)
action.add_reference(Parent) action.add_reference(Parent)
action.set_name(referenceBis) action.set_name(referenceBis)
logging.getLogger(LOGGER).debug('-' * 80) logging.getLogger(LOGGER).debug('-' * 80)
logging.getLogger(LOGGER).debug('Analyse actions:%s', action) logging.getLogger(LOGGER).debug('Analyse actions:%s', action)
logging.getLogger(LOGGER).info("size[actions] %d" % len(actions)) logging.getLogger(LOGGER).debug("size[actions] %d" % len(actions))
if action.Code == Enum.TActionCode.ACTION_DISCONNECTION_CODE: if action.Code == Enum.TActionCode.ACTION_DISCONNECTION_CODE:
#action.add_reference(Parent) #action.add_reference(Parent)
logging.getLogger(LOGGER).info("Action : ACTION_DISCONNECTION_CODE") logging.getLogger(LOGGER).debug("Action : ACTION_DISCONNECTION_CODE")
actionsbis.append(CAction.CActionFake('ACTION_DISCONNECTION_CODE', self.client_state[dst]['GenericMultiPartTempServer'].data[id].read())) # , Reference = Parent, Name = "%s_%d" % (target, 0) actionsbis.append(CAction.CActionFake('ACTION_DISCONNECTION_CODE', self.client_state[dst]['GenericMultiPartTempServer'].data[id].read())) # , Reference = Parent, Name = "%s_%d" % (target, 0)
elif action.Code == Enum.TActionCode.ACTION_GENERIC_CODE: elif action.Code == Enum.TActionCode.ACTION_GENERIC_CODE:
#action.add_reference(Parent) #action.add_reference(Parent)
@ -538,7 +538,7 @@ class SpyPcap():
Reference = [Parent, ], Reference = [Parent, ],
Name = "%s_%d" % (target, 0) Name = "%s_%d" % (target, 0)
) #, Reference = Parent, Name = "%s_%d" % (target, 0)) ) #, Reference = Parent, Name = "%s_%d" % (target, 0))
logging.getLogger(LOGGER).info("impulse:%s" % str(impulse)) #logging.getLogger(LOGGER).info("impulse:%s" % str(impulse))
if impulse: if impulse:
logging.getLogger(LOGGER).debug("type impulse:%s" % str(type(impulse))) logging.getLogger(LOGGER).debug("type impulse:%s" % str(type(impulse)))
database = None database = None
@ -560,7 +560,7 @@ class SpyPcap():
Reference = Parent, Reference = Parent,
Name = "%s_%d" % (target, 0) Name = "%s_%d" % (target, 0)
) #, Reference = Parent, Name = "%s_%d" % (target, 0)) ) #, Reference = Parent, Name = "%s_%d" % (target, 0))
logging.getLogger(LOGGER).info("impulse:%s" % str(impulse)) logging.getLogger(LOGGER).debug("impulse:%s" % str(impulse))
if impulse: if impulse:
logging.getLogger(LOGGER).debug("type impulse:%s" % str(type(impulse))) logging.getLogger(LOGGER).debug("type impulse:%s" % str(type(impulse)))
impulses.append(impulse) impulses.append(impulse)
@ -651,11 +651,11 @@ class SpyPcap():
# while self._Actions and self._Actions[0].FirstPacket != 0 and self._Actions[0].FirstPacket < self._LastReceivedAck: # while self._Actions and self._Actions[0].FirstPacket != 0 and self._Actions[0].FirstPacket < self._LastReceivedAck:
# logging.getLogger(LOGGER).debug("remove old action [%d/%d] : %s" % (self._Actions[0].FirstPacket, self._LastReceivedAck, self._Actions[0])) # logging.getLogger(LOGGER).debug("remove old action [%d/%d] : %s" % (self._Actions[0].FirstPacket, self._LastReceivedAck, self._Actions[0]))
# self._Actions.pop(0) # self._Actions.pop(0)
logging.getLogger(LOGGER).info("size[actions] %d" % len(actions)) logging.getLogger(LOGGER).debug("size[actions] %d" % len(actions))
for action in actionsbis: for action in actionsbis:
actions.append(action) actions.append(action)
logging.getLogger(LOGGER).info("impulses:%s" % str(impulses)) logging.getLogger(LOGGER).debug("impulses:%s" % str(impulses))
else: else:
message = msgin.readUint8('message') message = msgin.readUint8('message')
#referenceBis = "%s_%d" % (Parent, id) #referenceBis = "%s_%d" % (Parent, id)
@ -694,6 +694,8 @@ class SpyPcap():
return actions, impulses, databases, properties return actions, impulses, databases, properties
def read(self): def read(self):
logging.getLogger(LOGGER).info("Conversion => Start")
fullconverted = True
file = open( self.pcap_file , 'rb') file = open( self.pcap_file , 'rb')
pcapfile = savefile.load_savefile(file,verbose=False) pcapfile = savefile.load_savefile(file,verbose=False)
khanat_host = self.detect_khanat_server(pcapfile.packets) khanat_host = self.detect_khanat_server(pcapfile.packets)
@ -770,6 +772,7 @@ class SpyPcap():
actions_clients, impulses_clients, databases_clients = self.decode_client_message(msgin, src, dst, sequenceid, list_host[dst], Reference, list_host[src]) actions_clients, impulses_clients, databases_clients = self.decode_client_message(msgin, src, dst, sequenceid, list_host[dst], Reference, list_host[src])
if not msgin.checkOnlyZeroAtEnd(): # msgin.needRead() > 7: if not msgin.checkOnlyZeroAtEnd(): # msgin.needRead() > 7:
moredata = "message partially decoded" moredata = "message partially decoded"
fullconverted = False
else: else:
moredata = 'message decoded' moredata = 'message decoded'
if self.show_message_decoded: if self.show_message_decoded:
@ -932,6 +935,11 @@ class SpyPcap():
sequencenum += 1 sequencenum += 1
for client in self.client_state: for client in self.client_state:
logging.getLogger(LOGGER).debug("%s [server tick:%d, client tick:%d]" %(client, self.client_state[client]['CurrentSendNumber'], self.client_state[client]['CurrentReceivedNumber'])) logging.getLogger(LOGGER).debug("%s [server tick:%d, client tick:%d]" %(client, self.client_state[client]['CurrentSendNumber'], self.client_state[client]['CurrentReceivedNumber']))
if fullconverted:
logging.getLogger(LOGGER).info("Full converted")
else:
logging.getLogger(LOGGER).info("Partially converted")
logging.getLogger(LOGGER).info("Conversion => End")
def main(): def main():
@ -939,16 +947,16 @@ def main():
logging.basicConfig(format=FORMAT) logging.basicConfig(format=FORMAT)
logger = [] logger = []
#logger.append(logging.getLogger(LOGGER)) logger.append(logging.getLogger(LOGGER))
# logger.append(logging.getLogger(CImpulseDecoder.LOGGER)) # logger.append(logging.getLogger(CImpulseDecoder.LOGGER))
# #logger.append(logging.getLogger(DecodeImpuls.LOGGER)) # #logger.append(logging.getLogger(DecodeImpuls.LOGGER))
logger.append(logging.getLogger(BitStream.LOGGER)) #logger.append(logging.getLogger(BitStream.LOGGER))
# logger.append(logging.getLogger(CStringManager.LOGGER)) # logger.append(logging.getLogger(CStringManager.LOGGER))
#logger.append(logging.getLogger(CAction.LOGGER)) #logger.append(logging.getLogger(CAction.LOGGER))
#logger.append(logging.getLogger(CActionFactory.LOGGER)) #logger.append(logging.getLogger(CActionFactory.LOGGER))
#logger.append(logging.getLogger(BitStream.LOGGER)) #logger.append(logging.getLogger(BitStream.LOGGER))
logger.append(logging.getLogger(DecodeDatabase.LOGGER)) #logger.append(logging.getLogger(DecodeDatabase.LOGGER))
logger.append(logging.getLogger(Impulse.LOGGER)) #logger.append(logging.getLogger(Impulse.LOGGER))
#logger.append(logging.getLogger(TVPNodeBase.LOGGER)) #logger.append(logging.getLogger(TVPNodeBase.LOGGER))
# CImpulseDecoder # CImpulseDecoder
# logger.append(logging.getLogger('CGenericMultiPartTemp')) # logger.append(logging.getLogger('CGenericMultiPartTemp'))