Demo included below:
from pcs.packets.localhost import *
import binascii
x = '020000004500002cca844000400600007f0000017f0000033039d4313931f6ae000000016012fffffe220000'
bytes = binascii.a2b_hex(x)
l = localhost(bytes)
ip = l.data
tcp = ip.data
print repr(tcp)
print tcp
import binascii
x = '020000004500002cca844000400600007f0000017f0000033039d4313931f6ae000000016012fffffe220000'
bytes = binascii.a2b_hex(x)
l = localhost(bytes)
ip = l.data
tcp = ip.data
print repr(tcp)
print tcp
Prints out the following. Notice that instead of SYN/ACK, it is identified as SYN/ACK/RST/PSH.
[class tcp {reset: 4, psh: 2, reserved: 0, sequence: 959575726, ack: 1, checksum: 65058, offset: 6, syn: 9, urgent: 0, window: 65535, ack_number: 1, dport: 54321, sport: 12345, fin: 0, urg_pointer: 0},
class payload {payload: ''}]
That packet is a loopback-ipv4-tcp packet, should look like the following:
Transmission Control Protocol, Src Port: italk (12345), Dst Port: 54321 (54321), Seq: 959575726, Ack: 1, Len: 0
Here's the bytes printed in an easier-to-read format. Emphasis on the flags mine.
02 00 00 00 45 00 00 2c ca 84 40 00 40 06 00 00
7f 00 00 01 7f 00 00 03 30 39 d4 31 39 31 f6 ae
00 00 00 01 60 12 ff ff fe 22 00 00
No comments:
Post a Comment