Initial commit
This commit is contained in:
26
.gitignore
vendored
Normal file
26
.gitignore
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/build/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
.gradle/
|
||||||
25
gchashcrack_console/.gitignore
vendored
Normal file
25
gchashcrack_console/.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/build/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
86
gchashcrack_console/pom.xml
Normal file
86
gchashcrack_console/pom.xml
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.example</groupId>
|
||||||
|
<artifactId>gchashcrack</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.release>11</maven.compiler.release>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- https://mvnrepository.com/artifact/commons-cli/commons-cli -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-cli</groupId>
|
||||||
|
<artifactId>commons-cli</artifactId>
|
||||||
|
<version>1.4</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.12</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-codec</groupId>
|
||||||
|
<artifactId>commons-codec</artifactId>
|
||||||
|
<version>1.14</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-controls</artifactId>
|
||||||
|
<version>14</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>
|
||||||
|
org.tenvoorde.gchashcrack.GcHashCrack
|
||||||
|
</mainClass>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
<descriptorRefs>
|
||||||
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
|
</descriptorRefs>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-maven-plugin</artifactId>
|
||||||
|
<version>0.0.4</version>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>HelloFX</mainClass>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
package org.tenvoorde.gchashcrack;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.commons.cli.*;
|
||||||
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class GcHashCrack {
|
||||||
|
private static String format;
|
||||||
|
private static String digest;
|
||||||
|
private static String hash;
|
||||||
|
|
||||||
|
private static List<RangeVariable> rangeVariables = new ArrayList<>();
|
||||||
|
private static String formattedString;
|
||||||
|
|
||||||
|
private static int totalCombinations = 1;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
private static class RangeVariable {
|
||||||
|
private int lower;
|
||||||
|
private int upper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
if (!parseOptions(args)) {
|
||||||
|
System.exit(255);
|
||||||
|
}
|
||||||
|
parseFormattedString();
|
||||||
|
startCracking();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void startCracking() {
|
||||||
|
Integer[] loopVar = new Integer[rangeVariables.size()];
|
||||||
|
for (int i = 0; i < rangeVariables.size(); i++) {
|
||||||
|
loopVar[i] = rangeVariables.get(i).getLower();
|
||||||
|
totalCombinations *= (rangeVariables.get(i).getUpper() - rangeVariables.get(i).getLower() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Total combinations: " + totalCombinations);
|
||||||
|
|
||||||
|
boolean success = false;
|
||||||
|
String stringToHash;
|
||||||
|
int counter = 0;
|
||||||
|
int percentage = 0;
|
||||||
|
int percentage10 = 0;
|
||||||
|
do {
|
||||||
|
counter++;
|
||||||
|
stringToHash = String.format(formattedString, (Object[]) loopVar);
|
||||||
|
success = testHash(stringToHash);
|
||||||
|
if ((100 * counter / totalCombinations) > percentage) {
|
||||||
|
System.out.print(".");
|
||||||
|
percentage = 100 * counter / totalCombinations;
|
||||||
|
}
|
||||||
|
if ((percentage / 10) > (percentage10 / 10)) {
|
||||||
|
System.out.print(percentage + "%");
|
||||||
|
//percentage10 =
|
||||||
|
}
|
||||||
|
if (!increaseLoopVars(loopVar)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (!success);
|
||||||
|
if (success) {
|
||||||
|
System.out.println("Success: " + stringToHash);
|
||||||
|
} else {
|
||||||
|
System.out.println("No match found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean testHash(String stringToHash) {
|
||||||
|
String generatedHash;
|
||||||
|
switch(digest) {
|
||||||
|
case "MD5":
|
||||||
|
generatedHash = DigestUtils.md5Hex(stringToHash);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
System.err.println("Illegal digest: " + digest);
|
||||||
|
}
|
||||||
|
return stringToHash.equalsIgnoreCase(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean increaseLoopVars(Integer[] loopVar) {
|
||||||
|
boolean done = false;
|
||||||
|
int cursor = 0;
|
||||||
|
do {
|
||||||
|
if (cursor == rangeVariables.size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
loopVar[cursor]++;
|
||||||
|
if (loopVar[cursor] > rangeVariables.get(cursor).getUpper()) {
|
||||||
|
loopVar[cursor] = rangeVariables.get(cursor).getLower();
|
||||||
|
cursor++;
|
||||||
|
} else {
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
} while (!done);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void parseFormattedString() {
|
||||||
|
// \[[0-9]-[0-9]\]
|
||||||
|
// N52 [0-5][0-9].[0-9][0-9][0-9] E005 [0-5][0-9].[0-9][0-9][0-9]
|
||||||
|
String pattern = "\\[[0-9]-[0-9]\\]";
|
||||||
|
Pattern p = Pattern.compile(pattern);
|
||||||
|
|
||||||
|
Matcher matcher = p.matcher(format);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
while (matcher.find()) {
|
||||||
|
String range = format.substring(matcher.start(), matcher.end());
|
||||||
|
rangeVariables.add(rangeVariableFromFormat(range));
|
||||||
|
}
|
||||||
|
|
||||||
|
formattedString = format.replaceAll(pattern, "%d");
|
||||||
|
System.out.println(formattedString);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static RangeVariable rangeVariableFromFormat(String range) {
|
||||||
|
range = range.substring(1, range.length() - 1);
|
||||||
|
return RangeVariable.builder()
|
||||||
|
.lower(Integer.parseInt(range.substring(0, 1)))
|
||||||
|
.upper(Integer.parseInt(range.substring(2, 3)))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean parseOptions(String[] args) {
|
||||||
|
CommandLineParser parser = new DefaultParser();
|
||||||
|
|
||||||
|
Option formatOption = Option.builder("f").desc("Formatted string (between \"\" quotes) to be hashed").hasArg(true).numberOfArgs(1).optionalArg(false).longOpt("formattedString").build();
|
||||||
|
Option digestOption = Option.builder("d").desc("Digest type (currently supported: MD5)").hasArg(true).numberOfArgs(1).optionalArg(false).longOpt("digest").build();
|
||||||
|
Option hashOption = Option.builder("h").desc("Hash to compare with").hasArg(true).numberOfArgs(1).optionalArg(false).longOpt("hash").build();
|
||||||
|
Options options = new Options();
|
||||||
|
options.addOption(formatOption);
|
||||||
|
options.addOption(digestOption);
|
||||||
|
options.addOption(hashOption);
|
||||||
|
|
||||||
|
CommandLine line = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
line = parser.parse( options, args );
|
||||||
|
} catch( ParseException exp ) {
|
||||||
|
System.err.println(exp.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean errorInCmdLine = false;
|
||||||
|
|
||||||
|
if (!line.hasOption("f")) {
|
||||||
|
System.err.println("Missing argument: -f");
|
||||||
|
errorInCmdLine = true;
|
||||||
|
}
|
||||||
|
if (!line.hasOption("d")) {
|
||||||
|
System.err.println("Missing argument: -d");
|
||||||
|
errorInCmdLine = true;
|
||||||
|
}
|
||||||
|
if (!line.hasOption("h")) {
|
||||||
|
System.err.println("Missing argument: -h");
|
||||||
|
errorInCmdLine = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!errorInCmdLine) {
|
||||||
|
format = line.getOptionValue("f");
|
||||||
|
digest = line.getOptionValue("d");
|
||||||
|
hash = line.getOptionValue("h");
|
||||||
|
} else {
|
||||||
|
HelpFormatter formatter = new HelpFormatter();
|
||||||
|
formatter.setLongOptSeparator("=");
|
||||||
|
formatter.printHelp(160, "gcHashCrack", "\n", options, "Example: gcHashCrack --hash=c35d8729ca887d26366da4ef9b843c08 --string=\"N52 [4-5][0-9].[0-9][0-9][0-9] E005 58.[0-9][0-9][0-9]\" --digest=MD5", true);
|
||||||
|
errorInCmdLine = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !errorInCmdLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
25
hashcracker-installer/.gitignore
vendored
Normal file
25
hashcracker-installer/.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/build/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
94
hashcracker-installer/pom.xml
Normal file
94
hashcracker-installer/pom.xml
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.tenvoorde</groupId>
|
||||||
|
<artifactId>hashcracker-installer</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<packaging>izpack-jar</packaging>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<!-- Installer variables -->
|
||||||
|
<staging.dir>${project.build.directory}/staging</staging.dir>
|
||||||
|
<info.appName>HashCracker</info.appName>
|
||||||
|
<!-- <info.appsubpath>my-killer-app/standard</info.appsubpath>-->
|
||||||
|
<izpack.dir.app>${basedir}/src/main/izpack</izpack.dir.app>
|
||||||
|
<staging.dir.app>${staging.dir}/appfiles</staging.dir.app>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.tenvoorde</groupId>
|
||||||
|
<artifactId>hashcracker</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.izpack</groupId>
|
||||||
|
<artifactId>izpack-maven-plugin</artifactId>
|
||||||
|
<version>5.1.3</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<baseDir>${staging.dir.app}</baseDir>
|
||||||
|
<installFile>${izpack.dir.app}/install.xml</installFile>
|
||||||
|
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||||
|
<finalName>${project.build.finalName}</finalName>
|
||||||
|
<!-- <enableOverrideArtifact>true</enableOverrideArtifact>-->
|
||||||
|
<mkdirs>true</mkdirs>
|
||||||
|
<autoIncludeUrl>false</autoIncludeUrl>
|
||||||
|
<autoIncludeDevelopers>false</autoIncludeDevelopers>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<version>1.7</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>default-cli</id>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<target>
|
||||||
|
<copy todir="${staging.dir}">
|
||||||
|
<fileset dir="${izpack.dir.app}" />
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<version>2.10</version>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${staging.dir}/lib</outputDirectory>
|
||||||
|
<excludeTransitive>true</excludeTransitive>
|
||||||
|
<stripVersion>true</stripVersion>
|
||||||
|
<overWriteReleases>true</overWriteReleases>
|
||||||
|
<overWriteSnapshots>true</overWriteSnapshots>
|
||||||
|
<overWriteIfNewer>true</overWriteIfNewer>
|
||||||
|
<excludeScope>system</excludeScope>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy</id>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-dependencies</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
52
hashcracker-installer/src/main/izpack/install.xml
Normal file
52
hashcracker-installer/src/main/izpack/install.xml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<izpack:installation version="5.0"
|
||||||
|
xmlns:izpack="http://izpack.org/schema/installation"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://izpack.org/schema/installation http://izpack.org/schema/5.0/izpack-installation-5.0.xsd">
|
||||||
|
|
||||||
|
<info>
|
||||||
|
<appname>HashCracker</appname>
|
||||||
|
<appversion>1.0</appversion>
|
||||||
|
<!-- <appsubpath>myapp</appsubpath>-->
|
||||||
|
<javaversion>11</javaversion>
|
||||||
|
</info>
|
||||||
|
|
||||||
|
|
||||||
|
<locale>
|
||||||
|
<langpack iso3="eng"/>
|
||||||
|
</locale>
|
||||||
|
|
||||||
|
<guiprefs width="800" height="600" resizable="no">
|
||||||
|
<splash>images/peas_load.gif</splash>
|
||||||
|
<laf name="substance">
|
||||||
|
<os family="windows" />
|
||||||
|
<os family="unix" />
|
||||||
|
<param name="variant" value="mist-silver" />
|
||||||
|
</laf>
|
||||||
|
<laf name="substance">
|
||||||
|
<os family="mac" />
|
||||||
|
<param name="variant" value="mist-aqua" />
|
||||||
|
</laf>
|
||||||
|
<modifier key="useHeadingPanel" value="yes" />
|
||||||
|
</guiprefs>
|
||||||
|
|
||||||
|
<panels>
|
||||||
|
<panel classname="TargetPanel"/>
|
||||||
|
<!--
|
||||||
|
<panel classname="PacksPanel"/>
|
||||||
|
-->
|
||||||
|
<panel classname="InstallPanel"/>
|
||||||
|
<panel classname="FinishPanel"/>
|
||||||
|
</panels>
|
||||||
|
|
||||||
|
<packs>
|
||||||
|
<pack name="Test Core" required="yes">
|
||||||
|
<singlefile src="" target="">
|
||||||
|
<
|
||||||
|
</singlefile>
|
||||||
|
<description>The core files needed for the application</description>
|
||||||
|
<fileset dir="plain" targetdir="${INSTALL_PATH}" override="true"/>
|
||||||
|
<parsable targetfile="${INSTALL_PATH}/test.properties"/>
|
||||||
|
</pack>
|
||||||
|
</packs>
|
||||||
|
|
||||||
|
</izpack:installation>
|
||||||
25
hashcracker/.gitignore
vendored
Normal file
25
hashcracker/.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/build/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
39
hashcracker/build.gradle
Normal file
39
hashcracker/build.gradle
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
plugins {
|
||||||
|
id 'org.openjfx.javafxplugin' version '0.0.8'
|
||||||
|
id 'org.beryx.runtime' version '1.8.5'
|
||||||
|
id 'com.github.johnrengelman.shadow' version '5.2.0'
|
||||||
|
// id 'org.beryx.jlink' version '2.19.0'
|
||||||
|
id "io.freefair.lombok" version "5.1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.openjfx:javafx-controls:14'
|
||||||
|
// compileOnly 'org.projectlombok:lombok:1.18.12'
|
||||||
|
// annotationProcessor 'org.projectlombok:lombok:1.18.12'
|
||||||
|
// testCompileOnly 'org.projectlombok:lombok:1.18.12'
|
||||||
|
// testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
|
||||||
|
implementation 'org.mapstruct:mapstruct-processor:1.3.1.Final'
|
||||||
|
implementation 'org.apache.commons:commons-lang3:3.10'
|
||||||
|
implementation 'commons-codec:commons-codec:1.14'
|
||||||
|
implementation 'org.jfxtras:jmetro:11.6.11'
|
||||||
|
}
|
||||||
|
|
||||||
|
javafx {
|
||||||
|
version = "14"
|
||||||
|
modules = [ 'javafx.controls']
|
||||||
|
}
|
||||||
|
|
||||||
|
mainClassName = 'org.tenvoorde.hashcracker.Launcher'
|
||||||
|
//application.mainModule = 'hashcracker'
|
||||||
|
|
||||||
|
//jlink {
|
||||||
|
// forceMerge 'lombok'
|
||||||
|
//}
|
||||||
|
runtime {
|
||||||
|
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
|
||||||
|
}
|
||||||
22
hashcracker/build.gradle.uit
Normal file
22
hashcracker/build.gradle.uit
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
plugins {
|
||||||
|
id 'org.openjfx.' version '0.0.5'
|
||||||
|
id 'org.beryx.runtime' version '1.0.0'
|
||||||
|
id "com.github.johnrengelman.shadow" version "4.0.3"
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
}
|
||||||
|
|
||||||
|
javafx {
|
||||||
|
modules = [ 'javafx.controls' ]
|
||||||
|
}
|
||||||
|
|
||||||
|
mainClassName = 'hellofx.Launcher'
|
||||||
|
|
||||||
|
runtime {
|
||||||
|
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
|
||||||
|
}
|
||||||
BIN
hashcracker/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
hashcracker/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
hashcracker/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
hashcracker/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
185
hashcracker/gradlew
vendored
Normal file
185
hashcracker/gradlew
vendored
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=`expr $i + 1`
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
0) set -- ;;
|
||||||
|
1) set -- "$args0" ;;
|
||||||
|
2) set -- "$args0" "$args1" ;;
|
||||||
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
104
hashcracker/gradlew.bat
vendored
Normal file
104
hashcracker/gradlew.bat
vendored
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
2
hashcracker/lombok.config
Normal file
2
hashcracker/lombok.config
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# This file is generated by the 'io.freefair.lombok' Gradle plugin
|
||||||
|
config.stopBubbling = true
|
||||||
105
hashcracker/pom.xml
Normal file
105
hashcracker/pom.xml
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.tenvoorde</groupId>
|
||||||
|
<artifactId>hashcracker</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
<izpack.version>5.1.3</izpack.version>
|
||||||
|
<izpack.staging>${project.build.directory}/staging</izpack.staging>
|
||||||
|
<javafx.version>14</javafx.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-controls</artifactId>
|
||||||
|
<version>${javafx.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.12</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
|
<version>1.3.1.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.10</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-codec</groupId>
|
||||||
|
<artifactId>commons-codec</artifactId>
|
||||||
|
<version>1.14</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jfxtras</groupId>
|
||||||
|
<artifactId>jmetro</artifactId>
|
||||||
|
<version>11.6.11</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<release>11</release>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-maven-plugin</artifactId>
|
||||||
|
<version>0.0.4</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>default-cli</id>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>org.tenvoorde.hashcracker.HashCracker</mainClass>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>debug</id>
|
||||||
|
<configuration>
|
||||||
|
<options>
|
||||||
|
<option>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:8000</option>
|
||||||
|
</options>
|
||||||
|
<mainClass>org.tenvoorde.hashcracker.HashCracker</mainClass>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.2.4</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||||
|
<shadedClassifierName>project-classifier</shadedClassifierName>
|
||||||
|
<outputFile>shade\${project.artifactId}.jar</outputFile>
|
||||||
|
<transformers>
|
||||||
|
<transformer implementation=
|
||||||
|
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||||
|
<mainClass>hellofx.Launcher</mainClass>
|
||||||
|
</transformer>
|
||||||
|
</transformers>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
5
hashcracker/settings.gradle
Normal file
5
hashcracker/settings.gradle
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
/*
|
||||||
|
* This file was generated by the Gradle 'init' task.
|
||||||
|
*/
|
||||||
|
|
||||||
|
rootProject.name = 'hashcracker'
|
||||||
9
hashcracker/src/main/java/module-info.java.uit
Normal file
9
hashcracker/src/main/java/module-info.java.uit
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
module hashcracker {
|
||||||
|
requires javafx.controls;
|
||||||
|
requires org.apache.commons.codec;
|
||||||
|
requires org.apache.commons.lang3;
|
||||||
|
requires lombok;
|
||||||
|
requires org.jfxtras.styles.jmetro;
|
||||||
|
|
||||||
|
exports org.tenvoorde.hashcracker;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package org.tenvoorde.hashcracker;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public enum Digest {
|
||||||
|
MD5(DigestUtils::md5Hex),
|
||||||
|
MD2(DigestUtils::md2Hex),
|
||||||
|
SHA1(DigestUtils::sha1Hex),
|
||||||
|
SHA256(DigestUtils::sha256Hex);
|
||||||
|
// MD5(input -> {
|
||||||
|
// try {
|
||||||
|
// MessageDigest md = null;
|
||||||
|
// md = MessageDigest.getInstance("MD5");
|
||||||
|
// byte[] messageDigest = md.digest(input.getBytes());
|
||||||
|
// BigInteger no = new BigInteger(1, messageDigest);
|
||||||
|
// String hashtext = no.toString(16);
|
||||||
|
// while (hashtext.length() < 32) {
|
||||||
|
// hashtext = "0" + hashtext;
|
||||||
|
// }
|
||||||
|
// return hashtext;
|
||||||
|
// } catch (NoSuchAlgorithmException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
Function<String, String> getDigest;
|
||||||
|
|
||||||
|
Digest(Function<String, String> getDigest) {
|
||||||
|
this.getDigest = getDigest;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package org.tenvoorde.hashcracker;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
class ParseResult {
|
||||||
|
private long totalCombinations;
|
||||||
|
private List<RangeVariable> rangeVariables;
|
||||||
|
private String formattedStringWithRanges;
|
||||||
|
private List<String> log = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FormattedStringParser {
|
||||||
|
|
||||||
|
|
||||||
|
public static ParseResult parse(String format) {
|
||||||
|
long totalCombinations;
|
||||||
|
List<RangeVariable> rangeVariables = new ArrayList<>();
|
||||||
|
List<String> log = new ArrayList<>();
|
||||||
|
String formattedStringWithRanges;
|
||||||
|
String pattern = "\\[[0-9]-[0-9]\\]";
|
||||||
|
Pattern p = Pattern.compile(pattern);
|
||||||
|
totalCombinations = 1;
|
||||||
|
|
||||||
|
Matcher matcher = p.matcher(format);
|
||||||
|
|
||||||
|
while (matcher.find()) {
|
||||||
|
String range = format.substring(matcher.start(), matcher.end());
|
||||||
|
RangeVariable rv = RangeVariable.rangeVariableFromFormat(range);
|
||||||
|
rangeVariables.add(rv);
|
||||||
|
totalCombinations *= (rv.getUpper() - rv.getLower() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
formattedStringWithRanges = format.replaceAll(pattern, "%d");
|
||||||
|
|
||||||
|
if (rangeVariables.isEmpty()) {
|
||||||
|
log.add("Warning: no ranges found in formatted string.");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer[] loopVar = new Integer[rangeVariables.size()];
|
||||||
|
|
||||||
|
for (int i = 0; i < rangeVariables.size(); i++) {
|
||||||
|
loopVar[i] = rangeVariables.get(i).getLower();
|
||||||
|
}
|
||||||
|
String formattedStringWithLowerBounds = String.format(formattedStringWithRanges, (Object[]) loopVar);
|
||||||
|
|
||||||
|
for (int i = 0; i < rangeVariables.size(); i++) {
|
||||||
|
loopVar[i] = rangeVariables.get(i).getUpper();
|
||||||
|
}
|
||||||
|
String formattedStringWithUpperBounds = String.format(formattedStringWithRanges, (Object[]) loopVar);
|
||||||
|
|
||||||
|
log.add("Testing from " + formattedStringWithLowerBounds + " to " + formattedStringWithUpperBounds);
|
||||||
|
|
||||||
|
log.add("Total combinations to test: " + NumberFormat.getIntegerInstance().format(totalCombinations) + ".");
|
||||||
|
|
||||||
|
return ParseResult.builder()
|
||||||
|
.formattedStringWithRanges(formattedStringWithRanges)
|
||||||
|
.rangeVariables(rangeVariables)
|
||||||
|
.totalCombinations(totalCombinations)
|
||||||
|
.log(log)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package org.tenvoorde.hashcracker;
|
||||||
|
|
||||||
|
public class HackWorker {
|
||||||
|
}
|
||||||
@@ -0,0 +1,260 @@
|
|||||||
|
package org.tenvoorde.hashcracker;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.concurrent.Task;
|
||||||
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.*;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.layout.ColumnConstraints;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
import javafx.scene.text.Text;
|
||||||
|
import javafx.scene.text.TextFlow;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import jfxtras.styles.jmetro.JMetro;
|
||||||
|
import jfxtras.styles.jmetro.Style;
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class HashCracker extends Application {
|
||||||
|
|
||||||
|
private Task<Boolean> task;
|
||||||
|
|
||||||
|
private TextField formatTxtBox;
|
||||||
|
private TextField hashTxtBox;
|
||||||
|
private ComboBox<Digest> digestCombo;
|
||||||
|
private Button resetBtn;
|
||||||
|
private Button checkBtn;
|
||||||
|
private Button startBtn;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
private TextArea log;
|
||||||
|
|
||||||
|
private String format;
|
||||||
|
private Digest digest;
|
||||||
|
@Getter
|
||||||
|
private String hash;
|
||||||
|
|
||||||
|
private List<RangeVariable> rangeVariables;
|
||||||
|
private String formattedStringWithRanges;
|
||||||
|
|
||||||
|
private long totalCombinations;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage stage) {
|
||||||
|
buildGridPane(stage);
|
||||||
|
setEventHandlers();
|
||||||
|
appendLog("HashCrack 1.0 started.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setEventHandlers() {
|
||||||
|
this.formatTxtBox.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
this.startBtn.setDisable(true);
|
||||||
|
if (StringUtils.isAnyEmpty(newValue, this.hashTxtBox.getText())) {
|
||||||
|
this.checkBtn.setDisable(true);
|
||||||
|
} else {
|
||||||
|
this.checkBtn.setDisable(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.hashTxtBox.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
this.startBtn.setDisable(true);
|
||||||
|
if (StringUtils.isAnyEmpty(newValue, this.formatTxtBox.getText())) {
|
||||||
|
this.checkBtn.setDisable(true);
|
||||||
|
} else {
|
||||||
|
this.checkBtn.setDisable(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.resetBtn.setOnAction(event -> {
|
||||||
|
this.formatTxtBox.setText("");
|
||||||
|
this.hashTxtBox.setText("");
|
||||||
|
});
|
||||||
|
|
||||||
|
this.checkBtn.setOnAction(event -> {
|
||||||
|
this.format = this.formatTxtBox.getText();
|
||||||
|
this.hash = this.hashTxtBox.getText();
|
||||||
|
this.digest = this.digestCombo.getValue();
|
||||||
|
|
||||||
|
ParseResult parseResult = FormattedStringParser.parse(this.format);
|
||||||
|
this.rangeVariables = parseResult.getRangeVariables();
|
||||||
|
this.formattedStringWithRanges = parseResult.getFormattedStringWithRanges();
|
||||||
|
this.totalCombinations = parseResult.getTotalCombinations();
|
||||||
|
appendLog(parseResult.getLog());
|
||||||
|
|
||||||
|
this.startBtn.setDisable(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.startBtn.setOnAction(event -> {
|
||||||
|
this.progressBar.setStyle("-fx-accent: #0000ff;");
|
||||||
|
appendLog("Search started.");
|
||||||
|
|
||||||
|
startCracking();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startCracking() {
|
||||||
|
task = new Task<>() {
|
||||||
|
@Override
|
||||||
|
protected Boolean call() throws Exception {
|
||||||
|
Integer[] loopVar = new Integer[rangeVariables.size()];
|
||||||
|
for (int i = 0; i < rangeVariables.size(); i++) {
|
||||||
|
loopVar[i] = rangeVariables.get(i).getLower();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean success = false;
|
||||||
|
String stringToHash;
|
||||||
|
int counter = 0;
|
||||||
|
do {
|
||||||
|
counter++;
|
||||||
|
updateProgress(counter, totalCombinations);
|
||||||
|
stringToHash = String.format(formattedStringWithRanges, (Object[]) loopVar);
|
||||||
|
|
||||||
|
success = digest.getDigest.apply(stringToHash).equalsIgnoreCase(getHash());
|
||||||
|
if (!RangeVariable.increaseLoopVars(loopVar, rangeVariables)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (!success);
|
||||||
|
if (success) {
|
||||||
|
appendLog("Success: " + stringToHash + ".");
|
||||||
|
} else {
|
||||||
|
appendLog("No match found.");
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
task.setOnSucceeded(event -> {
|
||||||
|
Boolean success = task.getValue();
|
||||||
|
if (success) {
|
||||||
|
this.progressBar.setStyle("-fx-accent: green;");
|
||||||
|
} else {
|
||||||
|
this.progressBar.setStyle("-fx-accent: red;");
|
||||||
|
}
|
||||||
|
this.resetBtn.setDisable(false);
|
||||||
|
this.checkBtn.setDisable(false);
|
||||||
|
this.startBtn.setDisable(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.progressBar.progressProperty().bind(task.progressProperty());
|
||||||
|
|
||||||
|
final Thread thread = new Thread(task, "task-thread");
|
||||||
|
|
||||||
|
this.startBtn.setDisable(true);
|
||||||
|
this.checkBtn.setDisable(true);
|
||||||
|
this.resetBtn.setDisable(true);
|
||||||
|
thread.setDaemon(true);
|
||||||
|
thread.start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void appendLog(List<String> logLines) {
|
||||||
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm:ss");
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
for (String logLine : logLines) {
|
||||||
|
this.log.appendText(dtf.format(now) + " | " + logLine + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void appendLog(String logLine) {
|
||||||
|
appendLog(List.of(logLine));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void buildGridPane(Stage stage) {
|
||||||
|
|
||||||
|
GridPane pane = new GridPane();
|
||||||
|
|
||||||
|
pane.setPadding(new Insets(10, 10, 10, 10));
|
||||||
|
pane.setVgap(5);
|
||||||
|
pane.setHgap(5);
|
||||||
|
|
||||||
|
this.formatTxtBox = new TextField();
|
||||||
|
this.formatTxtBox.setPrefColumnCount(40);
|
||||||
|
this.formatTxtBox.setTooltip(new Tooltip("Example: N52 12.[0-9][0-9][0-9] E005 [0-5][0-9].[0-9][0-9][0-9]"));
|
||||||
|
var formatLabel = new Label("Formatted string");
|
||||||
|
|
||||||
|
this.hashTxtBox = new TextField();
|
||||||
|
this.hashTxtBox.setPrefColumnCount(40);
|
||||||
|
var hashLabel = new Label("Hash");
|
||||||
|
|
||||||
|
this.digestCombo = new ComboBox<>();
|
||||||
|
this.digestCombo.getItems().addAll(Digest.values());
|
||||||
|
this.digestCombo.setEditable(false);
|
||||||
|
this.digestCombo.getSelectionModel().selectFirst();
|
||||||
|
var digestLabel = new Label("Digest");
|
||||||
|
|
||||||
|
this.resetBtn = new Button("Reset");
|
||||||
|
this.checkBtn = new Button("Check");
|
||||||
|
this.checkBtn.setDisable(true);
|
||||||
|
this.startBtn = new Button("Start");
|
||||||
|
this.startBtn.setDisable(true);
|
||||||
|
|
||||||
|
this.progressBar = new ProgressBar();
|
||||||
|
this.progressBar.setProgress(0.0);
|
||||||
|
this.progressBar.setPrefWidth(640);
|
||||||
|
this.progressBar.setStyle("-fx-accent: blue;");
|
||||||
|
|
||||||
|
this.log = new TextArea();
|
||||||
|
this.log.setEditable(false);
|
||||||
|
this.log.setMinHeight(265);
|
||||||
|
this.log.setFocusTraversable(false);
|
||||||
|
|
||||||
|
pane.getColumnConstraints().add(new ColumnConstraints(100));
|
||||||
|
pane.getColumnConstraints().add(new ColumnConstraints(100));
|
||||||
|
pane.getColumnConstraints().add(new ColumnConstraints(100));
|
||||||
|
pane.getColumnConstraints().add(new ColumnConstraints(300));
|
||||||
|
|
||||||
|
pane.add(formatLabel, 0, 2);
|
||||||
|
pane.add(this.formatTxtBox, 1, 2, 3, 1);
|
||||||
|
pane.add(hashLabel, 0, 5);
|
||||||
|
pane.add(this.hashTxtBox, 1, 5, 3, 1);
|
||||||
|
pane.add(digestLabel, 0, 8);
|
||||||
|
pane.add(this.digestCombo, 1, 8);
|
||||||
|
pane.add(this.resetBtn, 0, 13, 1, 1);
|
||||||
|
pane.add(this.checkBtn, 1, 13, 1, 1);
|
||||||
|
pane.add(this.startBtn, 2, 13, 1, 1);
|
||||||
|
pane.add(this.progressBar, 0, 16, 4, 1);
|
||||||
|
pane.add(this.log, 0, 18, 4, 1);
|
||||||
|
|
||||||
|
// this.pane.setGridLinesVisible(true);
|
||||||
|
|
||||||
|
Tab decodeTab = new Tab("Decode");
|
||||||
|
decodeTab.setClosable(false);
|
||||||
|
decodeTab.setContent(pane);
|
||||||
|
|
||||||
|
TextFlow encodeText = new TextFlow(new Text("Coming soon."));
|
||||||
|
|
||||||
|
Tab encodeTab = new Tab("Encode");
|
||||||
|
encodeTab.setClosable(false);
|
||||||
|
encodeTab.setContent(encodeText);
|
||||||
|
|
||||||
|
TextFlow aboutText = new TextFlow();
|
||||||
|
aboutText.getChildren().add(new Text("HashCracker 1.0 by Michel ten Voorde"));
|
||||||
|
|
||||||
|
Tab aboutTab = new Tab("About");
|
||||||
|
aboutTab.setClosable(false);
|
||||||
|
aboutTab.setContent(aboutText);
|
||||||
|
|
||||||
|
|
||||||
|
TabPane tabPane = new TabPane(decodeTab, encodeTab, aboutTab);
|
||||||
|
|
||||||
|
var scene = new Scene(tabPane, 636, 520);
|
||||||
|
JMetro jMetro = new JMetro(Style.LIGHT);
|
||||||
|
jMetro.setScene(scene);
|
||||||
|
stage.setTitle("GcHashCrack");
|
||||||
|
stage.getIcons().add(new Image(HashCracker.class.getResourceAsStream("/images/hash.png")));
|
||||||
|
stage.setResizable(false);
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
launch();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package org.tenvoorde.hashcracker;
|
||||||
|
|
||||||
|
public class Launcher {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
HashCracker.main(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package org.tenvoorde.hashcracker;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
public class RangeVariable {
|
||||||
|
private int lower;
|
||||||
|
private int upper;
|
||||||
|
|
||||||
|
public static RangeVariable rangeVariableFromFormat(String range) {
|
||||||
|
range = range.substring(1, range.length() - 1);
|
||||||
|
return RangeVariable.builder()
|
||||||
|
.lower(Integer.parseInt(range.substring(0, 1)))
|
||||||
|
.upper(Integer.parseInt(range.substring(2, 3)))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increase int array by way of a RangeVariable array.
|
||||||
|
* @param loopVar array of
|
||||||
|
* @return false if done, true if otherwise.
|
||||||
|
*/
|
||||||
|
public static boolean increaseLoopVars(Integer[] loopVar, List<RangeVariable> rangeVariables) {
|
||||||
|
boolean done = false;
|
||||||
|
int cursor = 0;
|
||||||
|
do {
|
||||||
|
if (cursor == rangeVariables.size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
loopVar[cursor]++;
|
||||||
|
if (loopVar[cursor] > rangeVariables.get(cursor).getUpper()) {
|
||||||
|
loopVar[cursor] = rangeVariables.get(cursor).getLower();
|
||||||
|
cursor++;
|
||||||
|
} else {
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
} while (!done);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
hashcracker/src/main/resources/images/hash.png
Normal file
BIN
hashcracker/src/main/resources/images/hash.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 656 B |
Reference in New Issue
Block a user