Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timestamp by keeping sctp layer #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions flatten_sctp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
(C) Copyright 2016-2017 Holger Hans Peter Freyther

GNU AGPLv3+
GNU AGPLv3+
"""

from scapy.all import rdpcap, Ether, IP, SCTP, SCTPChunkData, wrpcap
Expand All @@ -20,14 +20,17 @@
for pkt in pcap:
ip = pkt['IP']
layer = ip.payload
sctp = ip.payload
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we move this assignment to inside the layer.name == 'SCTP'?

while layer.name != 'NoPayload':
if layer.name == 'SCTP':
sport = layer.sport
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can mostly remove this or replace this with sctp = layer and forget about sport/dport/tag? WDUT?

dport = layer.dport
tag = layer.tag
if layer.name == 'SCTPChunkData':
# re-create the chunkdata as I don't find the routine to just have this data...
pkts.append(Ether()/IP()/SCTP(sport=sport,dport=dport,tag=tag)/SCTPChunkData(reserved=0, delay_sack=0, unordered=0, beginning=1, ending=1, stream_id=layer.stream_id, proto_id=layer.proto_id, stream_seq=layer.stream_seq, tsn=layer.tsn, data=layer.data))
newpkt=Ether()/ip/sctp/SCTPChunkData(reserved=0, delay_sack=0, unordered=0, beginning=1, ending=1, stream_id=layer.stream_id, proto_id=layer.proto_id, stream_seq=layer.stream_seq, tsn=layer.tsn, data=layer.data)
newpkt.time=pkt.time
pkts.append(newpkt)
seq = seq + 1
layer = layer.payload
i = i + 1
Expand Down