ICMP fragment messages can only return the first fragment message
Brief description
I send a no fragmented ICMP message, The customed message processor returned fragmented messages. The following code can only obtain the first fragmented message, What should I do to obtain a complete fragmented message. By using Wireshark to capture packets, the complete message can be seen.
def send_icmp_message(dst_ip, msg):
try:
icmp_request = ICMP(type='echo-request', id=1, seq=1) / msg
packet = IP(dst=dst_ip) / icmp_request
conf.debug_match = True
response = sr(packet, verbose=1)
print(debug.recv)
except Exception as e:
return f"Error sending/receiving ICMP message: {e}"
Scapy version
2.5.0
Python version
3.11.9
Operating system
Windows10
Additional environment information
No response
How to reproduce
I send a no fragmented ICMP message, The customed message processor returned fragmented messages.
Actual result
I can only obtain the first fragmented message
Expected result
obtain a complete fragmented message.
Related resources
No response
You can see the complete process of capturing files with numbers 81, 83, and 84. You can also use the following filtering conditions: ip.dst==10.57.76.11 | | ip.src==10.57.76.11 The capturing files:111.zip
You can use IPSession(). It's pretty easy:
sr(packet, timeout=1, session=IPSession())
It works properly after the modification. Thank you very much.
You can use
IPSession(). It's pretty easy:sr(packet, timeout=1, session=IPSession())