Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
Brute Force Algorithm, Java Brute Forcer
My little program simulates some Keyevents; you can enter password length (up to 1-8) but it's still some slow… Mb s.o. can post some improvements.
Rg Dewy
import java.awt.event.KeyEvent;
import java.awt.Robot;
// ::::::::::::::::::::
// :: Key performance :
// :: Made by Dewy :
// ::::::::::::::::::::
public class Password{
static Password robot2;
static Robot robot;
public static void main(String[] args) throws AWTException {
robot = new Robot();
robot2 = new Password();
robot2.inital();
}
int f = Terminal.askInt("Please enter the Password length (1-8): ");
public void test (int b) {
switch (b) {
case 0:
robot.delay(2);
robot.keyPress( KeyEvent.VK_A);
robot.keyRelease( KeyEvent.VK_A);
break;
case 1:
robot.delay(2);
robot.keyPress( KeyEvent.VK_B);
robot.keyRelease( KeyEvent.VK_B);
break;
case 2:
robot.delay(2);
robot.keyPress( KeyEvent.VK_C);
robot.keyRelease( KeyEvent.VK_C);
break;
case 3:
robot.delay(2);
robot.keyPress( KeyEvent.VK_D);
robot.keyRelease( KeyEvent.VK_D);
break;
case 4:
robot.delay(2);
robot.keyPress( KeyEvent.VK_E);
robot.keyRelease( KeyEvent.VK_E);
break;
case 5:
robot.delay(2);
robot.keyPress( KeyEvent.VK_F);
robot.keyRelease( KeyEvent.VK_F);
break;
case 6:
robot.delay(2);
robot.keyPress( KeyEvent.VK_G);
robot.keyRelease( KeyEvent.VK_G);
break;
case 7:
robot.delay(2);
robot.keyPress( KeyEvent.VK_H);
robot.keyRelease( KeyEvent.VK_H);
break;
case 8:
robot.delay(2);
robot.keyPress( KeyEvent.VK_I);
robot.keyRelease( KeyEvent.VK_I);
break;
case 9:
robot.delay(2);
robot.keyPress( KeyEvent.VK_J);
robot.keyRelease( KeyEvent.VK_J);
break;
case 10:
robot.delay(2);
robot.keyPress( KeyEvent.VK_K);
robot.keyRelease( KeyEvent.VK_K);
break;
case 11:
robot.delay(2);
robot.keyPress( KeyEvent.VK_L);
robot.keyRelease( KeyEvent.VK_L);
break;
case 12:
robot.delay(2);
robot.keyPress( KeyEvent.VK_M);
robot.keyRelease( KeyEvent.VK_M);
break;
case 13:
robot.delay(2);
robot.keyPress( KeyEvent.VK_N);
robot.keyRelease( KeyEvent.VK_N);
break;
case 14:
robot.delay(2);
robot.keyPress( KeyEvent.VK_O);
robot.keyRelease( KeyEvent.VK_O);
break;
case 15:
robot.delay(2);
robot.keyPress( KeyEvent.VK_P);
robot.keyRelease( KeyEvent.VK_P);
break;
case 16:
robot.delay(2);
robot.keyPress( KeyEvent.VK_Q);
robot.keyRelease( KeyEvent.VK_Q);
break;
case 17:
robot.delay(2);
robot.keyPress( KeyEvent.VK_R);
robot.keyRelease( KeyEvent.VK_R);
break;
case 18:
robot.delay(2);
robot.keyPress( KeyEvent.VK_S);
robot.keyRelease( KeyEvent.VK_S);
break;
case 19:
robot.delay(2);
robot.keyPress( KeyEvent.VK_T);
robot.keyRelease( KeyEvent.VK_T);
break;
case 20:
robot.delay(2);
robot.keyPress( KeyEvent.VK_U);
robot.keyRelease( KeyEvent.VK_U);
break;
case 21:
robot.delay(2);
robot.keyPress( KeyEvent.VK_V);
robot.keyRelease( KeyEvent.VK_V);
break;
case 22:
robot.delay(2);
robot.keyPress( KeyEvent.VK_W);
robot.keyRelease( KeyEvent.VK_W);
break;
case 23:
robot.delay(2);
robot.keyPress( KeyEvent.VK_X);
robot.keyRelease( KeyEvent.VK_X);
break;
case 24:
robot.delay(2);
robot.keyPress( KeyEvent.VK_Y);
robot.keyRelease( KeyEvent.VK_Y);
break;
case 25:
robot.delay(2);
robot.keyPress( KeyEvent.VK_Z);
robot.keyRelease( KeyEvent.VK_Z);
break;
case 26:
robot.delay(2);
robot.keyPress( KeyEvent.VK_0);
robot.keyRelease( KeyEvent.VK_0);
break;
case 27:
robot.delay(2);
robot.keyPress( KeyEvent.VK_1);
robot.keyRelease( KeyEvent.VK_1);
break;
case 28:
robot.delay(2);
robot.keyPress( KeyEvent.VK_2);
robot.keyRelease( KeyEvent.VK_2);
break;
case 29:
robot.delay(2);
robot.keyPress( KeyEvent.VK_3);
robot.keyRelease( KeyEvent.VK_3);
break;
case 30:
robot.delay(2);
robot.keyPress( KeyEvent.VK_4);
robot.keyRelease( KeyEvent.VK_4);
break;
case 31:
robot.delay(2);
robot.keyPress( KeyEvent.VK_5);
robot.keyRelease( KeyEvent.VK_5);
break;
case 32:
robot.delay(2);
robot.keyPress( KeyEvent.VK_6);
robot.keyRelease( KeyEvent.VK_6);
break;
case 33:
robot.delay(2);
robot.keyPress( KeyEvent.VK_7);
robot.keyRelease( KeyEvent.VK_7);
break;
case 34:
robot.delay(2);
robot.keyPress( KeyEvent.VK_8);
robot.keyRelease( KeyEvent.VK_8);
break;
case 35:
robot.delay(2);
robot.keyPress( KeyEvent.VK_9);
robot.keyRelease( KeyEvent.VK_9);
break;
}
}
public void inital() {
// Password Length: 1
if (f == 1) {
for (int i = 0; i<36; i++) {
robot2.test(i);
robot.delay(2);
robot.keyPress( KeyEvent.VK_ENTER);
robot.keyRelease( KeyEvent.VK_ENTER);
}
}
// Password Length: 2
if (f == 2) {
for (int i = 0; i<36; i++) {
for (int u = 0; u<36; u++) {
robot2.test(i);
robot2.test(u);
robot.delay(2);
robot.keyPress( KeyEvent.VK_ENTER);
robot.keyRelease( KeyEvent.VK_ENTER);
}
}
}
// Password Length: 3
if (f == 3) {
for (int i = 0; i<36; i++) {
for (int u = 0; u<36; u++) {
for (int a = 0; a<36; a++) {
robot2.test(i);
robot2.test(u);
robot2.test(a);
robot.delay(2);
robot.keyPress( KeyEvent.VK_ENTER);
robot.keyRelease( KeyEvent.VK_ENTER);
}
}
}
}
// Password Length: 4
if (f == 4) {
for (int i = 0; i<36; i++) {
for (int u = 0; u<36; u++) {
for (int a = 0; a<36; a++) {
for (int c = 0; c<36; c++) {
robot2.test(i);
robot2.test(u);
robot2.test(a);
robot2.test(c);
robot.delay(2);
robot.keyPress( KeyEvent.VK_ENTER);
robot.keyRelease( KeyEvent.VK_ENTER);
}
}
}
}
}
// Password Length: 5
if (f == 5) {
for (int i = 0; i<36; i++) {
for (int u = 0; u<36; u++) {
for (int a = 0; a<36; a++) {
for (int c = 0; c<36; c++) {
for (int v = 0; v<36; v++) {
robot2.test(i);
robot2.test(u);
robot2.test(a);
robot2.test(c);
robot2.test(v);
robot.delay(2);
robot.keyPress( KeyEvent.VK_ENTER);
robot.keyRelease( KeyEvent.VK_ENTER);
}
}
}
}
}
}
// Password Length: 6
if (f == 6) {
for (int i = 0; i<36; i++) {
for (int u = 0; u<36; u++) {
for (int a = 0; a<36; a++) {
for (int c = 0; c<36; c++) {
for (int v = 0; v<36; v++) {
for (int n = 0; n<36; n++) {
robot2.test(i);
robot2.test(u);
robot2.test(a);
robot2.test(c);
robot2.test(v);
robot2.test(n);
robot.delay(2);
robot.keyPress( KeyEvent.VK_ENTER);
robot.keyRelease( KeyEvent.VK_ENTER);
}
}
}
}
}
}
}
// Password Length: 7
if (f == 7) {
for (int i = 0; i<36; i++) {
for (int u = 0; u<36; u++) {
for (int a = 0; a<36; a++) {
for (int c = 0; c<36; c++) {
for (int v = 0; v<36; v++) {
for (int n = 0; n<36; n++) {
for (int m = 0; m<36; m++) {
robot2.test(i);
robot2.test(u);
robot2.test(a);
robot2.test(c);
robot2.test(v);
robot2.test(n);
robot2.test(m);
robot.delay(2);
robot.keyPress( KeyEvent.VK_ENTER);
robot.keyRelease( KeyEvent.VK_ENTER);
}
}
}
}
}
}
}
}
// Password Lenght: 8
if (f == 7) {
for (int i = 0; i<36; i++) {
for (int u = 0; u<36; u++) {
for (int a = 0; a<36; a++) {
for (int c = 0; c<36; c++) {
for (int v = 0; v<36; v++) {
for (int n = 0; n<36; n++) {
for (int m = 0; m<36; m++) {
for (int l = 0; l<36; l++) {
robot2.test(i);
robot2.test(u);
robot2.test(a);
robot2.test(c);
robot2.test(v);
robot2.test(n);
robot2.test(m);
robot2.test(l);
robot.delay(2);
robot.keyPress( KeyEvent.VK_ENTER);
robot.keyRelease( KeyEvent.VK_ENTER);
}
}
}
}
}
}
}
}
}
}
}```
Hi there,
Simple Brute Force password generator in Java…
import java.util.Arrays;
public class BruteForce {
public static void main(String[] args) {
String password = "pass";
char[] charset = "abcdefghijklmnopqrstuvwxyz".toCharArray();
BruteForce bf = new BruteForce(charset, 1);
String attempt = bf.toString();
while (true) {
if (attempt.equals(password)) {
System.out.println("Password Found: " + attempt);
break;
}
attempt = bf.toString();
System.out.println("Tried: " + attempt);
bf.increment();
}
}
private char[] cs; // Character Set
private char[] cg; // Current Guess
public BruteForce(char[] characterSet, int guessLength) {
cs = characterSet;
cg = new char[guessLength];
Arrays.fill(cg, cs[0]);
}
public void increment() {
int index = cg.length - 1;
while(index >= 0) {
if (cg[index] == cs[cs.length-1]) {
if (index == 0) {
cg = new char[cg.length+1];
Arrays.fill(cg, cs[0]);
break;
} else {
cg[index] = cs[0];
index--;
}
} else {
cg[index] = cs[Arrays.binarySearch(cs, cg[index]) + 1];
break;
}
}
}
public String toString() {
return String.valueOf(cg);
}
}
I think it's pretty simple, but let me know if you have questions.
Sequencing password-attempts is where the fun is :-)
Well I figured it out with the help of another helpful chap.
The charset needs to look like this:
char[] charset = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
I was just sticking the numbers on the end, but because binarysearch needs the array to be sorted, that didnt work. Stickin them on at the beginning does work though! :D