View previous topic :: View next topic |
Author |
Message |
ubiByte Advanced Cheater
Reputation: 1
Joined: 08 Mar 2013 Posts: 57
|
Posted: Tue Jan 03, 2017 12:28 pm Post subject: Password Generator with a Key |
|
|
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 |
|
 |
atom0s Moderator
Reputation: 204
Joined: 25 Jan 2006 Posts: 8577 Location: 127.0.0.1
|
Posted: Tue Jan 03, 2017 1:07 pm Post subject: |
|
|
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 |
|
 |
ubiByte Advanced Cheater
Reputation: 1
Joined: 08 Mar 2013 Posts: 57
|
Posted: Tue Jan 03, 2017 1:11 pm Post subject: |
|
|
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 |
|
 |
atom0s Moderator
Reputation: 204
Joined: 25 Jan 2006 Posts: 8577 Location: 127.0.0.1
|
Posted: Tue Jan 03, 2017 1:16 pm Post subject: |
|
|
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 |
|
 |
ubiByte Advanced Cheater
Reputation: 1
Joined: 08 Mar 2013 Posts: 57
|
Posted: Tue Jan 03, 2017 1:17 pm Post subject: |
|
|
Not a problem I understand, thanks for the help atom
|
|
Back to top |
|
 |
|