1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 07:08:19 +00:00

Merge pull request #2885 from neheb/charfixes

const and char fixes
This commit is contained in:
Jens Steube 2021-07-25 10:36:40 +02:00 committed by GitHub
commit 959a232828
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 143 additions and 143 deletions

View File

@ -15,8 +15,8 @@
int _wopen (const char *path, int oflag, ...);
#endif
bool hc_fopen (HCFILE *fp, const char *path, char *mode);
bool hc_fopen_raw (HCFILE *fp, const char *path, char *mode);
bool hc_fopen (HCFILE *fp, const char *path, const char *mode);
bool hc_fopen_raw (HCFILE *fp, const char *path, const char *mode);
int hc_fscanf (HCFILE *fp, const char *format, void *ptr);
int hc_fprintf (HCFILE *fp, const char *format, ...);
int hc_vfprintf (HCFILE *fp, const char *format, va_list ap);

View File

@ -1075,7 +1075,7 @@ typedef struct hc_fp
bool is_zip;
int bom_size;
char *mode;
const char *mode;
const char *path;
} HCFILE;

View File

@ -26,10 +26,10 @@
#include "terminal.h"
#if defined (__linux__)
static const char *dri_card0_path = "/dev/dri/card0";
static const char *const dri_card0_path = "/dev/dri/card0";
static const char *drm_card0_vendor_path = "/sys/class/drm/card0/device/vendor";
static const char *drm_card0_driver_path = "/sys/class/drm/card0/device/driver";
static const char *const drm_card0_vendor_path = "/sys/class/drm/card0/device/vendor";
static const char *const drm_card0_driver_path = "/sys/class/drm/card0/device/driver";
#endif
static const u32 full01 = 0x01010101;

View File

@ -666,7 +666,7 @@ u32 brain_auth_challenge (void)
#else
static const char *urandom = "/dev/urandom";
static const char *const urandom = "/dev/urandom";
HCFILE fp;

View File

@ -21,7 +21,7 @@ int _wopen (const char *path, int oflag, ...)
}
#endif
bool hc_fopen (HCFILE *fp, const char *path, char *mode)
bool hc_fopen (HCFILE *fp, const char *path, const char *mode)
{
if (path == NULL || mode == NULL) return false;
@ -130,7 +130,7 @@ bool hc_fopen (HCFILE *fp, const char *path, char *mode)
return true;
}
bool hc_fopen_raw (HCFILE *fp, const char *path, char *mode)
bool hc_fopen_raw (HCFILE *fp, const char *path, const char *mode)
{
if (path == NULL || mode == NULL) return false;

View File

@ -10,16 +10,16 @@
#include "hlfmt.h"
#include "shared.h"
static const char *HLFMT_TEXT_HASHCAT = "native hashcat";
static const char *HLFMT_TEXT_PWDUMP = "pwdump";
static const char *HLFMT_TEXT_PASSWD = "passwd";
static const char *HLFMT_TEXT_SHADOW = "shadow";
static const char *HLFMT_TEXT_DCC = "DCC";
static const char *HLFMT_TEXT_DCC2 = "DCC 2";
static const char *HLFMT_TEXT_NETNTLM1 = "NetNTLMv1";
static const char *HLFMT_TEXT_NETNTLM2 = "NetNTLMv2";
static const char *HLFMT_TEXT_NSLDAP = "nsldap";
static const char *HLFMT_TEXT_NSLDAPS = "nsldaps";
static const char *const HLFMT_TEXT_HASHCAT = "native hashcat";
static const char *const HLFMT_TEXT_PWDUMP = "pwdump";
static const char *const HLFMT_TEXT_PASSWD = "passwd";
static const char *const HLFMT_TEXT_SHADOW = "shadow";
static const char *const HLFMT_TEXT_DCC = "DCC";
static const char *const HLFMT_TEXT_DCC2 = "DCC 2";
static const char *const HLFMT_TEXT_NETNTLM1 = "NetNTLMv1";
static const char *const HLFMT_TEXT_NETNTLM2 = "NetNTLMv2";
static const char *const HLFMT_TEXT_NSLDAP = "nsldap";
static const char *const HLFMT_TEXT_NSLDAPS = "nsldaps";
// hlfmt hashcat

View File

@ -16,7 +16,7 @@
#include "ext_lzma.h"
#include "mpsp.h"
static const char *DEF_MASK = "?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d";
static const char *const DEF_MASK = "?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d";
#define MAX_MFS 5 // 4*charset, 1*mask

View File

@ -15,97 +15,97 @@
#include <sys/cygwin.h>
#endif
static const char *PA_000 = "OK";
static const char *PA_001 = "Ignored due to comment";
static const char *PA_002 = "Ignored due to zero length";
static const char *PA_003 = "Line-length exception";
static const char *PA_004 = "Hash-length exception";
static const char *PA_005 = "Hash-value exception";
static const char *PA_006 = "Salt-length exception";
static const char *PA_007 = "Salt-value exception";
static const char *PA_008 = "Salt-iteration count exception";
static const char *PA_009 = "Separator unmatched";
static const char *PA_010 = "Signature unmatched";
static const char *PA_011 = "Invalid hccapx file size";
static const char *PA_012 = "Invalid hccapx eapol size";
static const char *PA_013 = "Invalid psafe2 filesize";
static const char *PA_014 = "Invalid psafe3 filesize";
static const char *PA_015 = "Invalid truecrypt filesize";
static const char *PA_016 = "Invalid veracrypt filesize";
static const char *PA_017 = "Invalid SIP directive, only MD5 is supported";
static const char *PA_018 = "Hash-file exception";
static const char *PA_019 = "Hash-encoding exception";
static const char *PA_020 = "Salt-encoding exception";
static const char *PA_021 = "Invalid LUKS filesize";
static const char *PA_022 = "Invalid LUKS identifier";
static const char *PA_023 = "Invalid LUKS version";
static const char *PA_024 = "Invalid or unsupported LUKS cipher type";
static const char *PA_025 = "Invalid or unsupported LUKS cipher mode";
static const char *PA_026 = "Invalid or unsupported LUKS hash type";
static const char *PA_027 = "Invalid LUKS key size";
static const char *PA_028 = "Disabled LUKS key detected";
static const char *PA_029 = "Invalid LUKS key AF stripes count";
static const char *PA_030 = "Invalid combination of LUKS hash type and cipher type";
static const char *PA_031 = "Invalid hccapx signature";
static const char *PA_032 = "Invalid hccapx version";
static const char *PA_033 = "Invalid hccapx message pair";
static const char *PA_034 = "Token encoding exception";
static const char *PA_035 = "Token length exception";
static const char *PA_036 = "Insufficient entropy exception";
static const char *PA_037 = "Hash contains unsupported compression type for current mode";
static const char *PA_038 = "Invalid key size";
static const char *PA_039 = "Invalid block size";
static const char *PA_040 = "Invalid or unsupported cipher";
static const char *PA_041 = "Invalid filesize";
static const char *PA_042 = "IV length exception";
static const char *PA_043 = "CT length exception";
static const char *PA_255 = "Unknown error";
static const char *const PA_000 = "OK";
static const char *const PA_001 = "Ignored due to comment";
static const char *const PA_002 = "Ignored due to zero length";
static const char *const PA_003 = "Line-length exception";
static const char *const PA_004 = "Hash-length exception";
static const char *const PA_005 = "Hash-value exception";
static const char *const PA_006 = "Salt-length exception";
static const char *const PA_007 = "Salt-value exception";
static const char *const PA_008 = "Salt-iteration count exception";
static const char *const PA_009 = "Separator unmatched";
static const char *const PA_010 = "Signature unmatched";
static const char *const PA_011 = "Invalid hccapx file size";
static const char *const PA_012 = "Invalid hccapx eapol size";
static const char *const PA_013 = "Invalid psafe2 filesize";
static const char *const PA_014 = "Invalid psafe3 filesize";
static const char *const PA_015 = "Invalid truecrypt filesize";
static const char *const PA_016 = "Invalid veracrypt filesize";
static const char *const PA_017 = "Invalid SIP directive, only MD5 is supported";
static const char *const PA_018 = "Hash-file exception";
static const char *const PA_019 = "Hash-encoding exception";
static const char *const PA_020 = "Salt-encoding exception";
static const char *const PA_021 = "Invalid LUKS filesize";
static const char *const PA_022 = "Invalid LUKS identifier";
static const char *const PA_023 = "Invalid LUKS version";
static const char *const PA_024 = "Invalid or unsupported LUKS cipher type";
static const char *const PA_025 = "Invalid or unsupported LUKS cipher mode";
static const char *const PA_026 = "Invalid or unsupported LUKS hash type";
static const char *const PA_027 = "Invalid LUKS key size";
static const char *const PA_028 = "Disabled LUKS key detected";
static const char *const PA_029 = "Invalid LUKS key AF stripes count";
static const char *const PA_030 = "Invalid combination of LUKS hash type and cipher type";
static const char *const PA_031 = "Invalid hccapx signature";
static const char *const PA_032 = "Invalid hccapx version";
static const char *const PA_033 = "Invalid hccapx message pair";
static const char *const PA_034 = "Token encoding exception";
static const char *const PA_035 = "Token length exception";
static const char *const PA_036 = "Insufficient entropy exception";
static const char *const PA_037 = "Hash contains unsupported compression type for current mode";
static const char *const PA_038 = "Invalid key size";
static const char *const PA_039 = "Invalid block size";
static const char *const PA_040 = "Invalid or unsupported cipher";
static const char *const PA_041 = "Invalid filesize";
static const char *const PA_042 = "IV length exception";
static const char *const PA_043 = "CT length exception";
static const char *const PA_255 = "Unknown error";
static const char *OPTI_STR_OPTIMIZED_KERNEL = "Optimized-Kernel";
static const char *OPTI_STR_ZERO_BYTE = "Zero-Byte";
static const char *OPTI_STR_PRECOMPUTE_INIT = "Precompute-Init";
static const char *OPTI_STR_MEET_IN_MIDDLE = "Meet-In-The-Middle";
static const char *OPTI_STR_EARLY_SKIP = "Early-Skip";
static const char *OPTI_STR_NOT_SALTED = "Not-Salted";
static const char *OPTI_STR_NOT_ITERATED = "Not-Iterated";
static const char *OPTI_STR_PREPENDED_SALT = "Prepended-Salt";
static const char *OPTI_STR_APPENDED_SALT = "Appended-Salt";
static const char *OPTI_STR_SINGLE_HASH = "Single-Hash";
static const char *OPTI_STR_SINGLE_SALT = "Single-Salt";
static const char *OPTI_STR_BRUTE_FORCE = "Brute-Force";
static const char *OPTI_STR_RAW_HASH = "Raw-Hash";
static const char *OPTI_STR_SLOW_HASH_SIMD_INIT = "Slow-Hash-SIMD-INIT";
static const char *OPTI_STR_SLOW_HASH_SIMD_LOOP = "Slow-Hash-SIMD-LOOP";
static const char *OPTI_STR_SLOW_HASH_SIMD_COMP = "Slow-Hash-SIMD-COMP";
static const char *OPTI_STR_USES_BITS_8 = "Uses-8-Bit";
static const char *OPTI_STR_USES_BITS_16 = "Uses-16-Bit";
static const char *OPTI_STR_USES_BITS_32 = "Uses-32-Bit";
static const char *OPTI_STR_USES_BITS_64 = "Uses-64-Bit";
static const char *const OPTI_STR_OPTIMIZED_KERNEL = "Optimized-Kernel";
static const char *const OPTI_STR_ZERO_BYTE = "Zero-Byte";
static const char *const OPTI_STR_PRECOMPUTE_INIT = "Precompute-Init";
static const char *const OPTI_STR_MEET_IN_MIDDLE = "Meet-In-The-Middle";
static const char *const OPTI_STR_EARLY_SKIP = "Early-Skip";
static const char *const OPTI_STR_NOT_SALTED = "Not-Salted";
static const char *const OPTI_STR_NOT_ITERATED = "Not-Iterated";
static const char *const OPTI_STR_PREPENDED_SALT = "Prepended-Salt";
static const char *const OPTI_STR_APPENDED_SALT = "Appended-Salt";
static const char *const OPTI_STR_SINGLE_HASH = "Single-Hash";
static const char *const OPTI_STR_SINGLE_SALT = "Single-Salt";
static const char *const OPTI_STR_BRUTE_FORCE = "Brute-Force";
static const char *const OPTI_STR_RAW_HASH = "Raw-Hash";
static const char *const OPTI_STR_SLOW_HASH_SIMD_INIT = "Slow-Hash-SIMD-INIT";
static const char *const OPTI_STR_SLOW_HASH_SIMD_LOOP = "Slow-Hash-SIMD-LOOP";
static const char *const OPTI_STR_SLOW_HASH_SIMD_COMP = "Slow-Hash-SIMD-COMP";
static const char *const OPTI_STR_USES_BITS_8 = "Uses-8-Bit";
static const char *const OPTI_STR_USES_BITS_16 = "Uses-16-Bit";
static const char *const OPTI_STR_USES_BITS_32 = "Uses-32-Bit";
static const char *const OPTI_STR_USES_BITS_64 = "Uses-64-Bit";
static const char *HASH_CATEGORY_UNDEFINED_STR = "Undefined";
static const char *HASH_CATEGORY_RAW_HASH_STR = "Raw Hash";
static const char *HASH_CATEGORY_RAW_HASH_SALTED_STR = "Raw Hash, Salted and/or Iterated";
static const char *HASH_CATEGORY_RAW_HASH_AUTHENTICATED_STR = "Raw Hash, Authenticated";
static const char *HASH_CATEGORY_RAW_CIPHER_KPA_STR = "Raw Cipher, Known-Plaintext attack";
static const char *HASH_CATEGORY_GENERIC_KDF_STR = "Generic KDF";
static const char *HASH_CATEGORY_NETWORK_PROTOCOL_STR = "Network Protocols";
static const char *HASH_CATEGORY_FORUM_SOFTWARE_STR = "Forums, CMS, E-Commerce";
static const char *HASH_CATEGORY_DATABASE_SERVER_STR = "Database Server";
static const char *HASH_CATEGORY_NETWORK_SERVER_STR = "FTP, HTTP, SMTP, LDAP Server";
static const char *HASH_CATEGORY_RAW_CHECKSUM_STR = "Raw Checksum";
static const char *HASH_CATEGORY_OS_STR = "Operating System";
static const char *HASH_CATEGORY_EAS_STR = "Enterprise Application Software (EAS)";
static const char *HASH_CATEGORY_ARCHIVE_STR = "Archives";
static const char *HASH_CATEGORY_FDE_STR = "Full-Disk Encryption (FDE)";
static const char *HASH_CATEGORY_FBE_STR = "File-Based Encryption (FBE)";
static const char *HASH_CATEGORY_DOCUMENTS_STR = "Documents";
static const char *HASH_CATEGORY_PASSWORD_MANAGER_STR = "Password Managers";
static const char *HASH_CATEGORY_OTP_STR = "One-Time Passwords";
static const char *HASH_CATEGORY_PLAIN_STR = "Plaintext";
static const char *HASH_CATEGORY_FRAMEWORK_STR = "Framework";
static const char *HASH_CATEGORY_PRIVATE_KEY_STR = "Private Key";
static const char *HASH_CATEGORY_IMS_STR = "Instant Messaging Service";
static const char *HASH_CATEGORY_CRYPTOCURRENCY_WALLET_STR = "Cryptocurrency Wallet";
static const char *const HASH_CATEGORY_UNDEFINED_STR = "Undefined";
static const char *const HASH_CATEGORY_RAW_HASH_STR = "Raw Hash";
static const char *const HASH_CATEGORY_RAW_HASH_SALTED_STR = "Raw Hash, Salted and/or Iterated";
static const char *const HASH_CATEGORY_RAW_HASH_AUTHENTICATED_STR = "Raw Hash, Authenticated";
static const char *const HASH_CATEGORY_RAW_CIPHER_KPA_STR = "Raw Cipher, Known-Plaintext attack";
static const char *const HASH_CATEGORY_GENERIC_KDF_STR = "Generic KDF";
static const char *const HASH_CATEGORY_NETWORK_PROTOCOL_STR = "Network Protocols";
static const char *const HASH_CATEGORY_FORUM_SOFTWARE_STR = "Forums, CMS, E-Commerce";
static const char *const HASH_CATEGORY_DATABASE_SERVER_STR = "Database Server";
static const char *const HASH_CATEGORY_NETWORK_SERVER_STR = "FTP, HTTP, SMTP, LDAP Server";
static const char *const HASH_CATEGORY_RAW_CHECKSUM_STR = "Raw Checksum";
static const char *const HASH_CATEGORY_OS_STR = "Operating System";
static const char *const HASH_CATEGORY_EAS_STR = "Enterprise Application Software (EAS)";
static const char *const HASH_CATEGORY_ARCHIVE_STR = "Archives";
static const char *const HASH_CATEGORY_FDE_STR = "Full-Disk Encryption (FDE)";
static const char *const HASH_CATEGORY_FBE_STR = "File-Based Encryption (FBE)";
static const char *const HASH_CATEGORY_DOCUMENTS_STR = "Documents";
static const char *const HASH_CATEGORY_PASSWORD_MANAGER_STR = "Password Managers";
static const char *const HASH_CATEGORY_OTP_STR = "One-Time Passwords";
static const char *const HASH_CATEGORY_PLAIN_STR = "Plaintext";
static const char *const HASH_CATEGORY_FRAMEWORK_STR = "Framework";
static const char *const HASH_CATEGORY_PRIVATE_KEY_STR = "Private Key";
static const char *const HASH_CATEGORY_IMS_STR = "Instant Messaging Service";
static const char *const HASH_CATEGORY_CRYPTOCURRENCY_WALLET_STR = "Cryptocurrency Wallet";
int sort_by_string_sized (const void *p1, const void *p2)
{
@ -1062,7 +1062,7 @@ static int rounds_count_length (const char *input_buf, const int input_len)
{
if (input_len >= 9) // 9 is minimum because of "rounds=X$"
{
static const char *rounds = "rounds=";
static const char *const rounds = "rounds=";
if (memcmp (input_buf, rounds, 7) == 0)
{

View File

@ -18,29 +18,29 @@
#include "shared.h"
#include "status.h"
static const char *ST_0000 = "Initializing";
static const char *ST_0001 = "Autotuning";
static const char *ST_0002 = "Selftest";
static const char *ST_0003 = "Running";
static const char *ST_0004 = "Paused";
static const char *ST_0005 = "Exhausted";
static const char *ST_0006 = "Cracked";
static const char *ST_0007 = "Aborted";
static const char *ST_0008 = "Quit";
static const char *ST_0009 = "Bypass";
static const char *ST_0010 = "Aborted (Checkpoint)";
static const char *ST_0011 = "Aborted (Runtime)";
static const char *ST_0012 = "Running (Checkpoint Quit requested)";
static const char *ST_0013 = "Error";
static const char *ST_0014 = "Aborted (Finish)";
static const char *ST_0015 = "Running (Quit after attack requested)";
static const char *ST_0016 = "Autodetect";
static const char *ST_9999 = "Unknown! Bug!";
static const char *const ST_0000 = "Initializing";
static const char *const ST_0001 = "Autotuning";
static const char *const ST_0002 = "Selftest";
static const char *const ST_0003 = "Running";
static const char *const ST_0004 = "Paused";
static const char *const ST_0005 = "Exhausted";
static const char *const ST_0006 = "Cracked";
static const char *const ST_0007 = "Aborted";
static const char *const ST_0008 = "Quit";
static const char *const ST_0009 = "Bypass";
static const char *const ST_0010 = "Aborted (Checkpoint)";
static const char *const ST_0011 = "Aborted (Runtime)";
static const char *const ST_0012 = "Running (Checkpoint Quit requested)";
static const char *const ST_0013 = "Error";
static const char *const ST_0014 = "Aborted (Finish)";
static const char *const ST_0015 = "Running (Quit after attack requested)";
static const char *const ST_0016 = "Autodetect";
static const char *const ST_9999 = "Unknown! Bug!";
static const char UNITS[7] = { ' ', 'k', 'M', 'G', 'T', 'P', 'E' };
static const char *ETA_ABSOLUTE_MAX_EXCEEDED = "Next Big Bang"; // in honor of ighashgpu
static const char *ETA_RELATIVE_MAX_EXCEEDED = "> 10 years";
static const char *const ETA_ABSOLUTE_MAX_EXCEEDED = "Next Big Bang"; // in honor of ighashgpu
static const char *const ETA_RELATIVE_MAX_EXCEEDED = "> 10 years";
static char *status_get_rules_file (const hashcat_ctx_t *hashcat_ctx)
{

View File

@ -19,8 +19,8 @@
static const size_t TERMINAL_LINE_LENGTH = 79;
static const char *PROMPT_ACTIVE = "[s]tatus [p]ause [b]ypass [c]heckpoint [f]inish [q]uit => ";
static const char *PROMPT_PAUSED = "[s]tatus [r]esume [b]ypass [c]heckpoint [f]inish [q]uit => ";
static const char *const PROMPT_ACTIVE = "[s]tatus [p]ause [b]ypass [c]heckpoint [f]inish [q]uit => ";
static const char *const PROMPT_PAUSED = "[s]tatus [r]esume [b]ypass [c]heckpoint [f]inish [q]uit => ";
void welcome_screen (hashcat_ctx_t *hashcat_ctx, const char *version_tag)
{
@ -640,7 +640,7 @@ void hash_info_single (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *user_op
if (hashconfig->is_salted == true)
{
u32 t = hashconfig->salt_type;
char *t_desc = (t == SALT_TYPE_EMBEDDED) ? "Embedded\0" : (t == SALT_TYPE_GENERIC) ? "Generic\0" : "Virtual\0";
const char *t_desc = (t == SALT_TYPE_EMBEDDED) ? "Embedded\0" : (t == SALT_TYPE_GENERIC) ? "Generic\0" : "Virtual\0";
event_log_info (hashcat_ctx, " Salt.Type...........: %s", t_desc);
event_log_info (hashcat_ctx, " Salt.Len.Min........: %d", hashconfig->salt_min);
event_log_info (hashcat_ctx, " Salt.Len.Max........: %d", hashconfig->salt_max);

View File

@ -20,12 +20,12 @@
#endif
#ifdef WITH_BRAIN
static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMSz";
static const char *const short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMSz";
#else
static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMS";
static const char *const short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMS";
#endif
static char *SEPARATOR = ":";
static char *const SEPARATOR = ":";
static const struct option long_options[] =
{
@ -147,15 +147,15 @@ static const struct option long_options[] =
{NULL, 0, NULL, 0 }
};
static const char *ENCODING_FROM = "utf-8";
static const char *ENCODING_TO = "utf-8";
static const char *const ENCODING_FROM = "utf-8";
static const char *const ENCODING_TO = "utf-8";
static const char *RULE_BUF_R = ":";
static const char *RULE_BUF_L = ":";
static const char *const RULE_BUF_R = ":";
static const char *const RULE_BUF_L = ":";
static const char *DEF_MASK_CS_1 = "?l?d?u";
static const char *DEF_MASK_CS_2 = "?l?d";
static const char *DEF_MASK_CS_3 = "?l?d*!$@_";
static const char *const DEF_MASK_CS_1 = "?l?d?u";
static const char *const DEF_MASK_CS_2 = "?l?d";
static const char *const DEF_MASK_CS_3 = "?l?d*!$@_";
int user_options_init (hashcat_ctx_t *hashcat_ctx)
{