LOL ok now that should be it
This commit is contained in:
parent
2342333697
commit
67911c8e05
3 changed files with 147 additions and 2 deletions
144
Installer/src/main/java/de/com/baseband/login/Hasher.java
Normal file
144
Installer/src/main/java/de/com/baseband/login/Hasher.java
Normal file
|
@ -0,0 +1,144 @@
|
|||
package de.com.baseband.login;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class Hasher {
|
||||
public static final String TYPE_SHA256HEX = "sha256hex";
|
||||
public static final String TYPE_SHA512HEX = "sha512hex";
|
||||
public static final String TYPE_INT = "int";
|
||||
@SuppressWarnings("CanBeFinal")
|
||||
public static String LETTERS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"§$%&/()=?#_-.:,;µ<>|^°{[]}\\ ";
|
||||
|
||||
public static String sha256hex(String toHash) {
|
||||
MessageDigest digest;
|
||||
try {
|
||||
digest = MessageDigest.getInstance("SHA-256");
|
||||
}
|
||||
catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException("Impossible condition reached");
|
||||
}
|
||||
return hash(toHash, digest);
|
||||
}
|
||||
|
||||
public static String sha512hex(String toHash) {
|
||||
MessageDigest digest;
|
||||
try {
|
||||
digest = MessageDigest.getInstance("SHA-512");
|
||||
}
|
||||
catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException("Impossible condition reached");
|
||||
}
|
||||
return hash(toHash, digest);
|
||||
}
|
||||
|
||||
private static String hash(String toHash, MessageDigest digest) {
|
||||
byte[] hash = digest.digest(
|
||||
toHash.getBytes(StandardCharsets.UTF_8));
|
||||
StringBuilder hexString = new StringBuilder();
|
||||
for (byte b : hash) {
|
||||
String hex = Integer.toHexString(0xff & b);
|
||||
if (hex.length() == 1) hexString.append('0');
|
||||
hexString.append(hex);
|
||||
}
|
||||
return hexString.toString();
|
||||
}
|
||||
|
||||
public static String bruteforce(String type, String hash, int beginAt) {
|
||||
switch (type) {
|
||||
case TYPE_SHA256HEX:
|
||||
return bf_sha256hex(hash, beginAt);
|
||||
case TYPE_SHA512HEX:
|
||||
return bf_sha512hex(hash, beginAt);
|
||||
case TYPE_INT:
|
||||
return bf_int(Integer.parseInt(hash), beginAt);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String bf_int(int hash, int beginAt) {
|
||||
for (int length = beginAt; true; length++) {
|
||||
String s;
|
||||
if ((s = bf_int_tryGenChar("", 0, length, hash)) != null) {
|
||||
if (s.hashCode() == hash)
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String bf_int_tryGenChar(String str, int pos, int length, int hash) {
|
||||
if (length == 0) {
|
||||
if (str.hashCode() == hash)
|
||||
return str;
|
||||
}
|
||||
else {
|
||||
if (pos != 0) {
|
||||
pos = 0;
|
||||
}
|
||||
for (int i = pos; i < LETTERS.toCharArray().length; i++) {
|
||||
String s;
|
||||
if ((s = bf_int_tryGenChar(str + LETTERS.charAt(i), i, length - 1, hash)) != null) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String bf_sha256hex(String hash, int beginAt) {
|
||||
for (int length = beginAt; true; length++) {
|
||||
String s;
|
||||
if ((s = bf_sha256hex_tryGenChar("", 0, length, hash)) != null) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String bf_sha256hex_tryGenChar(String str, int pos, int length, String hash) {
|
||||
if (length == 0) {
|
||||
if (sha256hex(str).equals(hash))
|
||||
return str;
|
||||
}
|
||||
else {
|
||||
if (pos != 0) {
|
||||
pos = 0;
|
||||
}
|
||||
for (int i = pos; i < LETTERS.toCharArray().length; i++) {
|
||||
String s;
|
||||
if ((s = bf_sha256hex_tryGenChar(str + LETTERS.charAt(i), i, length - 1, hash)) != null) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String bf_sha512hex(String hash, int beginAt) {
|
||||
for (int length = beginAt; true; length++) {
|
||||
String s;
|
||||
if ((s = bf_sha512hex_tryGenChar("", 0, length, hash)) != null) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String bf_sha512hex_tryGenChar(String str, int pos, int length, String hash) {
|
||||
if (length == 0) {
|
||||
if (sha512hex(str).equals(hash))
|
||||
return str;
|
||||
}
|
||||
else {
|
||||
if (pos != 0) {
|
||||
pos = 0;
|
||||
}
|
||||
for (int i = pos; i < LETTERS.toCharArray().length; i++) {
|
||||
String s;
|
||||
if ((s = bf_sha512hex_tryGenChar(str + LETTERS.charAt(i), i, length - 1, hash)) != null) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -23,9 +23,10 @@ public class LoginGenerator {
|
|||
Key k = new Key(key);
|
||||
FileOutputStream fos = new FileOutputStream("baseband.login");
|
||||
PrintWriter writer = new PrintWriter(fos);
|
||||
writer.println(k.encryptString(Hasher.sha512hex(key)));
|
||||
writer.println(k.encryptString(username));
|
||||
writer.println(k.encryptString(password));
|
||||
writer.println(k.encryptString("GENERATED USING " + LoginGenerator.class.getName() + "!!"));
|
||||
writer.println(k.encryptString("dev login file! if you find this on an end-user pc something has gone terribly wrong."));
|
||||
//dumb as rocks
|
||||
writer.flush();
|
||||
fos.flush();
|
||||
|
|
|
@ -319,7 +319,7 @@ public class Loader implements Util {
|
|||
FileReader fileReader = new FileReader(file);
|
||||
BufferedReader reader = new BufferedReader(fileReader);
|
||||
|
||||
if(!key.decryptString(reader.readLine()).equals("baseband_login")) {
|
||||
if(!key.decryptString(reader.readLine()).equals(key)) {
|
||||
LOGGER.fatal("Login Data Checksum Not Matching!");
|
||||
LOGGER.fatal("This usually only happens when your HWID changes,");
|
||||
LOGGER.fatal("Rerun the Installer.");
|
||||
|
|
Loading…
Add table
Reference in a new issue