import socket,struct,time DUT=("192.168.68.200",31772) UID=bytes.fromhex("7fff0ae09229") SRC=bytes.fromhex("0107340000aa") def build(dest,cc,pid,pd): f=bytearray(1084) f[0:4]=b"ENet" f[4]=4 f[0x0A]=0x1c; f[0x0B]=0x7c f[0x12]=1 struct.pack_into("H",f,0x50,pid) f[0x52]=len(pd) f[0x53:0x53+len(pd)]=pd s=0xCC+sum(f[0x3C:0x53+len(pd)]) struct.pack_into(">H",f,0x53+len(pd),s&0xFFFF) return bytes(f) def uid64(b): return int.from_bytes(b,"big") v=uid64(UID) branch_pd=(v-1).to_bytes(6,"big")+(v+1).to_bytes(6,"big") s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) s.settimeout(1.5) s.bind(("192.168.68.1",0)) def probe(tag,frame,n=6): ok=0 for i in range(n): s.sendto(frame,DUT) try: d,a=s.recvfrom(2048) rl=struct.unpack_from("