1 year ago

#143133

test-img

Ariel Kantorovich

Arrange UDP packets

I get my UDP packet with python, I know that data need to start with 2 bytes 55 BB, In addition, the length of the correct data is always 228 bytes but I see in Wireshark that the length changed. Now my mission is to arrange the data to its original order and size how can I do this? In my mind, it's like pasting every packet that starts with 55 BB, and after I read another 55 BB end the packet and start again. I would happy if someone can help me with how to perform this task I'm pretty stuck.

Here my Python code:

import socket
import struct

# Initialize Parameters
PORT = 47015 # Define Server Port
IP = '234.0.0.1'
ADDR = (IP, PORT)
BufferSize = 10240

# Initialize Server socket
server = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM, 
proto=socket.IPPROTO_UDP) # family {IPV4} and type {UDP}
server.bind(('', PORT))

# Tell the operating system to add the socket to the multicast group
# on all interfaces.
# group = socket.inet_aton(IP)
# mreq = struct.pack('=4sL', group, socket.INADDR_ANY)
# server.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)

def start():
    # print(f"[LISTENING] Server is listening on {IP}")
    while True:
        # This Part read UDP data from Client LM - 11.11.11.96 and PORT 47017
        data, addr = server.recvfrom(BufferSize)
        print(data.hex())
        print(f"The Data from the Client: [{addr}:  {data}, {len(data)}]")


 print("[STARTING] server is starting...")
 start()

Example of Not_Correct Packets that I need to arrange with another packet that need to come. enter image description here Example of Correct Packets. enter image description here

python

arrays

sockets

udpclient

0 Answers

Your Answer

Accepted video resources