Exemplo n.º 1
0
 def __init__(self, datas):
     print("    PacketHead Initing")
     self._secondTime_4B = ByteOrder.bytes2int(datas[0:4])
     self._millsecondTime_4B = ByteOrder.bytes2int(datas[4:8])
     self._captureLen_4B = ByteOrder.bytes2int(datas[8:12])
     self._realLen_4B = ByteOrder.bytes2int(datas[12:16])
     if INFORM == 1:
         print(self.__str__())
Exemplo n.º 2
0
 def signature(data):
     """验证签名同时确定排序,虽然此时还未读取到后续大小端"""
     sig = ByteOrder.bytes2int(data)
     if sig == 0xa1b2c3d4:
         ByteOrder.order = "big"
         return True
     elif sig == 0xd4c3b2a1:
         ByteOrder.order = "little"
         return True
     return False
 def __init__(self, datas):
     print("  PcapHead Initing")
     self._magic_4B = datas[0:4]
     if PcapHead.signature(self._magic_4B) is False:
         raise Exception("不支持的文件格式")
     self._major_2B = ByteOrder.bytes2int(datas[4:6])
     self._minor_2B = ByteOrder.bytes2int(datas[6:8])
     self._thisZone_4B = ByteOrder.bytes2int(datas[8:12])
     self._sigFigs_4B = ByteOrder.bytes2int(datas[12:16])
     self._snapLen_4B = ByteOrder.bytes2int(datas[16:20])
     self._linkType_4B = ByteOrder.bytes2int(datas[20:24])