int outcheck_ctx_init (hashcat_ctx_t *hashcat_ctx) { folder_config_t *folder_config = hashcat_ctx->folder_config; outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx; user_options_t *user_options = hashcat_ctx->user_options; outcheck_ctx->enabled = false; if (user_options->keyspace == true) return 0; if (user_options->benchmark == true) return 0; if (user_options->speed_only == true) return 0; if (user_options->opencl_info == true) return 0; if (user_options->outfile_check_timer == 0) return 0; if ((user_options->hash_mode == 5200) || ((user_options->hash_mode >= 6200) && (user_options->hash_mode <= 6299)) || ((user_options->hash_mode >= 13700) && (user_options->hash_mode <= 13799)) || (user_options->hash_mode == 9000)) return 0; if (user_options->outfile_check_dir == NULL) { outcheck_ctx->root_directory = (char *) hcmalloc (HCBUFSIZ_TINY); snprintf (outcheck_ctx->root_directory, HCBUFSIZ_TINY - 1, "%s/%s.%s", folder_config->session_dir, user_options->session, OUTFILES_DIR); } else { outcheck_ctx->root_directory = user_options->outfile_check_dir; } hc_stat_t outfile_check_stat; if (hc_stat (outcheck_ctx->root_directory, &outfile_check_stat) == 0) { const u32 is_dir = S_ISDIR (outfile_check_stat.st_mode); if (is_dir == 0) { event_log_error (hashcat_ctx, "Directory specified in outfile-check '%s' is not a valid directory", outcheck_ctx->root_directory); return -1; } } else { if (hc_mkdir (outcheck_ctx->root_directory, 0700) == -1) { event_log_error (hashcat_ctx, "%s: %m", outcheck_ctx->root_directory); return -1; } } outcheck_ctx->enabled = true; return 0; }
int outcheck_ctx_init (hashcat_ctx_t *hashcat_ctx) { folder_config_t *folder_config = hashcat_ctx->folder_config; outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx; user_options_t *user_options = hashcat_ctx->user_options; outcheck_ctx->enabled = false; if (user_options->keyspace == true) return 0; if (user_options->benchmark == true) return 0; if (user_options->example_hashes == true) return 0; if (user_options->speed_only == true) return 0; if (user_options->progress_only == true) return 0; if (user_options->opencl_info == true) return 0; if (user_options->outfile_check_timer == 0) return 0; if ((user_options->hash_mode == 5200) || ((user_options->hash_mode >= 6200) && (user_options->hash_mode <= 6299)) || ((user_options->hash_mode >= 13700) && (user_options->hash_mode <= 13799)) || (user_options->hash_mode == 9000)) return 0; if (user_options->outfile_check_dir == NULL) { hc_asprintf (&outcheck_ctx->root_directory, "%s/%s.%s", folder_config->session_dir, user_options->session, OUTFILES_DIR); } else { outcheck_ctx->root_directory = user_options->outfile_check_dir; } outcheck_ctx->enabled = true; if (hc_path_exist (outcheck_ctx->root_directory) == false) { if (hc_mkdir (outcheck_ctx->root_directory, 0700) == -1) { event_log_error (hashcat_ctx, "%s: %s", outcheck_ctx->root_directory, strerror (errno)); return -1; } } return 0; }