hashcat / hashcat

World's fastest and most advanced password recovery utility
https://hashcat.net/hashcat/
20.83k stars 2.85k forks source link

Add Windows Test Script or Refactor Current to be Cross-Platform Compatible #4024

Open fin3ss3g0d opened 2 months ago

fin3ss3g0d commented 2 months ago

Describe the feature Currently, there is only a Bash script (tools/test.sh) to test a module with the Perl test modules but everyone may not be a Linux user. It would be great to have a PowerShell or batch script so people could test from a Windows system, or a cross-platform compatible solution utilizing a scripting language such as Python that can be used on Windows, Mac OS, or Linux.

PenguinKeeper7 commented 2 months ago

I completely agree, there should be a Windows-native test script although just to let you know, you can use it using Linux emulators/terminals like WSL and Cygwin in Windows, you just have to use the -o win flag, the terminal you use just has to be able to run .exes (which WSL and Cygwin can do)

fin3ss3g0d commented 2 months ago

Thank you for that tip! I have WSL2 installed which allowed me to test on my Windows system 😀 How is one supposed to know this? Are you supposed to run the script with the help flag or is there documentation somewhere covering the script?

This documentation I feel like could use an expansion and could be made more thorough. For example, there is no mention of test.sh at all in that documentation and I walk away confused on how to write a test module using Perl. I feel like it's not 100% clear what I am supposed to do is the best way I can describe it.

For example, is says each module provides the function module_verify_hash and I am testing mine with the following:

tools/test.sh -m 12150 -a all -t all -P -o win

But that method is never being called during my debugging and I see all hashes were found and cracked.

PenguinKeeper7 commented 2 months ago

How is one supposed to know this? Are you supposed to run the script with the help flag or is there documentation somewhere in the script?

You can run test.sh --help and it'll show you a list of all arguments, including that OS flag I used. Almost every executable has a "--help" argument, including Hashcat itself and test.pl

module_verify_hash isn't being used during testing

Correct, test.sh doesn't use that and instead only generates hashes which are then cracked/validated by Hashcat to test the module and kernel rather than the perl. As the documentation you listed says, it's only used in the test.pl script's "verify" mode, which test.sh doesn't use

There is no mention of test.sh at all in that documentation

Correct but it is mentioned in the plugin development guide. I kind of agree that it should be implemented into that document too but given test.sh is a plugin development tool, it makes sense for it to be in the separate documentation and the perl scripts are on a lower-level, hierarchically than test.sh:

fin3ss3g0d commented 2 months ago

Ah, there is the documentation I was looking for. In my mind, I went on the journey of creating my first plugin following the plugin development guide, but I must have missed that section. Maybe simply including a link in this document to here would work and explaining where the actual documentation resides at the moment? When someone that is new to the project and developing plugins navigates here that's where they might expect the documentation for the test modules to be which kind of makes sense from my perspective, as it is the only README.md file in that directory which is named test_modules and contains all of them. By the way, thank you for all of your replies and information so far, I really appreciate it!