Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import binascii
- from pwn import * # pwntools
- # connect
- r = remote('2018shell.picoctf.com', 1225)
- # binary
- print r.readline() # get the first line over with
- word1 = r.readline() # for some reason the word for part 1 is echoed, so read it in
- print r.recvuntil("Input:") # skip to where we input word 1
- r.send(word1) # send it!
- # hex
- print r.recvuntil("the ") # skip to right position to read in the hex string
- word2 = r.recvuntil(" ") # read string up to the space
- word2_hex = word2[:-1] # strip the space
- word2_ascii = binascii.unhexlify(word2_hex) # convert to ascii
- print r.recvuntil("Input:") # skip to entry
- r.send(word2_ascii + "\n") # send it!
- # octal
- print r.recvuntil("the ") # skip to integer list
- word3 = ""
- while True:
- number = r.recvn(3) # read integer
- if number != "as ": # end of the list?
- word3 += chr(int(number,8)) # convert to decimal!
- r.recvn(1) # and discard the space
- else:
- break # we're done - dump out
- print r.recvuntil("Input:") # skip to entry
- r.send(word3 + "\n") # send it!
- r.interactive() # read the rest of the input
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement