Skip to content

Instantly share code, notes, and snippets.

@Vishvesh-rao
Last active Sep 4, 2021
Embed
What would you like to do?
inctfi 21
from Crypto.Util.number import GCD
from pwn import *
context.log_level = "Debug"
remote_ip,port = 'crypto.challenge.bi0s.in','1221'
io = remote(remote_ip,port)
re = lambda : io.recv()
ru = lambda a: io.recvuntil(a)
sl = lambda a: io.sendline(a)
def solve(vector,op,samt,choice):
ru("\nEnter the operand vector: ")
sl(vector)
re()
sl(op)
re()
sl(samt)
s = ru("\nperform another operation(y/n): ")
sl(choice)
# ------------------------------------------------------
#3x3
solve("0 0 0 0 9 0 0 0 0",'*','1','y')
solve("0 0 0 0 0 0 0 0 0",'<','4','n')
# ------------------------------------------------------
solve('2 3','*','1','n')
ru("\n\nchoose(+,-,*,/): ")
sl('+')
ru("\n\nHere you go: ")
hint = int(ru("\n").strip())
ru("This might make it easier: ")
n = int(ru("\n\n").strip())
n = n//hint
payload = "0 "*19 + str(n)
# ------------------------------------------------------
#5x4
solve(payload,'+','1','y')
solve("1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10",'*','1','y')
solve("0 0 0 0 0 0 0 0 0",'<','19','n')
# ------------------------------------------------------
#level 2
#with no negetive elements in vectors and using 6 digit userinp
#userinp
solve('0','>','1','y')
solve('2','+','1','y')
solve("0 0 0 0 0 -2",'+','1','n')
# ------------------------------------------------------
solve("-9 -9 -9 -9 -9",'+','1','y')
solve("-1 -1 -1 -1 -1",'*','1','n')
solve("-9 -9 -9 -9 -9",'+','1','y')
solve("-1 -1 -1 -1 -1",'*','1','n')
# ------------------------------------------------------
ru("Here's the flag: ")
flag = re()
print(flag.split(b"\n")[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment