1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 01:50:10 +00:00

Fixed missing call to WSACleanup() to cleanly shutdown windows sockets system

This commit is contained in:
Jens Steube 2018-11-01 11:09:37 +01:00
parent a722b43351
commit 3b8abb7f0d
4 changed files with 36 additions and 19 deletions

View File

@ -27,6 +27,7 @@
##
- Fixed missing call to WSAStartup() and client indexing in order to start the brain server on windows
- Fixed missing call to WSACleanup() to cleanly shutdown windows sockets system
- Fixed endianness and invalid separator character in outfile format of hash-mode 16801 (WPA-PMKID-PMK)
* changes v4.2.1 -> v5.0.0

View File

@ -3286,5 +3286,9 @@ int brain_server (const char *listen_host, const int listen_port, const char *br
close (server_fd);
#if defined (_WIN)
WSACleanup();
#endif
return 0;
}

View File

@ -1026,6 +1026,28 @@ int hashcat_session_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder
user_options_postprocess (hashcat_ctx);
/**
* windows and sockets...
*/
#if defined (_WIN)
if (user_options->brain_client == true)
{
WSADATA wsaData;
WORD wVersionRequested = MAKEWORD (2,2);
const int iResult = WSAStartup (wVersionRequested, &wsaData);
if (iResult != NO_ERROR)
{
fprintf (stderr, "WSAStartup: %s\n", strerror (errno));
return -1;
}
}
#endif
/**
* logfile
*/
@ -1292,6 +1314,15 @@ int hashcat_session_quit (hashcat_ctx_t *hashcat_ctx)
int hashcat_session_destroy (hashcat_ctx_t *hashcat_ctx)
{
#if defined (_WIN)
user_options_t *user_options = hashcat_ctx->user_options;
if (user_options->brain_client == true)
{
WSACleanup();
}
#endif
debugfile_destroy (hashcat_ctx);
dictstat_destroy (hashcat_ctx);
folder_config_destroy (hashcat_ctx);

View File

@ -1894,25 +1894,6 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx)
// brain
#ifdef WITH_BRAIN
#if defined (_WIN)
if (user_options->brain_client == true)
{
WSADATA wsaData;
WORD wVersionRequested = MAKEWORD (2,2);
const int iResult = WSAStartup (wVersionRequested, &wsaData);
if (iResult != NO_ERROR)
{
fprintf (stderr, "WSAStartup: %s\n", strerror (errno));
return -1;
}
}
#endif
if (user_options->brain_host)
{
struct addrinfo hints;