import java.util.*;
class VaultDoor4 {
public static void main(String args[]) {
VaultDoor4 vaultDoor = new VaultDoor4();
Scanner scanner = new Scanner(System.in);
System.out.print("Enter vault password: ");
String userInput = scanner.next();
String input = userInput.substring("picoCTF{".length(),userInput.length()-1);
if (vaultDoor.checkPassword(input)) {
System.out.println("Access granted.");
} else {
System.out.println("Access denied!");
}
}
// I made myself dizzy converting all of these numbers into different bases,
// so I just *know* that this vault will be impenetrable. This will make Dr.
// Evil like me better than all of the other minions--especially Minion
// #5620--I just know it!
//
// .:::. .:::.
// :::::::.:::::::
// :::::::::::::::
// ':::::::::::::'
// ':::::::::'
// ':::::'
// ':'
// -Minion #7781
public boolean checkPassword(String password) {
byte[] passBytes = password.getBytes();
byte[] myBytes = {
106 , 85 , 53 , 116 , 95 , 52 , 95 , 98 ,
0x55, 0x6e, 0x43, 0x68, 0x5f, 0x30, 0x66, 0x5f,
0142, 0131, 0164, 063 , 0163, 0137, 0146, 064 ,
'a' , '8' , 'c' , 'd' , '8' , 'f' , '7' , 'e' ,
};
for (int i=0; i<32; i++) {
if (passBytes[i] != myBytes[i]) {
return false;
}
}
return true;
}
}
위 코드를 보면 checkPassword에서 input(password)값과 myBytes값을 비교해 같으면 통과한다고 한다.
첫번째 줄은 10진수, 두번째줄은 16진수, 세번째줄은 8진수 값으로 보아 ASCII 값으로 변환해주면 된다. 마지막 줄은 그대로 입력하면 성공 !
FLAG : picoCTF{jU5t_4_bUnCh_0f_bYt3s_f4a8cd8f7e}
'CTF > Reversing' 카테고리의 다른 글
[picoCTF] droids0 (0) | 2021.01.12 |
---|---|
[picoCTF] OTP Implementation (0) | 2021.01.12 |
[picoCTF] asm2 (0) | 2021.01.10 |
[Hitcon2020] Welcome (0) | 2020.11.30 |
[BalsnCTF2020] babyrev (0) | 2020.11.29 |