Last active
September 4, 2021 22:34
-
-
Save Vishvesh-rao/138489667dc8f79ae8aa7bef8b7e5ebf to your computer and use it in GitHub Desktop.
inctfi 21
This file contains hidden or 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 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