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
logging.getLogger(LOGGER).debug('=' * 80)
actionsbis = []
logging.getLogger(LOGGER).info("size[actions] %d" % len(actions))
logging.getLogger(LOGGER).debug("size[actions] %d" % len(actions))
for action in actions:
referenceBis = "%s_%d" % (target, id)
action.add_reference(Parent)
action.set_name(referenceBis)
logging.getLogger(LOGGER).debug('-' * 80)
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:
#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)
elif action.Code == Enum.TActionCode.ACTION_GENERIC_CODE:
#action.add_reference(Parent)
@ -538,7 +538,7 @@ class SpyPcap():
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:
logging.getLogger(LOGGER).debug("type impulse:%s" % str(type(impulse)))
database = None
@ -560,7 +560,7 @@ class SpyPcap():
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:
logging.getLogger(LOGGER).debug("type impulse:%s" % str(type(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:
# logging.getLogger(LOGGER).debug("remove old action [%d/%d] : %s" % (self._Actions[0].FirstPacket, self._LastReceivedAck, self._Actions[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:
actions.append(action)
logging.getLogger(LOGGER).info("impulses:%s" % str(impulses))
logging.getLogger(LOGGER).debug("impulses:%s" % str(impulses))
else:
message = msgin.readUint8('message')
#referenceBis = "%s_%d" % (Parent, id)
@ -694,6 +694,8 @@ class SpyPcap():
return actions, impulses, databases, properties
def read(self):
logging.getLogger(LOGGER).info("Conversion => Start")
fullconverted = True
file = open( self.pcap_file , 'rb')
pcapfile = savefile.load_savefile(file,verbose=False)
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])
if not msgin.checkOnlyZeroAtEnd(): # msgin.needRead() > 7:
moredata = "message partially decoded"
fullconverted = False
else:
moredata = 'message decoded'
if self.show_message_decoded:
@ -932,6 +935,11 @@ class SpyPcap():
sequencenum += 1
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']))
if fullconverted:
logging.getLogger(LOGGER).info("Full converted")
else:
logging.getLogger(LOGGER).info("Partially converted")
logging.getLogger(LOGGER).info("Conversion => End")
def main():
@ -939,16 +947,16 @@ def main():
logging.basicConfig(format=FORMAT)
logger = []
#logger.append(logging.getLogger(LOGGER))
logger.append(logging.getLogger(LOGGER))
# logger.append(logging.getLogger(CImpulseDecoder.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(CAction.LOGGER))
#logger.append(logging.getLogger(CActionFactory.LOGGER))
#logger.append(logging.getLogger(BitStream.LOGGER))
logger.append(logging.getLogger(DecodeDatabase.LOGGER))
logger.append(logging.getLogger(Impulse.LOGGER))
#logger.append(logging.getLogger(DecodeDatabase.LOGGER))
#logger.append(logging.getLogger(Impulse.LOGGER))
#logger.append(logging.getLogger(TVPNodeBase.LOGGER))
# CImpulseDecoder
# logger.append(logging.getLogger('CGenericMultiPartTemp'))