ctf-writeups

Writeups for CTFs solved by DarkKnight

View on GitHub

Crackmes

CrackMe1 - 0hWhite

Platform: Windows Language: Java
   
Arch: java Difficulty: 1.0

Description

An extremely simple crackme for beginners! If you’ve managed to crack the program, feel free to post a comment/solution :)

Explanation

Ok, so there’s simply just a 8-digit key that you must figure out in order to unlock the program. But, if you have some reverse engineering skills it should be pretty easy to unlock the program without a key ;)

Solution

Decompiling will give us this code

package me.ohwhite.crackme1;

import java.util.ArrayList;
import java.util.Scanner;

public class eahUaRpTUmfhN {
  static ArrayList<Integer> nums = new ArrayList<>();
  
  static ArrayList<String> strings = new ArrayList<>();
  
  public static void main(String[] SqbnompFlDpDc) {
    app();
    initAdd();
    System.out.println(strings.get(0));
    Scanner in = new Scanner(System.in);
    try {
      int userInput = in.nextInt();
      if (userInput != ((Integer)nums.get(0)).intValue())
        return; 
    } catch (Exception sqOKMTghgGjWK) {
      System.exit(-7);
    } 
    System.out.println(strings.get(1));
  }
  
  public static void initAdd() {
    nums.add(Integer.valueOf(5256));
  }
  
  public static void app() {
    strings.add("Enter an 8 digit code: ");
    strings.add("You have successfully logged in!");
  }
}


package me.ohwhite.crackme1;

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
  static ArrayList<Integer> nums = new ArrayList<>();
  
  static ArrayList<String> strings = new ArrayList<>();
  
  public static void main(String[] args) {
    app();
    initAdd();
    System.out.println(strings.get(0));
    Scanner in = new Scanner(System.in);
    try {
      int userInput = in.nextInt();
      if (userInput != ((Integer)nums.get(0)).intValue())
        return; 
    } catch (Exception e) {
      System.exit(-7);
    } 
    System.out.println(strings.get(1));
  }
  
  public static void initAdd() {
    nums.add(Integer.valueOf(5256));
  }
  
  public static void app() {
    strings.add("Enter an 8 digit code: ");
    strings.add("You have successfully logged in!");
  }
}


Enter an 8 digit code:
5256
You have successfully logged in!
Press any key to continue . . .

The Password

5256