Last active
September 19, 2016 06:52
-
-
Save seadog007/9b39e746d1328c914b7bb5154dac2ee9 to your computer and use it in GitHub Desktop.
CSAW CTF Qual 2016 [Misc][25pts]Coinslot
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
from pwn import * | |
def check(current): | |
global amount | |
count = 0 | |
current = int(current*100) | |
while True: | |
if amount < current: | |
print count | |
break | |
else: | |
amount -= current | |
count += 1 | |
return str(count) | |
r = remote('misc.chal.csaw.io', 8000) | |
while True: | |
amount = float(r.recvline().replace('$','').replace('\n','').replace(',','')) | |
print amount | |
amount = int(round(amount*100)) | |
print amount | |
r.sendline(check(10000)) | |
r.sendline(check(5000)) | |
r.sendline(check(1000)) | |
r.sendline(check(500)) | |
r.sendline(check(100)) | |
r.sendline(check(50)) | |
r.sendline(check(20)) | |
r.sendline(check(10)) | |
r.sendline(check(5)) | |
r.sendline(check(1)) | |
r.sendline(check(0.5)) | |
r.sendline(check(0.25)) | |
r.sendline(check(0.1)) | |
r.sendline(check(0.05)) | |
r.sendline(check(0.01)) | |
print r.recvline() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment