Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pwn import *
- def oracle_decrypt(ct):
- io.sendline(ct.hex())
- response = io.recvline()
- if b"Padding is incorrect" in response:
- return False
- return True
- io=remote("padding-oracle.chall.srdnlen.it", 443, ssl=True)
- io.recvuntil(b"flag")
- iv_and_flag=io.recvuntil(b"What do you want to decrypt (in hex)?").decode().strip()
- iv_and_flag=iv_and_flag[:192]
- array = [iv_and_flag[i:i+2] for i in range(0, len(iv_and_flag), 2)]
- orig_arr_80=array[79]
- print(array)
- for i in range(0, 256):
- array[80] = hex(i)[2:4].zfill(2)
- #print(array)
- if oracle_decrypt(bytes.fromhex("".join(array))):
- t1=int(array[79], 16)
- print(int(array[79], 16))
- break
- x1 = t1 ^ 1
- p1 = x1 ^ int(orig_arr_80, 16)
- print(p1)
- io.close()
Advertisement
Add Comment
Please, Sign In to add comment