import socket import sys tftpd = ('192.168.1.1', 69) #Try and open an UDP SOCKET try: tftp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) except: print("Failed on socket creation, so exiting") sys.exit(1) #create a invalid opcode exeeding the 2 byte length # opcode operation # 1 Read request (RRQ) # 2 Write request (WRQ) # 3 Data (DATA) # 4 Acknowledgment (ACK) # 5 Error (ERROR) invalidOpcode = "0000" tftp.sendto(invalidOpcode,tftpd)