diff --git a/include/hlfmt.h b/include/hlfmt.h index 2979f0bd8..c551766e8 100644 --- a/include/hlfmt.h +++ b/include/hlfmt.h @@ -10,7 +10,7 @@ #define HLFMTS_CNT 11 -char *strhlfmt (const u32 hashfile_format); +const char *strhlfmt (const u32 hashfile_format); void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len); void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, int line_len, char **userbuf_pos, int *userbuf_len); diff --git a/include/interface.h b/include/interface.h index d58eb3668..81fa9cbfb 100644 --- a/include/interface.h +++ b/include/interface.h @@ -1876,9 +1876,9 @@ void seven_zip_hook_func (hc_device_param_t *device_param, void *hook_salts_buf, * output functions */ -char *stroptitype (const u32 opti_type); -char *strhashtype (const u32 hash_mode); -char *strparser (const u32 parser_status); +const char *stroptitype (const u32 opti_type); +const char *strhashtype (const u32 hash_mode); +const char *strparser (const u32 parser_status); int check_old_hccap (const char *hashfile); void to_hccapx_t (hashcat_ctx_t *hashcat_ctx, hccapx_t *hccapx, const u32 salt_pos, const u32 digest_pos); diff --git a/include/status.h b/include/status.h index 77db1f719..7e20d0ec6 100644 --- a/include/status.h +++ b/include/status.h @@ -20,7 +20,7 @@ int status_get_device_info_cnt (const hashcat_ctx_t *hashcat_ int status_get_device_info_active (const hashcat_ctx_t *hashcat_ctx); bool status_get_skipped_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id); char *status_get_session (const hashcat_ctx_t *hashcat_ctx); -char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx); +const char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx); int status_get_status_number (const hashcat_ctx_t *hashcat_ctx); int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx); char *status_get_guess_base (const hashcat_ctx_t *hashcat_ctx); @@ -34,7 +34,7 @@ double status_get_guess_mod_percent (const hashcat_ctx_t *hashcat_ char *status_get_guess_charset (const hashcat_ctx_t *hashcat_ctx); int status_get_guess_mask_length (const hashcat_ctx_t *hashcat_ctx); char *status_get_guess_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id); -char *status_get_hash_type (const hashcat_ctx_t *hashcat_ctx); +const char *status_get_hash_type (const hashcat_ctx_t *hashcat_ctx); const char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx); int status_get_digests_done (const hashcat_ctx_t *hashcat_ctx); int status_get_digests_cnt (const hashcat_ctx_t *hashcat_ctx); diff --git a/include/types.h b/include/types.h index f8d4a7e83..e1030f7e6 100644 --- a/include/types.h +++ b/include/types.h @@ -1753,7 +1753,7 @@ typedef struct device_info typedef struct hashcat_status { const char *hash_target; - char *hash_type; + const char *hash_type; int guess_mode; char *guess_base; int guess_base_offset; @@ -1766,7 +1766,7 @@ typedef struct hashcat_status char *guess_charset; int guess_mask_length; char *session; - char *status_string; + const char *status_string; int status_number; char *time_estimated_absolute; char *time_estimated_relative; @@ -1894,7 +1894,7 @@ typedef struct hashcat_user typedef struct cache_hit { - char *dictfile; + const char *dictfile; hc_stat_t stat; @@ -1905,7 +1905,7 @@ typedef struct cache_hit typedef struct cache_generate { - char *dictfile; + const char *dictfile; double percent; diff --git a/src/hashes.c b/src/hashes.c index 8e9fdd7b5..61fc7b85a 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -1582,7 +1582,7 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx) for (int i = 0, j = 0; j < st_hash_len; i += 1, j += 2) { - const u8 c = hex_to_u8 ((u8 *) hashconfig->st_hash + j); + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); tmpdata[i] = c; } @@ -1607,7 +1607,7 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx) for (int i = 0; i < st_hash_len; i += 2) { - const u8 c = hex_to_u8 ((u8 *) hashconfig->st_hash + i); + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + i); fputc (c, fp); } diff --git a/src/hlfmt.c b/src/hlfmt.c index 2bc878acb..804dee68c 100644 --- a/src/hlfmt.c +++ b/src/hlfmt.c @@ -292,23 +292,23 @@ static void hlfmt_user_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li // hlfmt main -char *strhlfmt (const u32 hashfile_format) +const char *strhlfmt (const u32 hashfile_format) { switch (hashfile_format) { - case HLFMT_HASHCAT: return ((char *) HLFMT_TEXT_HASHCAT); - case HLFMT_PWDUMP: return ((char *) HLFMT_TEXT_PWDUMP); - case HLFMT_PASSWD: return ((char *) HLFMT_TEXT_PASSWD); - case HLFMT_SHADOW: return ((char *) HLFMT_TEXT_SHADOW); - case HLFMT_DCC: return ((char *) HLFMT_TEXT_DCC); - case HLFMT_DCC2: return ((char *) HLFMT_TEXT_DCC2); - case HLFMT_NETNTLM1: return ((char *) HLFMT_TEXT_NETNTLM1); - case HLFMT_NETNTLM2: return ((char *) HLFMT_TEXT_NETNTLM2); - case HLFMT_NSLDAP: return ((char *) HLFMT_TEXT_NSLDAP); - case HLFMT_NSLDAPS: return ((char *) HLFMT_TEXT_NSLDAPS); + case HLFMT_HASHCAT: return HLFMT_TEXT_HASHCAT; + case HLFMT_PWDUMP: return HLFMT_TEXT_PWDUMP; + case HLFMT_PASSWD: return HLFMT_TEXT_PASSWD; + case HLFMT_SHADOW: return HLFMT_TEXT_SHADOW; + case HLFMT_DCC: return HLFMT_TEXT_DCC; + case HLFMT_DCC2: return HLFMT_TEXT_DCC2; + case HLFMT_NETNTLM1: return HLFMT_TEXT_NETNTLM1; + case HLFMT_NETNTLM2: return HLFMT_TEXT_NETNTLM2; + case HLFMT_NSLDAP: return HLFMT_TEXT_NSLDAP; + case HLFMT_NSLDAPS: return HLFMT_TEXT_NSLDAPS; } - return ((char *) "Unknown"); + return "Unknown"; } void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len) diff --git a/src/interface.c b/src/interface.c index 459bd5ec9..95634e225 100644 --- a/src/interface.c +++ b/src/interface.c @@ -15880,319 +15880,319 @@ void seven_zip_hook_func (hc_device_param_t *device_param, void *hook_salts_buf, * output */ -char *stroptitype (const u32 opti_type) +const char *stroptitype (const u32 opti_type) { switch (opti_type) { - case OPTI_TYPE_OPTIMIZED_KERNEL: return ((char *) OPTI_STR_OPTIMIZED_KERNEL); - case OPTI_TYPE_ZERO_BYTE: return ((char *) OPTI_STR_ZERO_BYTE); - case OPTI_TYPE_PRECOMPUTE_INIT: return ((char *) OPTI_STR_PRECOMPUTE_INIT); - case OPTI_TYPE_PRECOMPUTE_MERKLE: return ((char *) OPTI_STR_PRECOMPUTE_MERKLE); - case OPTI_TYPE_PRECOMPUTE_PERMUT: return ((char *) OPTI_STR_PRECOMPUTE_PERMUT); - case OPTI_TYPE_MEET_IN_MIDDLE: return ((char *) OPTI_STR_MEET_IN_MIDDLE); - case OPTI_TYPE_EARLY_SKIP: return ((char *) OPTI_STR_EARLY_SKIP); - case OPTI_TYPE_NOT_SALTED: return ((char *) OPTI_STR_NOT_SALTED); - case OPTI_TYPE_NOT_ITERATED: return ((char *) OPTI_STR_NOT_ITERATED); - case OPTI_TYPE_PREPENDED_SALT: return ((char *) OPTI_STR_PREPENDED_SALT); - case OPTI_TYPE_APPENDED_SALT: return ((char *) OPTI_STR_APPENDED_SALT); - case OPTI_TYPE_SINGLE_HASH: return ((char *) OPTI_STR_SINGLE_HASH); - case OPTI_TYPE_SINGLE_SALT: return ((char *) OPTI_STR_SINGLE_SALT); - case OPTI_TYPE_BRUTE_FORCE: return ((char *) OPTI_STR_BRUTE_FORCE); - case OPTI_TYPE_RAW_HASH: return ((char *) OPTI_STR_RAW_HASH); - case OPTI_TYPE_SLOW_HASH_SIMD_INIT: return ((char *) OPTI_STR_SLOW_HASH_SIMD_INIT); - case OPTI_TYPE_SLOW_HASH_SIMD_LOOP: return ((char *) OPTI_STR_SLOW_HASH_SIMD_LOOP); - case OPTI_TYPE_SLOW_HASH_SIMD_COMP: return ((char *) OPTI_STR_SLOW_HASH_SIMD_COMP); - case OPTI_TYPE_USES_BITS_8: return ((char *) OPTI_STR_USES_BITS_8); - case OPTI_TYPE_USES_BITS_16: return ((char *) OPTI_STR_USES_BITS_16); - case OPTI_TYPE_USES_BITS_32: return ((char *) OPTI_STR_USES_BITS_32); - case OPTI_TYPE_USES_BITS_64: return ((char *) OPTI_STR_USES_BITS_64); - } - - return (NULL); + case OPTI_TYPE_OPTIMIZED_KERNEL: return OPTI_STR_OPTIMIZED_KERNEL; + case OPTI_TYPE_ZERO_BYTE: return OPTI_STR_ZERO_BYTE; + case OPTI_TYPE_PRECOMPUTE_INIT: return OPTI_STR_PRECOMPUTE_INIT; + case OPTI_TYPE_PRECOMPUTE_MERKLE: return OPTI_STR_PRECOMPUTE_MERKLE; + case OPTI_TYPE_PRECOMPUTE_PERMUT: return OPTI_STR_PRECOMPUTE_PERMUT; + case OPTI_TYPE_MEET_IN_MIDDLE: return OPTI_STR_MEET_IN_MIDDLE; + case OPTI_TYPE_EARLY_SKIP: return OPTI_STR_EARLY_SKIP; + case OPTI_TYPE_NOT_SALTED: return OPTI_STR_NOT_SALTED; + case OPTI_TYPE_NOT_ITERATED: return OPTI_STR_NOT_ITERATED; + case OPTI_TYPE_PREPENDED_SALT: return OPTI_STR_PREPENDED_SALT; + case OPTI_TYPE_APPENDED_SALT: return OPTI_STR_APPENDED_SALT; + case OPTI_TYPE_SINGLE_HASH: return OPTI_STR_SINGLE_HASH; + case OPTI_TYPE_SINGLE_SALT: return OPTI_STR_SINGLE_SALT; + case OPTI_TYPE_BRUTE_FORCE: return OPTI_STR_BRUTE_FORCE; + case OPTI_TYPE_RAW_HASH: return OPTI_STR_RAW_HASH; + case OPTI_TYPE_SLOW_HASH_SIMD_INIT: return OPTI_STR_SLOW_HASH_SIMD_INIT; + case OPTI_TYPE_SLOW_HASH_SIMD_LOOP: return OPTI_STR_SLOW_HASH_SIMD_LOOP; + case OPTI_TYPE_SLOW_HASH_SIMD_COMP: return OPTI_STR_SLOW_HASH_SIMD_COMP; + case OPTI_TYPE_USES_BITS_8: return OPTI_STR_USES_BITS_8; + case OPTI_TYPE_USES_BITS_16: return OPTI_STR_USES_BITS_16; + case OPTI_TYPE_USES_BITS_32: return OPTI_STR_USES_BITS_32; + case OPTI_TYPE_USES_BITS_64: return OPTI_STR_USES_BITS_64; + } + + return NULL; } -char *strhashtype (const u32 hash_mode) +const char *strhashtype (const u32 hash_mode) { switch (hash_mode) { - case 0: return ((char *) HT_00000); - case 10: return ((char *) HT_00010); - case 11: return ((char *) HT_00011); - case 12: return ((char *) HT_00012); - case 20: return ((char *) HT_00020); - case 21: return ((char *) HT_00021); - case 22: return ((char *) HT_00022); - case 23: return ((char *) HT_00023); - case 30: return ((char *) HT_00030); - case 40: return ((char *) HT_00040); - case 50: return ((char *) HT_00050); - case 60: return ((char *) HT_00060); - case 100: return ((char *) HT_00100); - case 101: return ((char *) HT_00101); - case 110: return ((char *) HT_00110); - case 111: return ((char *) HT_00111); - case 112: return ((char *) HT_00112); - case 120: return ((char *) HT_00120); - case 121: return ((char *) HT_00121); - case 122: return ((char *) HT_00122); - case 124: return ((char *) HT_00124); - case 125: return ((char *) HT_00125); - case 130: return ((char *) HT_00130); - case 131: return ((char *) HT_00131); - case 132: return ((char *) HT_00132); - case 133: return ((char *) HT_00133); - case 140: return ((char *) HT_00140); - case 141: return ((char *) HT_00141); - case 150: return ((char *) HT_00150); - case 160: return ((char *) HT_00160); - case 200: return ((char *) HT_00200); - case 300: return ((char *) HT_00300); - case 400: return ((char *) HT_00400); - case 500: return ((char *) HT_00500); - case 501: return ((char *) HT_00501); - case 600: return ((char *) HT_00600); - case 900: return ((char *) HT_00900); - case 1000: return ((char *) HT_01000); - case 1100: return ((char *) HT_01100); - case 1300: return ((char *) HT_01300); - case 1400: return ((char *) HT_01400); - case 1410: return ((char *) HT_01410); - case 1411: return ((char *) HT_01411); - case 1420: return ((char *) HT_01420); - case 1421: return ((char *) HT_01421); - case 1430: return ((char *) HT_01430); - case 1440: return ((char *) HT_01440); - case 1441: return ((char *) HT_01441); - case 1450: return ((char *) HT_01450); - case 1460: return ((char *) HT_01460); - case 1500: return ((char *) HT_01500); - case 1600: return ((char *) HT_01600); - case 1700: return ((char *) HT_01700); - case 1710: return ((char *) HT_01710); - case 1711: return ((char *) HT_01711); - case 1720: return ((char *) HT_01720); - case 1722: return ((char *) HT_01722); - case 1730: return ((char *) HT_01730); - case 1731: return ((char *) HT_01731); - case 1740: return ((char *) HT_01740); - case 1750: return ((char *) HT_01750); - case 1760: return ((char *) HT_01760); - case 1800: return ((char *) HT_01800); - case 2100: return ((char *) HT_02100); - case 2400: return ((char *) HT_02400); - case 2410: return ((char *) HT_02410); - case 2500: return ((char *) HT_02500); - case 2501: return ((char *) HT_02501); - case 2600: return ((char *) HT_02600); - case 2611: return ((char *) HT_02611); - case 2612: return ((char *) HT_02612); - case 2711: return ((char *) HT_02711); - case 2811: return ((char *) HT_02811); - case 3000: return ((char *) HT_03000); - case 3100: return ((char *) HT_03100); - case 3200: return ((char *) HT_03200); - case 3710: return ((char *) HT_03710); - case 3711: return ((char *) HT_03711); - case 3800: return ((char *) HT_03800); - case 3910: return ((char *) HT_03910); - case 4010: return ((char *) HT_04010); - case 4110: return ((char *) HT_04110); - case 4300: return ((char *) HT_04300); - case 4400: return ((char *) HT_04400); - case 4500: return ((char *) HT_04500); - case 4520: return ((char *) HT_04520); - case 4521: return ((char *) HT_04521); - case 4522: return ((char *) HT_04522); - case 4700: return ((char *) HT_04700); - case 4800: return ((char *) HT_04800); - case 4900: return ((char *) HT_04900); - case 5000: return ((char *) HT_05000); - case 5100: return ((char *) HT_05100); - case 5200: return ((char *) HT_05200); - case 5300: return ((char *) HT_05300); - case 5400: return ((char *) HT_05400); - case 5500: return ((char *) HT_05500); - case 5600: return ((char *) HT_05600); - case 5700: return ((char *) HT_05700); - case 5800: return ((char *) HT_05800); - case 6000: return ((char *) HT_06000); - case 6100: return ((char *) HT_06100); - case 6211: return ((char *) HT_06211); - case 6212: return ((char *) HT_06212); - case 6213: return ((char *) HT_06213); - case 6221: return ((char *) HT_06221); - case 6222: return ((char *) HT_06222); - case 6223: return ((char *) HT_06223); - case 6231: return ((char *) HT_06231); - case 6232: return ((char *) HT_06232); - case 6233: return ((char *) HT_06233); - case 6241: return ((char *) HT_06241); - case 6242: return ((char *) HT_06242); - case 6243: return ((char *) HT_06243); - case 6300: return ((char *) HT_06300); - case 6400: return ((char *) HT_06400); - case 6500: return ((char *) HT_06500); - case 6600: return ((char *) HT_06600); - case 6700: return ((char *) HT_06700); - case 6800: return ((char *) HT_06800); - case 6900: return ((char *) HT_06900); - case 7000: return ((char *) HT_07000); - case 7100: return ((char *) HT_07100); - case 7200: return ((char *) HT_07200); - case 7300: return ((char *) HT_07300); - case 7400: return ((char *) HT_07400); - case 7500: return ((char *) HT_07500); - case 7700: return ((char *) HT_07700); - case 7800: return ((char *) HT_07800); - case 7900: return ((char *) HT_07900); - case 8000: return ((char *) HT_08000); - case 8100: return ((char *) HT_08100); - case 8200: return ((char *) HT_08200); - case 8300: return ((char *) HT_08300); - case 8400: return ((char *) HT_08400); - case 8500: return ((char *) HT_08500); - case 8600: return ((char *) HT_08600); - case 8700: return ((char *) HT_08700); - case 8800: return ((char *) HT_08800); - case 8900: return ((char *) HT_08900); - case 9000: return ((char *) HT_09000); - case 9100: return ((char *) HT_09100); - case 9200: return ((char *) HT_09200); - case 9300: return ((char *) HT_09300); - case 9400: return ((char *) HT_09400); - case 9500: return ((char *) HT_09500); - case 9600: return ((char *) HT_09600); - case 9700: return ((char *) HT_09700); - case 9710: return ((char *) HT_09710); - case 9720: return ((char *) HT_09720); - case 9800: return ((char *) HT_09800); - case 9810: return ((char *) HT_09810); - case 9820: return ((char *) HT_09820); - case 9900: return ((char *) HT_09900); - case 10000: return ((char *) HT_10000); - case 10100: return ((char *) HT_10100); - case 10200: return ((char *) HT_10200); - case 10300: return ((char *) HT_10300); - case 10400: return ((char *) HT_10400); - case 10410: return ((char *) HT_10410); - case 10420: return ((char *) HT_10420); - case 10500: return ((char *) HT_10500); - case 10600: return ((char *) HT_10600); - case 10700: return ((char *) HT_10700); - case 10800: return ((char *) HT_10800); - case 10900: return ((char *) HT_10900); - case 11000: return ((char *) HT_11000); - case 11100: return ((char *) HT_11100); - case 11200: return ((char *) HT_11200); - case 11300: return ((char *) HT_11300); - case 11400: return ((char *) HT_11400); - case 11500: return ((char *) HT_11500); - case 11600: return ((char *) HT_11600); - case 11700: return ((char *) HT_11700); - case 11800: return ((char *) HT_11800); - case 11900: return ((char *) HT_11900); - case 12000: return ((char *) HT_12000); - case 12001: return ((char *) HT_12001); - case 12100: return ((char *) HT_12100); - case 12200: return ((char *) HT_12200); - case 12300: return ((char *) HT_12300); - case 12400: return ((char *) HT_12400); - case 12500: return ((char *) HT_12500); - case 12600: return ((char *) HT_12600); - case 12700: return ((char *) HT_12700); - case 12800: return ((char *) HT_12800); - case 12900: return ((char *) HT_12900); - case 13000: return ((char *) HT_13000); - case 13100: return ((char *) HT_13100); - case 13200: return ((char *) HT_13200); - case 13300: return ((char *) HT_13300); - case 13400: return ((char *) HT_13400); - case 13500: return ((char *) HT_13500); - case 13600: return ((char *) HT_13600); - case 13711: return ((char *) HT_13711); - case 13712: return ((char *) HT_13712); - case 13713: return ((char *) HT_13713); - case 13721: return ((char *) HT_13721); - case 13722: return ((char *) HT_13722); - case 13723: return ((char *) HT_13723); - case 13731: return ((char *) HT_13731); - case 13732: return ((char *) HT_13732); - case 13733: return ((char *) HT_13733); - case 13741: return ((char *) HT_13741); - case 13742: return ((char *) HT_13742); - case 13743: return ((char *) HT_13743); - case 13751: return ((char *) HT_13751); - case 13752: return ((char *) HT_13752); - case 13753: return ((char *) HT_13753); - case 13761: return ((char *) HT_13761); - case 13762: return ((char *) HT_13762); - case 13763: return ((char *) HT_13763); - case 13800: return ((char *) HT_13800); - case 13900: return ((char *) HT_13900); - case 14000: return ((char *) HT_14000); - case 14100: return ((char *) HT_14100); - case 14400: return ((char *) HT_14400); - case 14600: return ((char *) HT_14600); - case 14700: return ((char *) HT_14700); - case 14800: return ((char *) HT_14800); - case 14900: return ((char *) HT_14900); - case 15000: return ((char *) HT_15000); - case 15100: return ((char *) HT_15100); - case 15200: return ((char *) HT_15200); - case 15300: return ((char *) HT_15300); - case 15400: return ((char *) HT_15400); - case 15500: return ((char *) HT_15500); - case 15600: return ((char *) HT_15600); - case 15700: return ((char *) HT_15700); - case 15900: return ((char *) HT_15900); - case 16000: return ((char *) HT_16000); - case 99999: return ((char *) HT_99999); - } - - return ((char *) "Unknown"); + case 0: return HT_00000; + case 10: return HT_00010; + case 11: return HT_00011; + case 12: return HT_00012; + case 20: return HT_00020; + case 21: return HT_00021; + case 22: return HT_00022; + case 23: return HT_00023; + case 30: return HT_00030; + case 40: return HT_00040; + case 50: return HT_00050; + case 60: return HT_00060; + case 100: return HT_00100; + case 101: return HT_00101; + case 110: return HT_00110; + case 111: return HT_00111; + case 112: return HT_00112; + case 120: return HT_00120; + case 121: return HT_00121; + case 122: return HT_00122; + case 124: return HT_00124; + case 125: return HT_00125; + case 130: return HT_00130; + case 131: return HT_00131; + case 132: return HT_00132; + case 133: return HT_00133; + case 140: return HT_00140; + case 141: return HT_00141; + case 150: return HT_00150; + case 160: return HT_00160; + case 200: return HT_00200; + case 300: return HT_00300; + case 400: return HT_00400; + case 500: return HT_00500; + case 501: return HT_00501; + case 600: return HT_00600; + case 900: return HT_00900; + case 1000: return HT_01000; + case 1100: return HT_01100; + case 1300: return HT_01300; + case 1400: return HT_01400; + case 1410: return HT_01410; + case 1411: return HT_01411; + case 1420: return HT_01420; + case 1421: return HT_01421; + case 1430: return HT_01430; + case 1440: return HT_01440; + case 1441: return HT_01441; + case 1450: return HT_01450; + case 1460: return HT_01460; + case 1500: return HT_01500; + case 1600: return HT_01600; + case 1700: return HT_01700; + case 1710: return HT_01710; + case 1711: return HT_01711; + case 1720: return HT_01720; + case 1722: return HT_01722; + case 1730: return HT_01730; + case 1731: return HT_01731; + case 1740: return HT_01740; + case 1750: return HT_01750; + case 1760: return HT_01760; + case 1800: return HT_01800; + case 2100: return HT_02100; + case 2400: return HT_02400; + case 2410: return HT_02410; + case 2500: return HT_02500; + case 2501: return HT_02501; + case 2600: return HT_02600; + case 2611: return HT_02611; + case 2612: return HT_02612; + case 2711: return HT_02711; + case 2811: return HT_02811; + case 3000: return HT_03000; + case 3100: return HT_03100; + case 3200: return HT_03200; + case 3710: return HT_03710; + case 3711: return HT_03711; + case 3800: return HT_03800; + case 3910: return HT_03910; + case 4010: return HT_04010; + case 4110: return HT_04110; + case 4300: return HT_04300; + case 4400: return HT_04400; + case 4500: return HT_04500; + case 4520: return HT_04520; + case 4521: return HT_04521; + case 4522: return HT_04522; + case 4700: return HT_04700; + case 4800: return HT_04800; + case 4900: return HT_04900; + case 5000: return HT_05000; + case 5100: return HT_05100; + case 5200: return HT_05200; + case 5300: return HT_05300; + case 5400: return HT_05400; + case 5500: return HT_05500; + case 5600: return HT_05600; + case 5700: return HT_05700; + case 5800: return HT_05800; + case 6000: return HT_06000; + case 6100: return HT_06100; + case 6211: return HT_06211; + case 6212: return HT_06212; + case 6213: return HT_06213; + case 6221: return HT_06221; + case 6222: return HT_06222; + case 6223: return HT_06223; + case 6231: return HT_06231; + case 6232: return HT_06232; + case 6233: return HT_06233; + case 6241: return HT_06241; + case 6242: return HT_06242; + case 6243: return HT_06243; + case 6300: return HT_06300; + case 6400: return HT_06400; + case 6500: return HT_06500; + case 6600: return HT_06600; + case 6700: return HT_06700; + case 6800: return HT_06800; + case 6900: return HT_06900; + case 7000: return HT_07000; + case 7100: return HT_07100; + case 7200: return HT_07200; + case 7300: return HT_07300; + case 7400: return HT_07400; + case 7500: return HT_07500; + case 7700: return HT_07700; + case 7800: return HT_07800; + case 7900: return HT_07900; + case 8000: return HT_08000; + case 8100: return HT_08100; + case 8200: return HT_08200; + case 8300: return HT_08300; + case 8400: return HT_08400; + case 8500: return HT_08500; + case 8600: return HT_08600; + case 8700: return HT_08700; + case 8800: return HT_08800; + case 8900: return HT_08900; + case 9000: return HT_09000; + case 9100: return HT_09100; + case 9200: return HT_09200; + case 9300: return HT_09300; + case 9400: return HT_09400; + case 9500: return HT_09500; + case 9600: return HT_09600; + case 9700: return HT_09700; + case 9710: return HT_09710; + case 9720: return HT_09720; + case 9800: return HT_09800; + case 9810: return HT_09810; + case 9820: return HT_09820; + case 9900: return HT_09900; + case 10000: return HT_10000; + case 10100: return HT_10100; + case 10200: return HT_10200; + case 10300: return HT_10300; + case 10400: return HT_10400; + case 10410: return HT_10410; + case 10420: return HT_10420; + case 10500: return HT_10500; + case 10600: return HT_10600; + case 10700: return HT_10700; + case 10800: return HT_10800; + case 10900: return HT_10900; + case 11000: return HT_11000; + case 11100: return HT_11100; + case 11200: return HT_11200; + case 11300: return HT_11300; + case 11400: return HT_11400; + case 11500: return HT_11500; + case 11600: return HT_11600; + case 11700: return HT_11700; + case 11800: return HT_11800; + case 11900: return HT_11900; + case 12000: return HT_12000; + case 12001: return HT_12001; + case 12100: return HT_12100; + case 12200: return HT_12200; + case 12300: return HT_12300; + case 12400: return HT_12400; + case 12500: return HT_12500; + case 12600: return HT_12600; + case 12700: return HT_12700; + case 12800: return HT_12800; + case 12900: return HT_12900; + case 13000: return HT_13000; + case 13100: return HT_13100; + case 13200: return HT_13200; + case 13300: return HT_13300; + case 13400: return HT_13400; + case 13500: return HT_13500; + case 13600: return HT_13600; + case 13711: return HT_13711; + case 13712: return HT_13712; + case 13713: return HT_13713; + case 13721: return HT_13721; + case 13722: return HT_13722; + case 13723: return HT_13723; + case 13731: return HT_13731; + case 13732: return HT_13732; + case 13733: return HT_13733; + case 13741: return HT_13741; + case 13742: return HT_13742; + case 13743: return HT_13743; + case 13751: return HT_13751; + case 13752: return HT_13752; + case 13753: return HT_13753; + case 13761: return HT_13761; + case 13762: return HT_13762; + case 13763: return HT_13763; + case 13800: return HT_13800; + case 13900: return HT_13900; + case 14000: return HT_14000; + case 14100: return HT_14100; + case 14400: return HT_14400; + case 14600: return HT_14600; + case 14700: return HT_14700; + case 14800: return HT_14800; + case 14900: return HT_14900; + case 15000: return HT_15000; + case 15100: return HT_15100; + case 15200: return HT_15200; + case 15300: return HT_15300; + case 15400: return HT_15400; + case 15500: return HT_15500; + case 15600: return HT_15600; + case 15700: return HT_15700; + case 15900: return HT_15900; + case 16000: return HT_16000; + case 99999: return HT_99999; + } + + return "Unknown"; } -char *strparser (const u32 parser_status) +const char *strparser (const u32 parser_status) { switch (parser_status) { - case PARSER_OK: return ((char *) PA_000); - case PARSER_COMMENT: return ((char *) PA_001); - case PARSER_GLOBAL_ZERO: return ((char *) PA_002); - case PARSER_GLOBAL_LENGTH: return ((char *) PA_003); - case PARSER_HASH_LENGTH: return ((char *) PA_004); - case PARSER_HASH_VALUE: return ((char *) PA_005); - case PARSER_SALT_LENGTH: return ((char *) PA_006); - case PARSER_SALT_VALUE: return ((char *) PA_007); - case PARSER_SALT_ITERATION: return ((char *) PA_008); - case PARSER_SEPARATOR_UNMATCHED: return ((char *) PA_009); - case PARSER_SIGNATURE_UNMATCHED: return ((char *) PA_010); - case PARSER_HCCAPX_FILE_SIZE: return ((char *) PA_011); - case PARSER_HCCAPX_EAPOL_LEN: return ((char *) PA_012); - case PARSER_PSAFE2_FILE_SIZE: return ((char *) PA_013); - case PARSER_PSAFE3_FILE_SIZE: return ((char *) PA_014); - case PARSER_TC_FILE_SIZE: return ((char *) PA_015); - case PARSER_VC_FILE_SIZE: return ((char *) PA_016); - case PARSER_SIP_AUTH_DIRECTIVE: return ((char *) PA_017); - case PARSER_HASH_FILE: return ((char *) PA_018); - case PARSER_HASH_ENCODING: return ((char *) PA_019); - case PARSER_SALT_ENCODING: return ((char *) PA_020); - case PARSER_LUKS_FILE_SIZE: return ((char *) PA_021); - case PARSER_LUKS_MAGIC: return ((char *) PA_022); - case PARSER_LUKS_VERSION: return ((char *) PA_023); - case PARSER_LUKS_CIPHER_TYPE: return ((char *) PA_024); - case PARSER_LUKS_CIPHER_MODE: return ((char *) PA_025); - case PARSER_LUKS_HASH_TYPE: return ((char *) PA_026); - case PARSER_LUKS_KEY_SIZE: return ((char *) PA_027); - case PARSER_LUKS_KEY_DISABLED: return ((char *) PA_028); - case PARSER_LUKS_KEY_STRIPES: return ((char *) PA_029); - case PARSER_LUKS_HASH_CIPHER: return ((char *) PA_030); - case PARSER_HCCAPX_SIGNATURE: return ((char *) PA_031); - case PARSER_HCCAPX_VERSION: return ((char *) PA_032); - case PARSER_HCCAPX_MESSAGE_PAIR: return ((char *) PA_033); - } - - return ((char *) PA_255); + case PARSER_OK: return PA_000; + case PARSER_COMMENT: return PA_001; + case PARSER_GLOBAL_ZERO: return PA_002; + case PARSER_GLOBAL_LENGTH: return PA_003; + case PARSER_HASH_LENGTH: return PA_004; + case PARSER_HASH_VALUE: return PA_005; + case PARSER_SALT_LENGTH: return PA_006; + case PARSER_SALT_VALUE: return PA_007; + case PARSER_SALT_ITERATION: return PA_008; + case PARSER_SEPARATOR_UNMATCHED: return PA_009; + case PARSER_SIGNATURE_UNMATCHED: return PA_010; + case PARSER_HCCAPX_FILE_SIZE: return PA_011; + case PARSER_HCCAPX_EAPOL_LEN: return PA_012; + case PARSER_PSAFE2_FILE_SIZE: return PA_013; + case PARSER_PSAFE3_FILE_SIZE: return PA_014; + case PARSER_TC_FILE_SIZE: return PA_015; + case PARSER_VC_FILE_SIZE: return PA_016; + case PARSER_SIP_AUTH_DIRECTIVE: return PA_017; + case PARSER_HASH_FILE: return PA_018; + case PARSER_HASH_ENCODING: return PA_019; + case PARSER_SALT_ENCODING: return PA_020; + case PARSER_LUKS_FILE_SIZE: return PA_021; + case PARSER_LUKS_MAGIC: return PA_022; + case PARSER_LUKS_VERSION: return PA_023; + case PARSER_LUKS_CIPHER_TYPE: return PA_024; + case PARSER_LUKS_CIPHER_MODE: return PA_025; + case PARSER_LUKS_HASH_TYPE: return PA_026; + case PARSER_LUKS_KEY_SIZE: return PA_027; + case PARSER_LUKS_KEY_DISABLED: return PA_028; + case PARSER_LUKS_KEY_STRIPES: return PA_029; + case PARSER_LUKS_HASH_CIPHER: return PA_030; + case PARSER_HCCAPX_SIGNATURE: return PA_031; + case PARSER_HCCAPX_VERSION: return PA_032; + case PARSER_HCCAPX_MESSAGE_PAIR: return PA_033; + } + + return PA_255; } int check_old_hccap (const char *hashfile) diff --git a/src/main.c b/src/main.c index 98c67c7b6..409f4bd05 100644 --- a/src/main.c +++ b/src/main.c @@ -436,7 +436,7 @@ static void main_outerloop_mainscreen (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, { if (user_options->machine_readable == false) { - char *hash_type = strhashtype (hashconfig->hash_mode); // not a bug + const char *hash_type = strhashtype (hashconfig->hash_mode); // not a bug event_log_info (hashcat_ctx, "Hashmode: %d - %s", hashconfig->hash_mode, hash_type); event_log_info (hashcat_ctx, NULL); @@ -591,7 +591,7 @@ static void main_monitor_throttle1 (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAY clear_prompt (); } - u32 *device_id = (u32 *) buf; + const u32 *device_id = (const u32 *) buf; event_log_warning (hashcat_ctx, "Driver temperature threshold met on GPU #%u. Expect reduced performance.", *device_id + 1); @@ -613,7 +613,7 @@ static void main_monitor_throttle2 (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAY clear_prompt (); } - u32 *device_id = (u32 *) buf; + const u32 *device_id = (const u32 *) buf; event_log_warning (hashcat_ctx, "Driver temperature threshold met on GPU #%u. Expect reduced performance.", *device_id + 1); @@ -635,7 +635,7 @@ static void main_monitor_throttle3 (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAY clear_prompt (); } - u32 *device_id = (u32 *) buf; + const u32 *device_id = (const u32 *) buf; event_log_warning (hashcat_ctx, "Driver temperature threshold met on GPU #%u. Expect reduced performance.", *device_id + 1); event_log_warning (hashcat_ctx, NULL); @@ -705,7 +705,7 @@ static void main_monitor_temp_abort (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MA clear_prompt (); } - u32 *device_id = (u32 *) buf; + const u32 *device_id = (const u32 *) buf; event_log_error (hashcat_ctx, "Temperature limit on GPU #%u reached, aborting...", *device_id + 1); } @@ -771,7 +771,7 @@ static void main_wordlist_cache_hit (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MA if (user_options->quiet == true) return; - cache_hit_t *cache_hit = (cache_hit_t *) buf; + const cache_hit_t *cache_hit = (const cache_hit_t *) buf; event_log_info (hashcat_ctx, "Dictionary cache hit:"); event_log_info (hashcat_ctx, "* Filename..: %s", cache_hit->dictfile); @@ -787,7 +787,7 @@ static void main_wordlist_cache_generate (MAYBE_UNUSED hashcat_ctx_t *hashcat_ct if (user_options->quiet == true) return; - cache_generate_t *cache_generate = (cache_generate_t *) buf; + const cache_generate_t *cache_generate = (const cache_generate_t *) buf; if (cache_generate->percent < 100) { @@ -824,7 +824,7 @@ static void main_hashlist_count_lines_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_c if (user_options->quiet == true) return; - char *hashfile = (char *) buf; + const char *hashfile = (const char *) buf; event_log_info_nn (hashcat_ctx, "Counting lines in %s...", hashfile); } @@ -835,7 +835,7 @@ static void main_hashlist_count_lines_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ if (user_options->quiet == true) return; - char *hashfile = (char *) buf; + const char *hashfile = (const char *) buf; event_log_info_nn (hashcat_ctx, "Counted lines in %s...", hashfile); } @@ -846,7 +846,7 @@ static void main_hashlist_parse_hash (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, M if (user_options->quiet == true) return; - hashlist_parse_t *hashlist_parse = (hashlist_parse_t *) buf; + const hashlist_parse_t *hashlist_parse = (const hashlist_parse_t *) buf; const u32 hashes_cnt = hashlist_parse->hashes_cnt; const u32 hashes_avail = hashlist_parse->hashes_avail; diff --git a/src/mpsp.c b/src/mpsp.c index 84875f8e8..420152a8e 100644 --- a/src/mpsp.c +++ b/src/mpsp.c @@ -23,8 +23,8 @@ static const char *DEF_MASK = "?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d"; static int sp_comp_val (const void *p1, const void *p2) { - hcstat_table_t *b1 = (hcstat_table_t *) p1; - hcstat_table_t *b2 = (hcstat_table_t *) p2; + const hcstat_table_t *b1 = (const hcstat_table_t *) p1; + const hcstat_table_t *b2 = (const hcstat_table_t *) p2; return b2->val - b1->val; } diff --git a/src/shared.c b/src/shared.c index 9041c70ad..18fd8845a 100644 --- a/src/shared.c +++ b/src/shared.c @@ -194,7 +194,7 @@ void *hc_bsearch_r (const void *key, const void *base, size_t nmemb, size_t size const size_t c = l + m; - const char *next = (char *) base + (c * size); + const char *next = (const char *) base + (c * size); const int cmp = (*compar) (key, next, arg); diff --git a/src/status.c b/src/status.c index 3995d36a5..6225ff59f 100644 --- a/src/status.c +++ b/src/status.c @@ -74,35 +74,35 @@ void format_timer_display (struct tm *tm, char *buf, size_t len) if (tm->tm_year - 70) { - char *time_entity1 = ((tm->tm_year - 70) == 1) ? (char *) time_entities_s[0] : (char *) time_entities_m[0]; - char *time_entity2 = ( tm->tm_yday == 1) ? (char *) time_entities_s[1] : (char *) time_entities_m[1]; + const char *time_entity1 = ((tm->tm_year - 70) == 1) ? time_entities_s[0] : time_entities_m[0]; + const char *time_entity2 = ( tm->tm_yday == 1) ? time_entities_s[1] : time_entities_m[1]; snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_year - 70, time_entity1, tm->tm_yday, time_entity2); } else if (tm->tm_yday) { - char *time_entity1 = (tm->tm_yday == 1) ? (char *) time_entities_s[1] : (char *) time_entities_m[1]; - char *time_entity2 = (tm->tm_hour == 1) ? (char *) time_entities_s[2] : (char *) time_entities_m[2]; + const char *time_entity1 = (tm->tm_yday == 1) ? time_entities_s[1] : time_entities_m[1]; + const char *time_entity2 = (tm->tm_hour == 1) ? time_entities_s[2] : time_entities_m[2]; snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_yday, time_entity1, tm->tm_hour, time_entity2); } else if (tm->tm_hour) { - char *time_entity1 = (tm->tm_hour == 1) ? (char *) time_entities_s[2] : (char *) time_entities_m[2]; - char *time_entity2 = (tm->tm_min == 1) ? (char *) time_entities_s[3] : (char *) time_entities_m[3]; + const char *time_entity1 = (tm->tm_hour == 1) ? time_entities_s[2] : time_entities_m[2]; + const char *time_entity2 = (tm->tm_min == 1) ? time_entities_s[3] : time_entities_m[3]; snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_hour, time_entity1, tm->tm_min, time_entity2); } else if (tm->tm_min) { - char *time_entity1 = (tm->tm_min == 1) ? (char *) time_entities_s[3] : (char *) time_entities_m[3]; - char *time_entity2 = (tm->tm_sec == 1) ? (char *) time_entities_s[4] : (char *) time_entities_m[4]; + const char *time_entity1 = (tm->tm_min == 1) ? time_entities_s[3] : time_entities_m[3]; + const char *time_entity2 = (tm->tm_sec == 1) ? time_entities_s[4] : time_entities_m[4]; snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_min, time_entity1, tm->tm_sec, time_entity2); } else { - char *time_entity1 = (tm->tm_sec == 1) ? (char *) time_entities_s[4] : (char *) time_entities_m[4]; + const char *time_entity1 = (tm->tm_sec == 1) ? time_entities_s[4] : time_entities_m[4]; snprintf (buf, len - 1, "%d %s", tm->tm_sec, time_entity1); } @@ -197,7 +197,7 @@ char *status_get_session (const hashcat_ctx_t *hashcat_ctx) return strdup (user_options->session); } -char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx) +const char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx) { const status_ctx_t *status_ctx = hashcat_ctx->status_ctx; @@ -209,27 +209,27 @@ char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx) { if (status_ctx->checkpoint_shutdown == true) { - return ((char *) ST_0012); + return ST_0012; } } switch (devices_status) { - case STATUS_INIT: return ((char *) ST_0000); - case STATUS_AUTOTUNE: return ((char *) ST_0001); - case STATUS_SELFTEST: return ((char *) ST_0002); - case STATUS_RUNNING: return ((char *) ST_0003); - case STATUS_PAUSED: return ((char *) ST_0004); - case STATUS_EXHAUSTED: return ((char *) ST_0005); - case STATUS_CRACKED: return ((char *) ST_0006); - case STATUS_ABORTED: return ((char *) ST_0007); - case STATUS_QUIT: return ((char *) ST_0008); - case STATUS_BYPASS: return ((char *) ST_0009); - case STATUS_ABORTED_CHECKPOINT: return ((char *) ST_0010); - case STATUS_ABORTED_RUNTIME: return ((char *) ST_0011); + case STATUS_INIT: return ST_0000; + case STATUS_AUTOTUNE: return ST_0001; + case STATUS_SELFTEST: return ST_0002; + case STATUS_RUNNING: return ST_0003; + case STATUS_PAUSED: return ST_0004; + case STATUS_EXHAUSTED: return ST_0005; + case STATUS_CRACKED: return ST_0006; + case STATUS_ABORTED: return ST_0007; + case STATUS_QUIT: return ST_0008; + case STATUS_BYPASS: return ST_0009; + case STATUS_ABORTED_CHECKPOINT: return ST_0010; + case STATUS_ABORTED_RUNTIME: return ST_0011; } - return ((char *) ST_9999); + return ST_9999; } int status_get_status_number (const hashcat_ctx_t *hashcat_ctx) @@ -239,7 +239,7 @@ int status_get_status_number (const hashcat_ctx_t *hashcat_ctx) return status_ctx->devices_status; } -char *status_get_hash_type (const hashcat_ctx_t *hashcat_ctx) +const char *status_get_hash_type (const hashcat_ctx_t *hashcat_ctx) { const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; diff --git a/src/wordlist.c b/src/wordlist.c index a9bf67402..a1b810e2f 100644 --- a/src/wordlist.c +++ b/src/wordlist.c @@ -347,7 +347,7 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64 cache_hit_t cache_hit; - cache_hit.dictfile = (char *) dictfile; + cache_hit.dictfile = dictfile; cache_hit.stat.st_size = d.stat.st_size; cache_hit.cached_cnt = cached_cnt; cache_hit.keyspace = keyspace; @@ -461,7 +461,7 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64 { cache_generate_t cache_generate; - cache_generate.dictfile = (char *) dictfile; + cache_generate.dictfile = dictfile; cache_generate.comp = comp; cache_generate.percent = percent; cache_generate.cnt = cnt; @@ -477,7 +477,7 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64 cache_generate_t cache_generate; - cache_generate.dictfile = (char *) dictfile; + cache_generate.dictfile = dictfile; cache_generate.comp = comp; cache_generate.percent = 100; cache_generate.cnt = cnt;