A Java file where some of the bytes have been corrupted to non-printable values. I went through and corrected it:
import java.util.*;
public class DifferenceTest {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter first number: ");
int num1 = sc.nextInt();
System.out.print("Enter second number: ");
int num2 = sc.nextInt();
int answer = num1 - num2;
System.out.println("The difference is: " + answer);
}
}
Then used:
f1 = open('DifferenceTest.java', 'rb').read()
f2 = open('Corrected.java', 'rb').read()
f1 = list(f1)
f2 = list(f2)
for one, two in zip(f1,f2):
if one != two:
print(chr(one-two), end='')
print('')
This takes the difference between any non-matching bytes and prints them as ascii
rgbCTF{tr1pl3_m34n1ng}
ye olde prng
We get that the numbers are generated by squaring the number and taking the middle digits or something?
script below:
n = int(input())
print(str(n**2)[50:-50])
flag: rgbCTF{d0nt_us3_midd13_squ4r3}
Penguins
we see a .git directory, so we navigate to it, and check out the objects we can decompress all the zlib files with
for f in */*; do python -c "import zlib; print zlib.decompress(open('$f').read());";
one of them has a weird looking string in it: blob 149YXMgeW9kYSBvbmNlIHRvbGQgbWUgInJld2FyZCB5b3UgaSBtdXN0IgphbmQgdGhlbiBoZSBnYXZlIG1lIHRoaXMgLS0tLQpyZ2JjdGZ7ZDRuZ2wxbmdfYzBtbTE3c180cjNfdU5mMHI3dW40NzN9 removing the blob number gets us a b64decodable string, which gets us the flag:
rgbctf{d4ngl1ng_c0mm17s_4r3_uNf0r7un473}
Picking Up The Pieces
so basically i grepped for flag format `CTF{`` from here we can simply just follow where the string goes (so use the endpoint of the previous as the next starting point)