import socket import sys a=socket.socket(family=socket.AF_INET,type=socket.SOCK_DGRAM) a.bind(("135.125.239.22",0x2357)) c=int("0x"+sys.argv[1],base=16) print(c) while(True): b=a.recvfrom(1024) d="{0:04x}".format(c) print(d+" "+str(b[0])+" "+str(b[1])) f=open("/home/arch/w/ab/noos/ip",'a') f.write(d+" "+b[1][0]+" "+str(b[1][1])+"\n") f.close() f=open("/home/arch/w/ab/noos/f"+d,'wb') f.write(b[0]) f.close() a.sendto(str.encode("DgCt"+d),b[1]) c=c+1