mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-23 00:28:11 +00:00
Get rid of exit() in hashcat.c
This commit is contained in:
parent
690ca0219e
commit
62284f79b1
@ -8,7 +8,7 @@
|
||||
|
||||
int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_folder, int argc, char **argv, const int comptime);
|
||||
|
||||
void hashcat_ctx_init (hashcat_ctx_t *hashcat_ctx, void (*event) (const u32, struct hashcat_ctx *, const void *, const size_t));
|
||||
int hashcat_ctx_init (hashcat_ctx_t *hashcat_ctx, void (*event) (const u32, struct hashcat_ctx *, const void *, const size_t));
|
||||
void hashcat_ctx_destroy (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
#endif // _HASHCAT_H
|
||||
|
@ -55,13 +55,13 @@
|
||||
extern const u32 DEFAULT_BENCHMARK_ALGORITHMS_CNT;
|
||||
extern const u32 DEFAULT_BENCHMARK_ALGORITHMS_BUF[];
|
||||
|
||||
void hashcat_ctx_init (hashcat_ctx_t *hashcat_ctx, void (*event) (const u32, struct hashcat_ctx *, const void *, const size_t))
|
||||
int hashcat_ctx_init (hashcat_ctx_t *hashcat_ctx, void (*event) (const u32, struct hashcat_ctx *, const void *, const size_t))
|
||||
{
|
||||
if (event == NULL)
|
||||
{
|
||||
fprintf (stderr, "Event callback function is mandatory\n");
|
||||
|
||||
exit (-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
hashcat_ctx->event = event;
|
||||
@ -92,6 +92,8 @@ void hashcat_ctx_init (hashcat_ctx_t *hashcat_ctx, void (*event) (const u32, str
|
||||
hashcat_ctx->user_options_extra = (user_options_extra_t *) hcmalloc (hashcat_ctx, sizeof (user_options_extra_t));
|
||||
hashcat_ctx->user_options = (user_options_t *) hcmalloc (hashcat_ctx, sizeof (user_options_t));
|
||||
hashcat_ctx->wl_data = (wl_data_t *) hcmalloc (hashcat_ctx, sizeof (wl_data_t));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hashcat_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
|
||||
|
@ -489,7 +489,9 @@ int main (int argc, char **argv)
|
||||
|
||||
hashcat_ctx_t *hashcat_ctx = (hashcat_ctx_t *) malloc (sizeof (hashcat_ctx_t));
|
||||
|
||||
hashcat_ctx_init (hashcat_ctx, event);
|
||||
const int rc_hashcat_init = hashcat_ctx_init (hashcat_ctx, event);
|
||||
|
||||
if (rc_hashcat_init == -1) return -1;
|
||||
|
||||
// initialize the session via getops for commandline use or
|
||||
// alternatively you can set the user_options directly
|
||||
|
Loading…
Reference in New Issue
Block a user