Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Password Generator with a Key

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming -> Crackmes
View previous topic :: View next topic  
Author Message
ubiByte
Advanced Cheater
Reputation: 1

Joined: 08 Mar 2013
Posts: 57

PostPosted: Tue Jan 03, 2017 12:28 pm    Post subject: Password Generator with a Key Reply with quote

Hey guys,

I wrote this simple program that generates a password of any length for you. I wrote it for a friend to mess around with, is it possible to debug the program and skip the section that's asking for the key and go straight to the start of the program?

If you can do this can you write up a tutorial or explain how you went by it to achieve the end result?

Here's the URL for it since I can't upload binary files here,
http://www.filedropper.com/passwordgenerator

Thanks,

There's no virus/malware on it. It's just a program I wrote in Java and converted it to .exe format.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8515
Location: 127.0.0.1

PostPosted: Tue Jan 03, 2017 1:07 pm    Post subject: Reply with quote

Password is: 84763764

Source code is:
Code:

import java.io.InputStream;
import java.io.PrintStream;
import java.security.SecureRandom;
import java.util.InputMismatchException;
import java.util.Scanner;

public class PasswordGeneration {
    static String characters = "!@#$%^&*()_+-=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    static SecureRandom random = new SecureRandom();

    public String randomPassword(int length) {
        StringBuilder sb = new StringBuilder(length);
        int i = 0;
        while (i < length) {
            sb.append(characters.charAt(random.nextInt(characters.length())));
            ++i;
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        Scanner choice = new Scanner(System.in);
        System.out.println("-------- Welcome to Ubi's Password Generator --------");
        System.out.println("Hello, Jakub - To get the program going you must guess my key. Good luck!");
        System.out.print("Key: ");
        int key = 84763764;
        int keyGuess = 0;
        try {
            keyGuess = choice.nextInt();
        }
        catch (InputMismatchException exception) {
            System.out.print("");
        }
        if (keyGuess == key) {
            int choiceentry;
            block8 : do {
                System.out.println("1 - Generate a Password");
                System.out.println("2 - Quit");
                System.out.print("Please enter 1 or 2 as your choice: ");
                while (!choice.hasNextInt()) {
                    System.out.println("That's not a valid entry, try again. ");
                    System.out.println("1 - Generate a Password");
                    System.out.println("2 - Quit");
                    System.out.print("Please enter 1 or 2 as your choice: ");
                    choice.nextLine();
                }
                choiceentry = choice.nextInt();
                switch (choiceentry) {
                    case 1: {
                        Scanner keyboard = new Scanner(System.in);
                        System.out.print("Password Length: ");
                        try {
                            int length = keyboard.nextInt();
                            PasswordGeneration generator = new PasswordGeneration();
                            String password = generator.randomPassword(length);
                            System.out.println("Password: " + password);
                        }
                        catch (InputMismatchException exception) {
                            System.out.println("Please enter a numeric value.");
                        }
                        continue block8;
                    }
                    case 2: {
                        System.out.println("See you next time!");
                        break;
                    }
                    default: {
                        System.out.println("That's not a valid entry, try again.");
                    }
                }
            } while (choiceentry != 2);
        } else {
            System.out.println("Incorrect - Better luck next time!");
            System.exit(0);
        }
    }
}


Easier to just dump the source, edit it as needed and recompile it since Java is not secure.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
ubiByte
Advanced Cheater
Reputation: 1

Joined: 08 Mar 2013
Posts: 57

PostPosted: Tue Jan 03, 2017 1:11 pm    Post subject: Reply with quote

It's that easy to just dump the source code? Wow nice. For the purpose of learning though can this be figured out by using a debugger like x64dbg, OllyDbg or any other program of similar function?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8515
Location: 127.0.0.1

PostPosted: Tue Jan 03, 2017 1:16 pm    Post subject: Reply with quote

You need to debug the spawned java.exe process in order to do that. I'm not going to bother though since its not worth it with how Java is and what I showed already.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
ubiByte
Advanced Cheater
Reputation: 1

Joined: 08 Mar 2013
Posts: 57

PostPosted: Tue Jan 03, 2017 1:17 pm    Post subject: Reply with quote

Not a problem I understand, thanks for the help atom
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming -> Crackmes All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites