Java security checking

2015-10-07T00:54:00

I'm trying to make an application in Java to check my password security. This is what I already did:

import java.util.Arrays;

public class BruteForce {

    public static void main(String[] args) {
        String password = "123123";
        char[] charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".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("" + 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;
            }
        }
    }

    @Override
    public String toString() {
        return String.valueOf(cg);
    }
}

But I take a long time to get the "123123" as password (Maybe I don't even get it, I'm not sure)... Is there a better method to do this with upper/lower alphabetical letters and numbers? Thank you.

Copyright License:
Author:「Qello Smithx」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/32975443/java-security-checking

About “Java security checking” questions

I am using JRE 1.7 with Unlimited java policy Checking java.security.Security.getProviders() on Mac returns following - Provider[0]:: SUN 1.7 Provider[1]:: SunRsaSign 1.7 Provider[2]:: SunEC 1.7
I'm trying to make an application in Java to check my password security. This is what I already did: import java.util.Arrays; public class BruteForce { public static void main(String[] args)...
For a service facade implemented in .NET, is there an option (e.g. a 3rd party library) that can be used to perform some security checking? I mean some kind of access control list based checking for
After moving on Java 1.8 there is a security warning showing on starting web-start application. UFT can see all objects of this Java dialog by object spy. So I have coded message checking and
For each security rule, is it necessary to always check auth !== null? It seems redundant to have to do this for every child rule. I checked Firebase's own Firechat security rules and the enforcem...
How can I define a custom Authentication provider by using Spring Security with Java Configurations? I would like to perform a login checking credentials on my own database.
I have a webapp where I've used Java config for Spring security. The problem is that if I do not explicitly specify /j_spring_security_check as the login processing URL, it will fail. I end up gett...
Does anyone know a good fuzzer for checking PHP security? I am using a Mac and just installed the Radamsa fuzzer from git but I don't know how to use it. Does anyone have any suggestions?
I have been struggling with integrating Spring Security and FreeMarker template in Spring MVC application. I used a very simple login form to submit the username and password to /j_spring_security_...
I am trying to set up a java configurated spring environment including spring security. The application starts without any error, but I am not able to login succeffully. WebAppInitializer import...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.