sridhar19091986 / pcapsctpspliter

Automatically exported from code.google.com/p/pcapsctpspliter
0 stars 0 forks source link

how to change PCapFilePacket ? #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
class PCapFileHeader(structure.Structure):
    structure = (
        ('magic', '"\xd4\xc3\xb2\xa1'),
        ('versionMajor', '<H=2'),
        ('versionMinor', '<H=4'),
        ('GMT2localCorrection', '<l=0'),
        ('timeAccuracy', '<L=0'),
        ('maxLength', '<L=0xffff'),
        ('linkType', '<L=1'),
        ('packets','*:=[]'),
    )

class PCapFilePacket(structure.Structure):
    structure = (
        ('tsec', '<L=0'),
        ('tmsec', '<L=0'),
        ('savedLength', '<L-data'),
        ('realLength', '<L-data'),
        ('data',':'),
    )

Original issue reported on code.google.com by cn.wei.hp@gmail.com on 15 Nov 2010 at 7:00

GoogleCodeExporter commented 9 years ago
f_in = open(sys.argv[1],'rb')
f_out = open(sys.argv[2],'wb')

pkt = PCapFilePacket()
pkt.fromString(f_in.read(len(pkt)))
pkt['data'] = f_in.read(pkt['savedLength'])
pkt_out = PCapFilePacket()
pkt_out['data'] = str(eth.get_packet())
f_out.write(str(pkt_out))

Original comment by cn.wei.hp@gmail.com on 15 Nov 2010 at 7:16

GoogleCodeExporter commented 9 years ago
pcapfile.py

http://code.google.com/p/impacket/source/browse/#svn/trunk/examples

Original comment by cn.wei.hp@gmail.com on 15 Nov 2010 at 7:34

GoogleCodeExporter commented 9 years ago
pcap修改的问题:

caplen  删除每条包尾部冗余数据

iplen   错误解码器不能正常解码

Original comment by cn.wei.hp@gmail.com on 15 Nov 2010 at 3:10