1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-13 19:28:56 +00:00

Merge pull request #3127 from b0lek/hex_separator

Added hex format for --separator option
This commit is contained in:
Jens Steube 2022-01-20 17:03:27 +01:00 committed by GitHub
commit 0c91f6fc01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 2 deletions

View File

@ -14,6 +14,7 @@
- Added support to use --debug-mode in attack-mode 9 (Association Attack)
- Added guess data to --status-json output
- Added hex format for --separator option
##
## Bugs

View File

@ -7,6 +7,7 @@
#include "types.h"
#include "memory.h"
#include "event.h"
#include "convert.h"
#include "logfile.h"
#include "interface.h"
#include "shared.h"
@ -594,9 +595,31 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
if (user_options->separator_chgd == true)
{
if (strlen (user_options->separator) != 1)
bool error = false;
if ((strlen (user_options->separator) != 1) && (strlen (user_options->separator) != 4))
{
event_log_error (hashcat_ctx, "Separator length has to be exactly 1 byte.");
error = true;
}
if (strlen (user_options->separator) == 4)
{
if ((user_options->separator[0] == '0') && (user_options->separator[1] == 'x'))
{
if (is_valid_hex_string((u8 * )(&(user_options->separator[2])),2)){
u8 sep = hex_to_u8((u8 * )(&(user_options->separator[2])));
user_options->separator[0] = sep;
user_options->separator[1] = 0;
}
else
{
error = true;
}
}
else{
error = true;
}
}
if (error){
event_log_error (hashcat_ctx, "Separator length has to be exactly 1 byte (single char or hex format e.g. 0x09 for TAB)");
return -1;
}