From 1109017a53ba8a13b7f7997e59da3a144d09ebf0 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 5 Nov 2017 12:33:41 -0800 Subject: [PATCH] Change atoi family to strtol family Suggested by clang tidy --- src/affinity.c | 2 +- src/interface.c | 230 ++++++++++++++++++++++----------------------- src/opencl.c | 22 ++--- src/outfile.c | 4 +- src/tuningdb.c | 8 +- src/user_options.c | 214 ++++++++++++++++++++--------------------- 6 files changed, 240 insertions(+), 240 deletions(-) diff --git a/src/affinity.c b/src/affinity.c index 52e5de39a..213d5fea0 100644 --- a/src/affinity.c +++ b/src/affinity.c @@ -71,7 +71,7 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx) do { - int cpu_id = atoi (next); + int cpu_id = strtol (next, NULL, 10); if (cpu_id == 0) { diff --git a/src/interface.c b/src/interface.c index cd871e64e..eda53190c 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2585,7 +2585,7 @@ int bcrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU u8 *iter_pos = input_buf + 4; - salt->salt_iter = 1u << atoll ((const char *) iter_pos); + salt->salt_iter = 1u << strtoul ((const char *) iter_pos, NULL, 10); u8 *salt_pos = (u8 *) strchr ((const char *) iter_pos, '$'); @@ -3048,7 +3048,7 @@ int dcc2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE salt_t *salt = hash_buf->salt; - u32 iter = atoll ((const char *) iter_pos); + u32 iter = strtoul ((const char *) iter_pos, NULL, 10); if (iter < 1) { @@ -3184,8 +3184,8 @@ int dpapimk_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN contents_pos++; - u32 version = atoll ((const char *) version_pos); - u32 contents_len = atoll ((const char *) contents_len_pos); + u32 version = strtoul ((const char *) version_pos, NULL, 10); + u32 contents_len = strtoul ((const char *) contents_len_pos, NULL, 10); if (version == 1 && contents_len != 208) return (PARSER_SALT_LENGTH); if (version == 2 && contents_len != 288) return (PARSER_SALT_LENGTH); @@ -3198,9 +3198,9 @@ int dpapimk_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN if (effective_contents_len != contents_len) return (PARSER_SALT_LENGTH); - dpapimk->context = atoll ((const char *) context_pos); + dpapimk->context = strtoul ((const char *) context_pos, NULL, 10); - salt->salt_iter = (atoll ((const char *) rounds_pos)) - 1; + salt->salt_iter = strtoul ((const char *) rounds_pos, NULL, 10) - 1; dpapimk->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]); dpapimk->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]); @@ -3661,7 +3661,7 @@ int md5crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U salt_pos[0] = 0x0; - salt->salt_iter = atoll ((const char *) (salt_pos - iterations_len)); + salt->salt_iter = strtoul ((const char *) (salt_pos - iterations_len), NULL, 10); salt_pos += 1; @@ -3720,7 +3720,7 @@ int md5apr1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN salt_pos[0] = 0x0; - salt->salt_iter = atoll ((const char *) (salt_pos - iterations_len)); + salt->salt_iter = strtoul ((const char *) (salt_pos - iterations_len), NULL, 10); salt_pos += 1; @@ -5711,7 +5711,7 @@ int sha512crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYB salt_pos[0] = 0x0; - salt->salt_iter = atoll ((const char *) (salt_pos - iterations_len)); + salt->salt_iter = strtoul ((const char *) (salt_pos - iterations_len), NULL, 10); salt_pos += 1; @@ -5832,7 +5832,7 @@ int chacha20_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U if (offset_marker == NULL) return (PARSER_SEPARATOR_UNMATCHED); offset_marker++; - int offset = atoi ((char*) offset_marker); + int offset = strtol ((char*) offset_marker, NULL, 10); if (offset > 63) return (PARSER_SALT_VALUE); u8 *iv_marker = (u8 *) strchr ((const char *) offset_marker, '*'); @@ -6465,9 +6465,9 @@ int sha1aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN u8 salt_iter[3] = { iter_pos[0], iter_pos[1], 0 }; - salt->salt_sign[0] = atoll ((const char *) salt_iter); + salt->salt_sign[0] = strtoul ((const char *) salt_iter, NULL, 10); - salt->salt_iter = (1u << atoll ((const char *) salt_iter)) - 1; + salt->salt_iter = (1u << strtoul ((const char *) salt_iter, NULL, 10)) - 1; hash_pos++; @@ -6514,9 +6514,9 @@ int sha256aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_ char salt_iter[3] = { iter_pos[0], iter_pos[1], 0 }; - salt->salt_sign[0] = atoll ((const char *) salt_iter); + salt->salt_sign[0] = strtoul ((const char *) salt_iter, NULL, 10); - salt->salt_iter = (1u << atoll ((const char *) salt_iter)) - 1; + salt->salt_iter = (1u << strtoul ((const char *) salt_iter, NULL, 10)) - 1; hash_pos++; @@ -6566,9 +6566,9 @@ int sha512aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_ char salt_iter[3] = { iter_pos[0], iter_pos[1], 0 }; - salt->salt_sign[0] = atoll ((const char *) salt_iter); + salt->salt_sign[0] = strtoul ((const char *) salt_iter, NULL, 10); - salt->salt_iter = (1u << atoll ((const char *) salt_iter)) - 1; + salt->salt_iter = (1u << strtoul ((const char *) salt_iter, NULL, 10)) - 1; hash_pos++; @@ -6630,7 +6630,7 @@ int agilekey_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U * pbkdf2 iterations */ - salt->salt_iter = atoll ((const char *) iterations_pos) - 1; + salt->salt_iter = strtoul ((const char *) iterations_pos, NULL, 10) - 1; /** * handle salt encoding @@ -6740,7 +6740,7 @@ int lastpass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U salt->salt_len = salt_len; - salt->salt_iter = atoll ((const char *) iterations_pos) - 1; + salt->salt_iter = strtoul ((const char *) iterations_pos, NULL, 10) - 1; if (is_valid_hex_string (hashbuf_pos, 32) == false) return (PARSER_HASH_ENCODING); @@ -6800,7 +6800,7 @@ int sha256crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYB salt_pos[0] = 0x0; - salt->salt_iter = atoll ((const char *) (salt_pos - iterations_len)); + salt->salt_iter = strtoul ((const char *) (salt_pos - iterations_len), NULL, 10); salt_pos += 1; @@ -6903,7 +6903,7 @@ int sha512macos_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYB salt->salt_buf[0] = pbkdf2_sha512->salt_buf[0]; - salt->salt_iter = atoll ((const char *) iter_pos) - 1; + salt->salt_iter = strtoul ((const char *) iter_pos, NULL, 10) - 1; return (PARSER_OK); } @@ -7038,7 +7038,7 @@ int sha512grub_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE salt->salt_len = salt_len; - salt->salt_iter = atoll ((const char *) iter_pos) - 1; + salt->salt_iter = strtoul ((const char *) iter_pos, NULL, 10) - 1; return (PARSER_OK); } @@ -7929,7 +7929,7 @@ int cloudkey_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U // iteration - salt->salt_iter = atoll ((const char *) iteration_pos) - 1; + salt->salt_iter = strtoul ((const char *) iteration_pos, NULL, 10) - 1; // data @@ -8069,7 +8069,7 @@ int nsec3_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUS // iteration - salt->salt_iter = atoll ((const char *) iteration_pos); + salt->salt_iter = strtoul ((const char *) iteration_pos, NULL, 10); return (PARSER_OK); } @@ -8368,7 +8368,7 @@ int lotus8_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU tmp_iter_buf[10] = 0; - salt->salt_iter = atoll ((const char *) tmp_iter_buf); + salt->salt_iter = strtoul ((const char *) tmp_iter_buf, NULL, 10); if (salt->salt_iter < 1) // well, the limit hopefully is much higher { @@ -8750,7 +8750,7 @@ int scrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU N_pos++; - salt->scrypt_N = atoll ((const char *) N_pos); + salt->scrypt_N = strtoul ((const char *) N_pos, NULL, 10); // r @@ -8760,7 +8760,7 @@ int scrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU r_pos++; - salt->scrypt_r = atoll ((const char *) r_pos); + salt->scrypt_r = strtoul ((const char *) r_pos, NULL, 10); // p @@ -8770,7 +8770,7 @@ int scrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU p_pos++; - salt->scrypt_p = atoll ((const char *) p_pos); + salt->scrypt_p = strtoul ((const char *) p_pos, NULL, 10); // salt @@ -9060,10 +9060,10 @@ int office2007_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE if (osalt_len != 32) return (PARSER_SALT_LENGTH); if (encryptedVerifier_len != 32) return (PARSER_SALT_LENGTH); - const u32 version = atoll ((const char *) version_pos); - const u32 verifierHashSize = atoll ((const char *) verifierHashSize_pos); - const u32 keySize = atoll ((const char *) keySize_pos); - const u32 saltSize = atoll ((const char *) saltSize_pos); + const u32 version = strtoul ((const char *) version_pos, NULL, 10); + const u32 verifierHashSize = strtoul ((const char *) verifierHashSize_pos, NULL, 10); + const u32 keySize = strtoul ((const char *) keySize_pos, NULL, 10); + const u32 saltSize = strtoul ((const char *) saltSize_pos, NULL, 10); if (version != 2007) return (PARSER_SALT_VALUE); if (verifierHashSize != 20) return (PARSER_SALT_VALUE); @@ -9210,10 +9210,10 @@ int office2010_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE if (osalt_len != 32) return (PARSER_SALT_LENGTH); if (encryptedVerifier_len != 32) return (PARSER_SALT_LENGTH); - const u32 version = atoll ((const char *) version_pos); - const u32 spinCount = atoll ((const char *) spinCount_pos); - const u32 keySize = atoll ((const char *) keySize_pos); - const u32 saltSize = atoll ((const char *) saltSize_pos); + const u32 version = strtoul ((const char *) version_pos, NULL, 10); + const u32 spinCount = strtoul ((const char *) spinCount_pos, NULL, 10); + const u32 keySize = strtoul ((const char *) keySize_pos, NULL, 10); + const u32 saltSize = strtoul ((const char *) saltSize_pos, NULL, 10); if (version != 2010) return (PARSER_SALT_VALUE); if (spinCount != 100000) return (PARSER_SALT_VALUE); @@ -9364,10 +9364,10 @@ int office2013_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE if (osalt_len != 32) return (PARSER_SALT_LENGTH); if (encryptedVerifier_len != 32) return (PARSER_SALT_LENGTH); - const u32 version = atoll ((const char *) version_pos); - const u32 spinCount = atoll ((const char *) spinCount_pos); - const u32 keySize = atoll ((const char *) keySize_pos); - const u32 saltSize = atoll ((const char *) saltSize_pos); + const u32 version = strtoul ((const char *) version_pos, NULL, 10); + const u32 spinCount = strtoul ((const char *) spinCount_pos, NULL, 10); + const u32 keySize = strtoul ((const char *) keySize_pos, NULL, 10); + const u32 saltSize = strtoul ((const char *) saltSize_pos, NULL, 10); if (version != 2013) return (PARSER_SALT_VALUE); if (spinCount != 100000) return (PARSER_SALT_VALUE); @@ -10070,7 +10070,7 @@ int djangopbkdf2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAY u8 *iter_pos = input_buf + 14; - const int iter = atoi ((const char *) iter_pos); + const int iter = strtol ((const char *) iter_pos, NULL, 10); if (iter < 1) return (PARSER_SALT_ITERATION); @@ -10254,7 +10254,7 @@ int saph_sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_ u8 *iter_pos = input_buf + 10; - u32 iter = atoll ((const char *) iter_pos); + u32 iter = strtoul ((const char *) iter_pos, NULL, 10); if (iter < 1) { @@ -10500,26 +10500,26 @@ int pdf11_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUS // validate data - const int V = atoi ((const char *) V_pos); - const int R = atoi ((const char *) R_pos); - const int P = atoi ((const char *) P_pos); + const int V = strtol ((const char *) V_pos, NULL, 10); + const int R = strtol ((const char *) R_pos, NULL, 10); + const int P = strtol ((const char *) P_pos, NULL, 10); if (V != 1) return (PARSER_SALT_VALUE); if (R != 2) return (PARSER_SALT_VALUE); - const int enc_md = atoi ((const char *) enc_md_pos); + const int enc_md = strtol ((const char *) enc_md_pos, NULL, 10); if ((enc_md != 0) && (enc_md != 1)) return (PARSER_SALT_VALUE); - const int id_len = atoi ((const char *) id_len_pos); - const int u_len = atoi ((const char *) u_len_pos); - const int o_len = atoi ((const char *) o_len_pos); + const int id_len = strtol ((const char *) id_len_pos, NULL, 10); + const int u_len = strtol ((const char *) u_len_pos, NULL, 10); + const int o_len = strtol ((const char *) o_len_pos, NULL, 10); if (id_len != 16) return (PARSER_SALT_VALUE); if (u_len != 32) return (PARSER_SALT_VALUE); if (o_len != 32) return (PARSER_SALT_VALUE); - const int bits = atoi ((const char *) bits_pos); + const int bits = strtol ((const char *) bits_pos, NULL, 10); if (bits != 40) return (PARSER_SALT_VALUE); @@ -10702,26 +10702,26 @@ int pdf11cm2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U // validate data - const int V = atoi ((const char *) V_pos); - const int R = atoi ((const char *) R_pos); - const int P = atoi ((const char *) P_pos); + const int V = strtol ((const char *) V_pos, NULL, 10); + const int R = strtol ((const char *) R_pos, NULL, 10); + const int P = strtol ((const char *) P_pos, NULL, 10); if (V != 1) return (PARSER_SALT_VALUE); if (R != 2) return (PARSER_SALT_VALUE); - const int enc_md = atoi ((const char *) enc_md_pos); + const int enc_md = strtol ((const char *) enc_md_pos, NULL, 10); if ((enc_md != 0) && (enc_md != 1)) return (PARSER_SALT_VALUE); - const int id_len = atoi ((const char *) id_len_pos); - const int u_len = atoi ((const char *) u_len_pos); - const int o_len = atoi ((const char *) o_len_pos); + const int id_len = strtol ((const char *) id_len_pos, NULL, 10); + const int u_len = strtol ((const char *) u_len_pos, NULL, 10); + const int o_len = strtol ((const char *) o_len_pos, NULL, 10); if (id_len != 16) return (PARSER_SALT_VALUE); if (u_len != 32) return (PARSER_SALT_VALUE); if (o_len != 32) return (PARSER_SALT_VALUE); - const int bits = atoi ((const char *) bits_pos); + const int bits = strtol ((const char *) bits_pos, NULL, 10); if (bits != 40) return (PARSER_SALT_VALUE); @@ -10910,9 +10910,9 @@ int pdf14_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUS // validate data - const int V = atoi ((const char *) V_pos); - const int R = atoi ((const char *) R_pos); - const int P = atoi ((const char *) P_pos); + const int V = strtol ((const char *) V_pos, NULL, 10); + const int R = strtol ((const char *) R_pos, NULL, 10); + const int P = strtol ((const char *) P_pos, NULL, 10); int vr_ok = 0; @@ -10921,16 +10921,16 @@ int pdf14_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUS if (vr_ok == 0) return (PARSER_SALT_VALUE); - const int id_len = atoi ((const char *) id_len_pos); - const int u_len = atoi ((const char *) u_len_pos); - const int o_len = atoi ((const char *) o_len_pos); + const int id_len = strtol ((const char *) id_len_pos, NULL, 10); + const int u_len = strtol ((const char *) u_len_pos, NULL, 10); + const int o_len = strtol ((const char *) o_len_pos, NULL, 10); if ((id_len != 16) && (id_len != 32)) return (PARSER_SALT_VALUE); if (u_len != 32) return (PARSER_SALT_VALUE); if (o_len != 32) return (PARSER_SALT_VALUE); - const int bits = atoi ((const char *) bits_pos); + const int bits = strtol ((const char *) bits_pos, NULL, 10); if (bits != 128) return (PARSER_SALT_VALUE); @@ -10938,7 +10938,7 @@ int pdf14_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUS if (R >= 4) { - enc_md = atoi ((const char *) enc_md_pos); + enc_md = strtol ((const char *) enc_md_pos, NULL, 10); } // copy data to esalt @@ -11180,8 +11180,8 @@ int pdf17l8_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN // validate data - const int V = atoi ((const char *) V_pos); - const int R = atoi ((const char *) R_pos); + const int V = strtol ((const char *) V_pos, NULL, 10); + const int R = strtol ((const char *) R_pos, NULL, 10); int vr_ok = 0; @@ -11190,17 +11190,17 @@ int pdf17l8_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN if (vr_ok == 0) return (PARSER_SALT_VALUE); - const int bits = atoi ((const char *) bits_pos); + const int bits = strtol ((const char *) bits_pos, NULL, 10); if (bits != 256) return (PARSER_SALT_VALUE); - int enc_md = atoi ((const char *) enc_md_pos); + int enc_md = strtol ((const char *) enc_md_pos, NULL, 10); if ((enc_md != 0) && (enc_md != 1)) return (PARSER_SALT_VALUE); - const u32 id_len = atoll ((const char *) id_len_pos); - const u32 u_len = atoll ((const char *) u_len_pos); - const u32 o_len = atoll ((const char *) o_len_pos); + const u32 id_len = strtoul ((const char *) id_len_pos, NULL, 10); + const u32 u_len = strtoul ((const char *) u_len_pos, NULL, 10); + const u32 o_len = strtoul ((const char *) o_len_pos, NULL, 10); if (V_len > 6) return (PARSER_SALT_LENGTH); if (R_len > 6) return (PARSER_SALT_LENGTH); @@ -11264,7 +11264,7 @@ int pbkdf2_sha256_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MA u8 *iter_pos = input_buf + 7; - u32 iter = atoll ((const char *) iter_pos); + u32 iter = strtoul ((const char *) iter_pos, NULL, 10); if (iter < 1) return (PARSER_SALT_ITERATION); if (iter > 999999) return (PARSER_SALT_ITERATION); @@ -11587,10 +11587,10 @@ int bitcoin_wallet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, M u32 public_key_buf_len = input_len - 1 - 7 - 1 - cry_master_len_len - 1 - cry_master_buf_len - 1 - cry_salt_len_len - 1 - cry_salt_buf_len - 1 - cry_rounds_len - 1 - ckey_len_len - 1 - ckey_buf_len - 1 - public_key_len_len - 1; - const u32 cry_master_len = atoll ((const char *) cry_master_len_pos); - const u32 cry_salt_len = atoll ((const char *) cry_salt_len_pos); - const u32 ckey_len = atoll ((const char *) ckey_len_pos); - const u32 public_key_len = atoll ((const char *) public_key_len_pos); + const u32 cry_master_len = strtoul ((const char *) cry_master_len_pos, NULL, 10); + const u32 cry_salt_len = strtoul ((const char *) cry_salt_len_pos, NULL, 10); + const u32 ckey_len = strtoul ((const char *) ckey_len_pos, NULL, 10); + const u32 public_key_len = strtoul ((const char *) public_key_len_pos, NULL, 10); if (cry_master_buf_len != cry_master_len) return (PARSER_SALT_VALUE); if (cry_salt_buf_len != cry_salt_len) return (PARSER_SALT_VALUE); @@ -11637,7 +11637,7 @@ int bitcoin_wallet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, M if (cry_rounds_len >= 7) return (PARSER_SALT_VALUE); - const u32 cry_rounds = atoll ((const char *) cry_rounds_pos); + const u32 cry_rounds = strtoul ((const char *) cry_rounds_pos, NULL, 10); salt->salt_iter = cry_rounds - 1; @@ -12182,13 +12182,13 @@ int seven_zip_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_ data_buf_len = input_len - 1 - 2 - 1 - data_type_len - 1 - NumCyclesPower_len - 1 - salt_len_len - 1 - salt_buf_len - 1 - iv_len_len - 1 - iv_buf_len - 1 - crc_buf_len - 1 - data_len_len - 1 - unpack_size_len - 1; } - const u32 iter = atoll ((const char *) NumCyclesPower_pos); - const u32 crc = atoll ((const char *) crc_buf_pos); - const u32 data_type = atoll ((const char *) data_type_pos); - const u32 salt_len = atoll ((const char *) salt_len_pos); - const u32 iv_len = atoll ((const char *) iv_len_pos); - const u32 unpack_size = atoll ((const char *) unpack_size_pos); - const u32 data_len = atoll ((const char *) data_len_pos); + const u32 iter = strtoul ((const char *) NumCyclesPower_pos, NULL, 10); + const u32 crc = strtoul ((const char *) crc_buf_pos, NULL, 10); + const u32 data_type = strtoul ((const char *) data_type_pos, NULL, 10); + const u32 salt_len = strtoul ((const char *) salt_len_pos, NULL, 10); + const u32 iv_len = strtoul ((const char *) iv_len_pos, NULL, 10); + const u32 unpack_size = strtoul ((const char *) unpack_size_pos, NULL, 10); + const u32 data_len = strtoul ((const char *) data_len_pos, NULL, 10); // if neither uncompressed nor truncated, then we need the length for crc and coder attributes @@ -12202,7 +12202,7 @@ int seven_zip_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_ coder_attributes_len = input_len - 1 - 2 - 1 - data_type_len - 1 - NumCyclesPower_len - 1 - salt_len_len - 1 - salt_buf_len - 1 - iv_len_len - 1 - iv_buf_len - 1 - crc_buf_len - 1 - data_len_len - 1 - unpack_size_len - 1 - data_buf_len - 1 - crc_len_len - 1; - crc_len = atoll ((const char *) crc_len_pos); + crc_len = strtoul ((const char *) crc_len_pos, NULL, 10); } /** @@ -12411,7 +12411,7 @@ int pbkdf2_md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE u8 *iter_pos = input_buf + 4; - u32 iter = atoll ((const char *) iter_pos); + u32 iter = strtoul ((const char *) iter_pos, NULL, 10); if (iter < 1) return (PARSER_SALT_ITERATION); if (iter > 999999) return (PARSER_SALT_ITERATION); @@ -12495,7 +12495,7 @@ int pbkdf2_sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYB u8 *iter_pos = input_buf + 5; - u32 iter = atoll ((const char *) iter_pos); + u32 iter = strtoul ((const char *) iter_pos, NULL, 10); if (iter < 1) return (PARSER_SALT_ITERATION); if (iter > 999999) return (PARSER_SALT_ITERATION); @@ -12584,7 +12584,7 @@ int pbkdf2_sha512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MA u8 *iter_pos = input_buf + 7; - u32 iter = atoll ((const char *) iter_pos); + u32 iter = strtoul ((const char *) iter_pos, NULL, 10); if (iter < 1) return (PARSER_SALT_ITERATION); if (iter > 999999) return (PARSER_SALT_ITERATION); @@ -12911,9 +12911,9 @@ int rar5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE u8 *iv = param3_pos; u8 *pswcheck = param5_pos; - const u32 salt_len = atoll ((const char *) param0_pos); - const u32 iterations = atoll ((const char *) param2_pos); - const u32 pswcheck_len = atoll ((const char *) param4_pos); + const u32 salt_len = strtoul ((const char *) param0_pos, NULL, 10); + const u32 iterations = strtoul ((const char *) param2_pos, NULL, 10); + const u32 pswcheck_len = strtoul ((const char *) param4_pos, NULL, 10); /** * verify some data @@ -13103,7 +13103,7 @@ int axcrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN u8 *data_pos; - salt->salt_iter = atoll ((const char *) wrapping_rounds_pos); + salt->salt_iter = strtoul ((const char *) wrapping_rounds_pos, NULL, 10); salt_pos = (u8 *) strchr ((const char *) wrapping_rounds_pos, '*'); @@ -13211,7 +13211,7 @@ int keepass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN version_pos = input_buf + 8 + 1 + 1; - keepass->version = atoll ((const char *) version_pos); + keepass->version = strtoul ((const char *) version_pos, NULL, 10); rounds_pos = (u8 *) strchr ((const char *) version_pos, '*'); @@ -13219,7 +13219,7 @@ int keepass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN rounds_pos++; - salt->salt_iter = (atoll ((const char *) rounds_pos)); + salt->salt_iter = strtoul ((const char *) rounds_pos, NULL, 10); algorithm_pos = (u8 *) strchr ((const char *) rounds_pos, '*'); @@ -13227,7 +13227,7 @@ int keepass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN algorithm_pos++; - keepass->algorithm = atoll ((const char *) algorithm_pos); + keepass->algorithm = strtoul ((const char *) algorithm_pos, NULL, 10); final_random_seed_pos = (u8 *) strchr ((const char *) algorithm_pos, '*'); @@ -13358,7 +13358,7 @@ int keepass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN inline_flag_pos++; - u32 inline_flag = atoll ((const char *) inline_flag_pos); + u32 inline_flag = strtoul ((const char *) inline_flag_pos, NULL, 10); if (inline_flag != 1) return (PARSER_SALT_LENGTH); @@ -13368,7 +13368,7 @@ int keepass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN contents_len_pos++; - int contents_len = atoi ((const char *) contents_len_pos); + int contents_len = strtol ((const char *) contents_len_pos, NULL, 10); if (contents_len > 50000) return (PARSER_SALT_LENGTH); @@ -13498,7 +13498,7 @@ int keepass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN keyfile_len_pos++; - int keyfile_len = atoi ((const char *) keyfile_len_pos); + int keyfile_len = strtol ((const char *) keyfile_len_pos, NULL, 10); keepass->keyfile_len = keyfile_len; @@ -13687,7 +13687,7 @@ int mywallet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U if (data_buf_len % 16) return (PARSER_HASH_LENGTH); - u32 data_len = atoll ((const char *) data_len_pos); + u32 data_len = strtoul ((const char *) data_len_pos, NULL, 10); if ((data_len * 2) != data_buf_len) return (PARSER_HASH_LENGTH); @@ -13781,11 +13781,11 @@ int mywalletv2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE if (data_buf_len % 16) return (PARSER_HASH_LENGTH); - u32 data_len = atoll ((const char *) data_len_pos); + u32 data_len = strtoul ((const char *) data_len_pos, NULL, 10); if ((data_len * 2) != data_buf_len) return (PARSER_HASH_LENGTH); - u32 iter = atoll ((const char *) iter_pos); + u32 iter = strtoul ((const char *) iter_pos, NULL, 10); /** * salt @@ -13886,7 +13886,7 @@ int ms_drsr_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN salt->salt_len = salt_len / 2; - salt->salt_iter = atoll ((const char *) iter_pos) - 1u; + salt->salt_iter = strtoul ((const char *) iter_pos, NULL, 10) - 1ul; /** * digest buf @@ -14076,9 +14076,9 @@ int zip2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE u32 param7_len = param8_pos - param7_pos; - const u32 type = atoll ((const char *) param0_pos); - const u32 mode = atoll ((const char *) param1_pos); - const u32 magic = atoll ((const char *) param2_pos); + const u32 type = strtoul ((const char *) param0_pos, NULL, 10); + const u32 mode = strtoul ((const char *) param1_pos, NULL, 10); + const u32 magic = strtoul ((const char *) param2_pos, NULL, 10); u8 *salt_buf = param3_pos; @@ -14089,7 +14089,7 @@ int zip2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE return (PARSER_SALT_VALUE); } - const u32 compress_length = atoll ((const char *) param5_pos); + const u32 compress_length = strtoul ((const char *) param5_pos, NULL, 10); u8 *data_buf = param6_pos; u8 *auth = param7_pos; @@ -14762,7 +14762,7 @@ int itunes_backup_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MA if ((version_len != 1) && (version_len != 2)) return (PARSER_SEPARATOR_UNMATCHED); - u32 version = atoi ((const char *) version_pos); + u32 version = strtoul ((const char *) version_pos, NULL, 10); if (hash_mode == 14700) { @@ -14778,7 +14778,7 @@ int itunes_backup_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MA if (iter_len < 1) return (PARSER_SALT_ITERATION); if (iter_len > 6) return (PARSER_SALT_ITERATION); - u32 iter = atoi ((const char *) iter_pos); + u32 iter = strtoul ((const char *) iter_pos, NULL, 10); if (iter < 1) return (PARSER_SALT_ITERATION); @@ -14799,7 +14799,7 @@ int itunes_backup_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MA if (dpic_len < 1) return (PARSER_SALT_ITERATION); if (dpic_len > 9) return (PARSER_SALT_ITERATION); - dpic = atoi ((const char *) dpic_pos); + dpic = strtoul ((const char *) dpic_pos, NULL, 10); if (dpic < 1) return (PARSER_SALT_ITERATION); @@ -15144,7 +15144,7 @@ int netbsd_sha1crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, * verify data */ - u32 iter = atoi ((const char *) iter_pos); + u32 iter = strtoul ((const char *) iter_pos, NULL, 10); if (iter < 99) return (PARSER_SALT_ITERATION); // (actually: CRYPT_SHA1_ITERATIONS should be 24680 or more) @@ -15476,7 +15476,7 @@ int ethereum_pbkdf2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, * verify some data */ - const u32 iter = atoi ((const char *) iter_pos); + const u32 iter = strtoul ((const char *) iter_pos, NULL, 10); if (iter < 1) return (PARSER_SALT_ITERATION); @@ -15616,9 +15616,9 @@ int ethereum_scrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, * verify some data */ - const u32 scrypt_N = atoi ((const char *) scryptN_pos); - const u32 scrypt_r = atoi ((const char *) scryptr_pos); - const u32 scrypt_p = atoi ((const char *) scryptp_pos); + const u32 scrypt_N = strtoul ((const char *) scryptN_pos, NULL, 10); + const u32 scrypt_r = strtoul ((const char *) scryptr_pos, NULL, 10); + const u32 scrypt_p = strtoul ((const char *) scryptp_pos, NULL, 10); if (salt_len != 64) return (PARSER_SALT_LENGTH); if (ciphertext_len != 64) return (PARSER_SALT_LENGTH); diff --git a/src/opencl.c b/src/opencl.c index f9bf69490..071bc3dec 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -123,7 +123,7 @@ static int setup_opencl_platforms_filter (hashcat_ctx_t *hashcat_ctx, const char do { - int platform = atoi (next); + int platform = strtol (next, NULL, 10); if (platform < 1 || platform > 32) { @@ -166,7 +166,7 @@ static int setup_devices_filter (hashcat_ctx_t *hashcat_ctx, const char *opencl_ do { - int device_id = atoi (next); + int device_id = strtol (next, NULL, 10); if (device_id < 1 || device_id > 32) { @@ -209,7 +209,7 @@ static int setup_device_types_filter (hashcat_ctx_t *hashcat_ctx, const char *op do { - int device_type = atoi (next); + int device_type = strtol (next, NULL, 10); if (device_type < 1 || device_type > 3) { @@ -3322,23 +3322,23 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) // ROCm is so much better, we should give the user some hint and remove this block // AMDGPU-PRO Driver 16.40 and higher - if (atoi (device_param->driver_version) >= 2117) amd_warn = false; + if (strtoul (device_param->driver_version, NULL, 10) >= 2117) amd_warn = false; // AMDGPU-PRO Driver 16.50 is known to be broken - if (atoi (device_param->driver_version) == 2236) amd_warn = true; + if (strtoul (device_param->driver_version, NULL, 10) == 2236) amd_warn = true; // AMDGPU-PRO Driver 16.60 is known to be broken - if (atoi (device_param->driver_version) == 2264) amd_warn = true; + if (strtoul (device_param->driver_version, NULL, 10) == 2264) amd_warn = true; // AMDGPU-PRO Driver 17.10 is known to be broken - if (atoi (device_param->driver_version) == 2348) amd_warn = true; + if (strtoul (device_param->driver_version, NULL, 10) == 2348) amd_warn = true; // AMDGPU-PRO Driver 17.20 (2416) is fine, doesn't need check will match >= 2117 } else { // Support for ROCm platform - if (atof (device_param->driver_version) >= 1.1) amd_warn = false; + if (strtof (device_param->driver_version, NULL) >= 1.1) amd_warn = false; } #elif defined (_WIN) // AMD Radeon Software 14.9 and higher, should be updated to 15.12 - if (atoi (device_param->driver_version) >= 1573) amd_warn = false; + if (strtoul (device_param->driver_version, NULL, 10) >= 1573) amd_warn = false; #else // we have no information about other os if (amd_warn == true) amd_warn = false; @@ -3363,7 +3363,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) int nv_warn = true; // nvidia driver 367.x and higher - if (atoi (device_param->driver_version) >= 367) nv_warn = false; + if (strtoul (device_param->driver_version, NULL, 10) >= 367) nv_warn = false; if (nv_warn == true) { @@ -4261,7 +4261,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) { if (device_param->platform_vendor_id == VENDOR_ID_INTEL_SDK) { - strncat (build_opts_new, " -cl-opt-disable", sizeof (build_opts_new) - 1); + strncat (build_opts_new, " -cl-opt-disable", 16); } } diff --git a/src/outfile.c b/src/outfile.c index 4006e4a83..156fc0093 100644 --- a/src/outfile.c +++ b/src/outfile.c @@ -454,7 +454,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign tmp_buf[tmp_len++] = 'X'; tmp_buf[tmp_len++] = '['; - exec_hexify ((const u8 *) plain_ptr, plain_len, (u8 *) tmp_buf + tmp_len); + exec_hexify (plain_ptr, plain_len, (u8 *) tmp_buf + tmp_len); tmp_len += plain_len * 2; @@ -477,7 +477,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign if (outfile_ctx->outfile_format & OUTFILE_FMT_HEXPLAIN) { - exec_hexify ((const u8 *) plain_ptr, plain_len, (u8 *) tmp_buf + tmp_len); + exec_hexify (plain_ptr, plain_len, (u8 *) tmp_buf + tmp_len); tmp_len += plain_len * 2; diff --git a/src/tuningdb.c b/src/tuningdb.c index bab538f7a..cddc647d5 100644 --- a/src/tuningdb.c +++ b/src/tuningdb.c @@ -179,9 +179,9 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx) int kernel_accel = -1; int kernel_loops = -1; - if (token_ptr[1][0] != '*') attack_mode = atoi (token_ptr[1]); - if (token_ptr[2][0] != '*') hash_type = atoi (token_ptr[2]); - if (token_ptr[3][0] != 'N') vector_width = atoi (token_ptr[3]); + if (token_ptr[1][0] != '*') attack_mode = strtol (token_ptr[1], NULL, 10); + if (token_ptr[2][0] != '*') hash_type = strtol (token_ptr[2], NULL, 10); + if (token_ptr[3][0] != 'N') vector_width = strtol (token_ptr[3], NULL, 10); if (token_ptr[4][0] == 'A') { @@ -224,7 +224,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx) } else { - kernel_loops = atoi (token_ptr[5]); + kernel_loops = strtol (token_ptr[5], NULL, 10); if (kernel_loops < 1) { diff --git a/src/user_options.c b/src/user_options.c index b7c85b32e..519201ef5 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -313,113 +313,113 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) { switch (c) { - case IDX_HELP: user_options->usage = true; break; - case IDX_VERSION: user_options->version = true; break; - case IDX_RESTORE: user_options->restore = true; break; - case IDX_QUIET: user_options->quiet = true; break; - case IDX_SHOW: user_options->show = true; break; - case IDX_LEFT: user_options->left = true; break; - case IDX_ADVICE_DISABLE: user_options->advice_disable = true; break; - case IDX_USERNAME: user_options->username = true; break; - case IDX_REMOVE: user_options->remove = true; break; - case IDX_REMOVE_TIMER: user_options->remove_timer = atoi (optarg); - user_options->remove_timer_chgd = true; break; - case IDX_POTFILE_DISABLE: user_options->potfile_disable = true; break; - case IDX_POTFILE_PATH: user_options->potfile_path = optarg; break; - case IDX_DEBUG_MODE: user_options->debug_mode = atoi (optarg); break; - case IDX_DEBUG_FILE: user_options->debug_file = optarg; break; - case IDX_ENCODING_FROM: user_options->encoding_from = optarg; break; - case IDX_ENCODING_TO: user_options->encoding_to = optarg; break; - case IDX_INDUCTION_DIR: user_options->induction_dir = optarg; break; - case IDX_OUTFILE_CHECK_DIR: user_options->outfile_check_dir = optarg; break; - case IDX_EXAMPLE_HASHES: user_options->example_hashes = true; break; - case IDX_FORCE: user_options->force = true; break; - case IDX_SELF_TEST_DISABLE: user_options->self_test_disable = true; break; - case IDX_SKIP: user_options->skip = atoll (optarg); break; - case IDX_LIMIT: user_options->limit = atoll (optarg); break; - case IDX_KEEP_GUESSING: user_options->keep_guessing = true; break; - case IDX_KEYSPACE: user_options->keyspace = true; break; - case IDX_BENCHMARK: user_options->benchmark = true; break; - case IDX_STDOUT_FLAG: user_options->stdout_flag = true; break; - case IDX_SPEED_ONLY: user_options->speed_only = true; break; - case IDX_PROGRESS_ONLY: user_options->progress_only = true; break; - case IDX_RESTORE_DISABLE: user_options->restore_disable = true; break; - case IDX_RESTORE_FILE_PATH: user_options->restore_file_path = optarg; break; - case IDX_STATUS: user_options->status = true; break; - case IDX_STATUS_TIMER: user_options->status_timer = atoi (optarg); break; - case IDX_MACHINE_READABLE: user_options->machine_readable = true; break; - case IDX_LOOPBACK: user_options->loopback = true; break; - case IDX_SESSION: user_options->session = optarg; break; - case IDX_HASH_MODE: user_options->hash_mode = atoi (optarg); - user_options->hash_mode_chgd = true; break; - case IDX_RUNTIME: user_options->runtime = atoi (optarg); - user_options->runtime_chgd = true; break; - case IDX_ATTACK_MODE: user_options->attack_mode = atoi (optarg); - user_options->attack_mode_chgd = true; break; - case IDX_RP_FILE: user_options->rp_files[user_options->rp_files_cnt++] - = optarg; break; - case IDX_RP_GEN: user_options->rp_gen = atoi (optarg); break; - case IDX_RP_GEN_FUNC_MIN: user_options->rp_gen_func_min = atoi (optarg); break; - case IDX_RP_GEN_FUNC_MAX: user_options->rp_gen_func_max = atoi (optarg); break; - case IDX_RP_GEN_SEED: user_options->rp_gen_seed = atoi (optarg); - user_options->rp_gen_seed_chgd = true; break; - case IDX_RULE_BUF_L: user_options->rule_buf_l = optarg; break; - case IDX_RULE_BUF_R: user_options->rule_buf_r = optarg; break; - case IDX_MARKOV_DISABLE: user_options->markov_disable = true; break; - case IDX_MARKOV_CLASSIC: user_options->markov_classic = true; break; - case IDX_MARKOV_THRESHOLD: user_options->markov_threshold = atoi (optarg); break; - case IDX_MARKOV_HCSTAT: user_options->markov_hcstat = optarg; break; - case IDX_OUTFILE: user_options->outfile = optarg; break; - case IDX_OUTFILE_FORMAT: user_options->outfile_format = atoi (optarg); - user_options->outfile_format_chgd = true; break; - case IDX_OUTFILE_AUTOHEX_DISABLE: user_options->outfile_autohex = false; break; - case IDX_OUTFILE_CHECK_TIMER: user_options->outfile_check_timer = atoi (optarg); break; - case IDX_WORDLIST_AUTOHEX_DISABLE: user_options->wordlist_autohex_disable = true; break; - case IDX_HEX_CHARSET: user_options->hex_charset = true; break; - case IDX_HEX_SALT: user_options->hex_salt = true; break; - case IDX_HEX_WORDLIST: user_options->hex_wordlist = true; break; - case IDX_CPU_AFFINITY: user_options->cpu_affinity = optarg; break; - case IDX_OPENCL_INFO: user_options->opencl_info = true; break; - case IDX_OPENCL_DEVICES: user_options->opencl_devices = optarg; break; - case IDX_OPENCL_PLATFORMS: user_options->opencl_platforms = optarg; break; - case IDX_OPENCL_DEVICE_TYPES: user_options->opencl_device_types = optarg; break; - case IDX_OPENCL_VECTOR_WIDTH: user_options->opencl_vector_width = atoi (optarg); - user_options->opencl_vector_width_chgd = true; break; - case IDX_OPTIMIZED_KERNEL_ENABLE: user_options->optimized_kernel_enable = true; break; - case IDX_WORKLOAD_PROFILE: user_options->workload_profile = atoi (optarg); - user_options->workload_profile_chgd = true; break; - case IDX_KERNEL_ACCEL: user_options->kernel_accel = atoi (optarg); - user_options->kernel_accel_chgd = true; break; - case IDX_KERNEL_LOOPS: user_options->kernel_loops = atoi (optarg); - user_options->kernel_loops_chgd = true; break; - case IDX_NVIDIA_SPIN_DAMP: user_options->nvidia_spin_damp = atoi (optarg); - user_options->nvidia_spin_damp_chgd = true; break; - case IDX_GPU_TEMP_DISABLE: user_options->gpu_temp_disable = true; break; - case IDX_GPU_TEMP_ABORT: user_options->gpu_temp_abort = atoi (optarg); break; - case IDX_GPU_TEMP_RETAIN: user_options->gpu_temp_retain = atoi (optarg); break; - case IDX_POWERTUNE_ENABLE: user_options->powertune_enable = true; break; - case IDX_LOGFILE_DISABLE: user_options->logfile_disable = true; break; - case IDX_HCCAPX_MESSAGE_PAIR: user_options->hccapx_message_pair = atoi (optarg); - user_options->hccapx_message_pair_chgd = true; break; - case IDX_NONCE_ERROR_CORRECTIONS: user_options->nonce_error_corrections = atoi (optarg); break; - case IDX_TRUECRYPT_KEYFILES: user_options->truecrypt_keyfiles = optarg; break; - case IDX_VERACRYPT_KEYFILES: user_options->veracrypt_keyfiles = optarg; break; - case IDX_VERACRYPT_PIM: user_options->veracrypt_pim = atoi (optarg); break; - case IDX_SEGMENT_SIZE: user_options->segment_size = atoi (optarg); - user_options->segment_size_chgd = true; break; - case IDX_SCRYPT_TMTO: user_options->scrypt_tmto = atoi (optarg); break; - case IDX_SEPARATOR: user_options->separator = optarg[0]; break; - case IDX_BITMAP_MIN: user_options->bitmap_min = atoi (optarg); break; - case IDX_BITMAP_MAX: user_options->bitmap_max = atoi (optarg); break; - case IDX_INCREMENT: user_options->increment = true; break; - case IDX_INCREMENT_MIN: user_options->increment_min = atoi (optarg); - user_options->increment_min_chgd = true; break; - case IDX_INCREMENT_MAX: user_options->increment_max = atoi (optarg); - user_options->increment_max_chgd = true; break; - case IDX_CUSTOM_CHARSET_1: user_options->custom_charset_1 = optarg; break; - case IDX_CUSTOM_CHARSET_2: user_options->custom_charset_2 = optarg; break; - case IDX_CUSTOM_CHARSET_3: user_options->custom_charset_3 = optarg; break; - case IDX_CUSTOM_CHARSET_4: user_options->custom_charset_4 = optarg; break; + case IDX_HELP: user_options->usage = true; break; + case IDX_VERSION: user_options->version = true; break; + case IDX_RESTORE: user_options->restore = true; break; + case IDX_QUIET: user_options->quiet = true; break; + case IDX_SHOW: user_options->show = true; break; + case IDX_LEFT: user_options->left = true; break; + case IDX_ADVICE_DISABLE: user_options->advice_disable = true; break; + case IDX_USERNAME: user_options->username = true; break; + case IDX_REMOVE: user_options->remove = true; break; + case IDX_REMOVE_TIMER: user_options->remove_timer = atoi (optarg); + user_options->remove_timer_chgd = true; break; + case IDX_POTFILE_DISABLE: user_options->potfile_disable = true; break; + case IDX_POTFILE_PATH: user_options->potfile_path = optarg; break; + case IDX_DEBUG_MODE: user_options->debug_mode = atoi (optarg); break; + case IDX_DEBUG_FILE: user_options->debug_file = optarg; break; + case IDX_ENCODING_FROM: user_options->encoding_from = optarg; break; + case IDX_ENCODING_TO: user_options->encoding_to = optarg; break; + case IDX_INDUCTION_DIR: user_options->induction_dir = optarg; break; + case IDX_OUTFILE_CHECK_DIR: user_options->outfile_check_dir = optarg; break; + case IDX_EXAMPLE_HASHES: user_options->example_hashes = true; break; + case IDX_FORCE: user_options->force = true; break; + case IDX_SELF_TEST_DISABLE: user_options->self_test_disable = true; break; + case IDX_SKIP: user_options->skip = atoll (optarg); break; + case IDX_LIMIT: user_options->limit = atoll (optarg); break; + case IDX_KEEP_GUESSING: user_options->keep_guessing = true; break; + case IDX_KEYSPACE: user_options->keyspace = true; break; + case IDX_BENCHMARK: user_options->benchmark = true; break; + case IDX_STDOUT_FLAG: user_options->stdout_flag = true; break; + case IDX_SPEED_ONLY: user_options->speed_only = true; break; + case IDX_PROGRESS_ONLY: user_options->progress_only = true; break; + case IDX_RESTORE_DISABLE: user_options->restore_disable = true; break; + case IDX_RESTORE_FILE_PATH: user_options->restore_file_path = optarg; break; + case IDX_STATUS: user_options->status = true; break; + case IDX_STATUS_TIMER: user_options->status_timer = atoi (optarg); break; + case IDX_MACHINE_READABLE: user_options->machine_readable = true; break; + case IDX_LOOPBACK: user_options->loopback = true; break; + case IDX_SESSION: user_options->session = optarg; break; + case IDX_HASH_MODE: user_options->hash_mode = atoi (optarg); + user_options->hash_mode_chgd = true; break; + case IDX_RUNTIME: user_options->runtime = atoi (optarg); + user_options->runtime_chgd = true; break; + case IDX_ATTACK_MODE: user_options->attack_mode = atoi (optarg); + user_options->attack_mode_chgd = true; break; + case IDX_RP_FILE: user_options->rp_files[user_options->rp_files_cnt++] + = optarg; break; + case IDX_RP_GEN: user_options->rp_gen = atoi (optarg); break; + case IDX_RP_GEN_FUNC_MIN: user_options->rp_gen_func_min = atoi (optarg); break; + case IDX_RP_GEN_FUNC_MAX: user_options->rp_gen_func_max = atoi (optarg); break; + case IDX_RP_GEN_SEED: user_options->rp_gen_seed = atoi (optarg); + user_options->rp_gen_seed_chgd = true; break; + case IDX_RULE_BUF_L: user_options->rule_buf_l = optarg; break; + case IDX_RULE_BUF_R: user_options->rule_buf_r = optarg; break; + case IDX_MARKOV_DISABLE: user_options->markov_disable = true; break; + case IDX_MARKOV_CLASSIC: user_options->markov_classic = true; break; + case IDX_MARKOV_THRESHOLD: user_options->markov_threshold = atoi (optarg); break; + case IDX_MARKOV_HCSTAT: user_options->markov_hcstat = optarg; break; + case IDX_OUTFILE: user_options->outfile = optarg; break; + case IDX_OUTFILE_FORMAT: user_options->outfile_format = atoi (optarg); + user_options->outfile_format_chgd = true; break; + case IDX_OUTFILE_AUTOHEX_DISABLE: user_options->outfile_autohex = false; break; + case IDX_OUTFILE_CHECK_TIMER: user_options->outfile_check_timer = atoi (optarg); break; + case IDX_WORDLIST_AUTOHEX_DISABLE: user_options->wordlist_autohex_disable = true; break; + case IDX_HEX_CHARSET: user_options->hex_charset = true; break; + case IDX_HEX_SALT: user_options->hex_salt = true; break; + case IDX_HEX_WORDLIST: user_options->hex_wordlist = true; break; + case IDX_CPU_AFFINITY: user_options->cpu_affinity = optarg; break; + case IDX_OPENCL_INFO: user_options->opencl_info = true; break; + case IDX_OPENCL_DEVICES: user_options->opencl_devices = optarg; break; + case IDX_OPENCL_PLATFORMS: user_options->opencl_platforms = optarg; break; + case IDX_OPENCL_DEVICE_TYPES: user_options->opencl_device_types = optarg; break; + case IDX_OPENCL_VECTOR_WIDTH: user_options->opencl_vector_width = atoi (optarg); + user_options->opencl_vector_width_chgd = true; break; + case IDX_OPTIMIZED_KERNEL_ENABLE: user_options->optimized_kernel_enable = true; break; + case IDX_WORKLOAD_PROFILE: user_options->workload_profile = atoi (optarg); + user_options->workload_profile_chgd = true; break; + case IDX_KERNEL_ACCEL: user_options->kernel_accel = atoi (optarg); + user_options->kernel_accel_chgd = true; break; + case IDX_KERNEL_LOOPS: user_options->kernel_loops = atoi (optarg); + user_options->kernel_loops_chgd = true; break; + case IDX_NVIDIA_SPIN_DAMP: user_options->nvidia_spin_damp = atoi (optarg); + user_options->nvidia_spin_damp_chgd = true; break; + case IDX_GPU_TEMP_DISABLE: user_options->gpu_temp_disable = true; break; + case IDX_GPU_TEMP_ABORT: user_options->gpu_temp_abort = atoi (optarg); break; + case IDX_GPU_TEMP_RETAIN: user_options->gpu_temp_retain = atoi (optarg); break; + case IDX_POWERTUNE_ENABLE: user_options->powertune_enable = true; break; + case IDX_LOGFILE_DISABLE: user_options->logfile_disable = true; break; + case IDX_HCCAPX_MESSAGE_PAIR: user_options->hccapx_message_pair = atoi (optarg); + user_options->hccapx_message_pair_chgd = true; break; + case IDX_NONCE_ERROR_CORRECTIONS: user_options->nonce_error_corrections = atoi (optarg); break; + case IDX_TRUECRYPT_KEYFILES: user_options->truecrypt_keyfiles = optarg; break; + case IDX_VERACRYPT_KEYFILES: user_options->veracrypt_keyfiles = optarg; break; + case IDX_VERACRYPT_PIM: user_options->veracrypt_pim = atoi (optarg); break; + case IDX_SEGMENT_SIZE: user_options->segment_size = atoi (optarg); + user_options->segment_size_chgd = true; break; + case IDX_SCRYPT_TMTO: user_options->scrypt_tmto = atoi (optarg); break; + case IDX_SEPARATOR: user_options->separator = optarg[0]; break; + case IDX_BITMAP_MIN: user_options->bitmap_min = atoi (optarg); break; + case IDX_BITMAP_MAX: user_options->bitmap_max = atoi (optarg); break; + case IDX_INCREMENT: user_options->increment = true; break; + case IDX_INCREMENT_MIN: user_options->increment_min = atoi (optarg); + user_options->increment_min_chgd = true; break; + case IDX_INCREMENT_MAX: user_options->increment_max = atoi (optarg); + user_options->increment_max_chgd = true; break; + case IDX_CUSTOM_CHARSET_1: user_options->custom_charset_1 = optarg; break; + case IDX_CUSTOM_CHARSET_2: user_options->custom_charset_2 = optarg; break; + case IDX_CUSTOM_CHARSET_3: user_options->custom_charset_3 = optarg; break; + case IDX_CUSTOM_CHARSET_4: user_options->custom_charset_4 = optarg; break; } }