Reversing challenges from n00bzCTF 2023


Welcome

image

image

Flag: n00bz{N3v3R_$torE_$ENs1TIV3_1nFOrMa7IOn_P1aiNtexT_In_yoUr_bin4rI3S!!!!!}


EZrev

image

Decompiling the class file:

import java.util.Arrays;

// 
// Decompiled by Procyon v0.5.36
// 

public class EZrev
{
    public static void main(final String[] array) {
        if (array.length != 1) {
            System.out.println("L");
            return;
        }
        final String s = array[0];
        if (s.length() != 31) {
            System.out.println("L");
            return;
        }
        final int[] array2 = s.chars().toArray();
        for (int i = 0; i < array2.length; ++i) {
            if (i % 2 == 0) {
                array2[i] = (char)(array2[i] ^ 0x13);
            }
            else {
                array2[i] = (char)(array2[i] ^ 0x37);
            }
        }
        for (int j = 0; j < array2.length / 2; ++j) {
            if (j % 2 == 0) {
                final int n = array2[j] - 10;
                array2[j] = (char)(array2[array2.length - 1 - j] + 20);
                array2[array2.length - 1 - j] = (char)n;
            }
            else {
                array2[j] = (char)(array2[j] + 30);
            }
        }
        if (Arrays.equals(array2, new int[] { 130, 37, 70, 115, 64, 106, 143, 34, 54, 134, 96, 98, 125, 98, 138, 104, 25, 3, 66, 78, 24, 69, 91, 80, 87, 67, 95, 8, 25, 22, 115 })) {
            System.out.println("W");
        }
        else {
            System.out.println("L");
        }
    }
}

Reverse the process using the script to get the flag (credits to my teammate)

a = [130, 37, 70, 115, 64, 106, 143, 34, 54, 134, 96, 98, 125, 98, 138, 
104, 25, 3, 66, 78, 24, 69, 91, 80, 87, 67, 95, 8, 25, 22, 115]

s = []

for i in range(15):
    if(i%2!=0):
        a[i] -= 30
    else:
        a[i], a[30-i] = a[30-i]+10, a[i]-20
for i in range(31):
    if(i%2 == 0):
        a[i] ^= 0x13
    else:
        a[i] ^= 0x37
for i in range(31):
    print(chr(a[i]), end="")

Flag: n00bz{r3v_1s_s0_e4zy_r1ght??!!}