scapy icon indicating copy to clipboard operation
scapy copied to clipboard

ICMP fragment messages can only return the first fragment message

Open zhuleichina opened this issue 1 year ago • 2 comments

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

zhuleichina avatar Aug 23 '24 07:08 zhuleichina

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

zhuleichina avatar Aug 23 '24 07:08 zhuleichina

You can use IPSession(). It's pretty easy:

sr(packet, timeout=1, session=IPSession())

gpotter2 avatar Sep 29 '24 10:09 gpotter2

It works properly after the modification. Thank you very much.

You can use IPSession(). It's pretty easy:

sr(packet, timeout=1, session=IPSession())

zhuleichina avatar Oct 10 '24 08:10 zhuleichina