Skip to content

Instantly share code, notes, and snippets.

@unicornsasfuel
Last active October 10, 2016 22:38
Show Gist options
  • Save unicornsasfuel/eb9db5292a2de0eaaa5a0e6fdb486a03 to your computer and use it in GitHub Desktop.
Save unicornsasfuel/eb9db5292a2de0eaaa5a0e6fdb486a03 to your computer and use it in GitHub Desktop.
from Crypto.Cipher import AES
from pwn import *
ciphertext = 'YWFhYWFhYWFhYWFhYWFhYQ=='
one = 'ICAgICAgICAgICAxNTc1Mw=='
two = 'ICAgICAgICAgICA2Nzc5Nw=='
three = 'ICAgICAgICAgICA0NDQ0NQ=='
four = 'ICAgICAgICAgICAyMzU2Mw=='
five = 'ICAgICAgICAgICAgNDc3OA=='
six = 'ICAgICAgICAgICA0NzM4MQ=='
r = remote('challenges.hackover.h4q.it', 1415)
while True:
print r.recvuntil('My dice roll: ')
diceroll = r.recvuntil('==\n').strip()
print diceroll
print r.recvuntil('Your dice roll: ')
print ciphertext
r.sendline(ciphertext)
print r.recvuntil('My key: ')
key = r.recvuntil('==\n').strip()
print key
print r.recvuntil('Your key: ')
if decrypt(diceroll, key)[:2] == '\x00\x01':
r.sendline(six)
if decrypt(diceroll, key)[:2] == '\x00\x02':
r.sendline(five)
if decrypt(diceroll, key)[:2] == '\x00\x03':
r.sendline(four)
if decrypt(diceroll, key)[:2] == '\x00\x04':
r.sendline(three)
if decrypt(diceroll, key)[:2] == '\x00\x05':
r.sendline(two)
if decrypt(diceroll, key)[:2] == '\x00\x06':
r.sendline(one)
print r.recvline()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment