File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,10 @@ class Packet:
4848 ip_chksum : int | None = None
4949 ip_src_addr : str | None = None
5050 ip_dst_addr : str | None = None
51+ ip_length : int | None = None
52+ ipv4_identification : int | None = None
53+ ipv4_more_fragments : bool = False
54+ ipv4_fragmented_offset : int | None = None
5155
5256 udp_src_port : int | None = None
5357 udp_dst_port : int | None = None
@@ -93,6 +97,14 @@ def _decode_ipv4(self) -> None:
9397 if self .ip_version != 4 :
9498 return
9599
100+ self .ip_length = iph [2 ]
101+ self .ipv4_identification = iph [3 ]
102+
103+ # Decode fragment data
104+ fragment_flag_and_offset = iph [4 ]
105+ self .ipv4_more_fragments = bool (fragment_flag_and_offset & 0x2000 )
106+ self .ipv4_fragmented_offset = fragment_flag_and_offset & 0x1FFF
107+
96108 # Calculate the length (of the header?)
97109 ihl = version_ihl & 0xF
98110 self ._iph_length = ihl * 4
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ def l3filter(self, packet: Packet) -> bool:
141141 def l4filter (self , packet : Packet ) -> bool :
142142 """Tests to perform on Level4 of packet, i.e. UDP Protocol"""
143143 if packet .udp_dst_port != self .local_port :
144- logger .debug ("Wrong UDP destination port: %i" , packet .udp_dst_port )
144+ logger .debug ("Wrong UDP destination port: %i on packet %s " , packet .udp_dst_port , packet )
145145 return False
146146
147147 return True
You can’t perform that action at this time.
0 commit comments