/ reverse

breizhctf2k16 - heReallyAsksMeThatQuestionGodDamnIt

Problem : Retrieve the flag
Files : heReallyAsksMeThatQuestionGodDamnIt.class

On disas le decompile le java sur le site http://www.showmycode.com/ et on obtiens le code suivant

import java.io.PrintStream; 
public class heReallyAsksMeThatQuestionGodDamnIt { 
public heReallyAsksMeThatQuestionGodDamnIt() { } public static void main(string args[]) { 
int ai[] = { 4304, 4288, 4311, 4315, 4296, 4314, 4305, 4294, 4308, 4329, 4307, 4327, 4344, 4349, 4327, 4320, 4342, 4277, 4346, 4327, 4347, 4286, 4312, 4343, 4301, 4321, 4327, 4347, 4321, 4301, 4290, 4343, 4348, 4326, 4343, 4321, 4326, 4343, 4320, 4301, 4343, 4326, 4301, 4351, 4349, 4348, 4301, 4351, 4339, 4348, 4339, 4341, 4343, 4320, 4301, 4351, 4277, 4339, 4301, 4342, 4343, 4351, 4339, 4348, 4342, 4343, 4301, 4321, 4347, 4301, 4344, 4343, 4301, 4321, 4339, 4324, 4339, 4347, 4321, 4301, 4337, 4349, 4342, 4343, 4320, 4301, 4343, 4348, 4301, 4312, 4307, 4292, 4307, 4301, 4284, 4284, 4284, 4301, 4292, 4310, 4319, 4335 }; 
int ai1[] = new int[args[0].length()]; 
for(int i = 0; i < ai.length; i++) { 
ai1[i] = args[0].charAt(i); 
if((ai1[i] ^ 0x1092) != ai[i] || args[0].length() != ai.length) { 
system.out.println("You are wrong."); system.exit(0); } } 
system.out.println((new StringBuilder()).append("Congratz :)! Here is your Flag: ").append(args[0]).toString()); } }

On remarque un xor avec la clé 0x1092. Ne kiffant pas trop Java (Tr0ll), un petit script python pour XOR..

Liste=(4304, 4288, 4311, 4315, 4296, 4314, 4305, 4294, 4308, 4329, 4307, 4327, 4344, 4349, 4327, 4320, 4342, 4277, 4346, 4327, 4347, 4286, 4312, 4343$
4290, 4343, 4348, 4326, 4343, 4321, 4326, 4343, 4320, 4301, 4343, 4326, 4301, 4351, 4349, 4348, 4301, 4351, 4339, 4348, 4339, 4341, 4343, 4320, 4301,$
4319, 4335)

cle=0x1092
password=""
for i in Liste:
        temp = i ^ cle
        car=chr(temp)
        password=password+car
print password

Flag :

BREIZHCTF{Aujourd'hui,Je_suis_Pentester_et_mon_manager_m'a_demande_si_je_savais_coder_en_JAVA_..._VDM}