2016-09-06 11:16:38 +00:00
/**
2016-09-11 20:20:15 +00:00
* Author . . . . . . : See docs / credits . txt
2016-09-06 11:16:38 +00:00
* License . . . . . : MIT
*/
# include "common.h"
2016-09-15 02:21:41 +00:00
# include "types.h"
2016-10-17 21:49:44 +00:00
# include "memory.h"
2016-10-12 12:17:30 +00:00
# include "event.h"
2016-10-16 17:32:43 +00:00
# include "convert.h"
2016-09-20 11:18:47 +00:00
# include "thread.h"
2016-09-15 02:21:41 +00:00
# include "status.h"
2016-09-20 10:32:39 +00:00
# include "shared.h"
2016-10-16 17:32:43 +00:00
# include "hwmon.h"
# include "interface.h"
2016-10-17 21:49:44 +00:00
# include "hashcat.h"
2021-07-01 19:33:14 +00:00
# include "timer.h"
2019-03-31 15:39:00 +00:00
# include "terminal.h"
2016-09-06 11:16:38 +00:00
2017-03-24 09:45:40 +00:00
static const size_t TERMINAL_LINE_LENGTH = 79 ;
2021-05-05 20:53:04 +00:00
static const char * PROMPT_ACTIVE = " [s]tatus [p]ause [b]ypass [c]heckpoint [f]inish [q]uit => " ;
static const char * PROMPT_PAUSED = " [s]tatus [r]esume [b]ypass [c]heckpoint [f]inish [q]uit => " ;
2016-09-11 08:28:59 +00:00
2016-10-23 15:31:22 +00:00
void welcome_screen ( hashcat_ctx_t * hashcat_ctx , const char * version_tag )
2016-09-28 21:53:46 +00:00
{
2016-10-23 15:31:22 +00:00
const user_options_t * user_options = hashcat_ctx - > user_options ;
2016-10-06 18:57:29 +00:00
2016-09-28 21:53:46 +00:00
if ( user_options - > quiet = = true ) return ;
if ( user_options - > keyspace = = true ) return ;
if ( user_options - > stdout_flag = = true ) return ;
if ( user_options - > show = = true ) return ;
if ( user_options - > left = = true ) return ;
2021-06-12 08:47:48 +00:00
if ( user_options - > identify = = true ) return ;
2016-09-28 21:53:46 +00:00
2021-06-19 10:32:02 +00:00
if ( user_options - > usage = = true )
{
2021-06-22 09:37:59 +00:00
event_log_info ( hashcat_ctx , " %s (%s) starting in help mode " , PROGNAME , version_tag ) ;
2021-06-19 10:32:02 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
}
else if ( user_options - > benchmark = = true )
2016-09-28 21:53:46 +00:00
{
if ( user_options - > machine_readable = = false )
{
2021-06-22 09:37:59 +00:00
event_log_info ( hashcat_ctx , " %s (%s) starting in benchmark mode " , PROGNAME , version_tag ) ;
2017-10-14 10:54:34 +00:00
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2017-07-19 13:33:19 +00:00
if ( user_options - > workload_profile_chgd = = false )
{
2017-07-19 14:08:37 +00:00
event_log_advice ( hashcat_ctx , " Benchmarking uses hand-optimized kernel code by default. " ) ;
2017-07-19 13:33:19 +00:00
event_log_advice ( hashcat_ctx , " You can use it in your cracking session by setting the -O option. " ) ;
2017-07-19 14:08:37 +00:00
event_log_advice ( hashcat_ctx , " Note: Using optimized kernel code limits the maximum supported password length. " ) ;
event_log_advice ( hashcat_ctx , " To disable the optimized kernel code in benchmark mode, use the -w option. " ) ;
2017-07-19 13:33:19 +00:00
event_log_advice ( hashcat_ctx , NULL ) ;
}
2016-09-28 21:53:46 +00:00
}
else
{
2017-10-14 10:54:34 +00:00
event_log_info ( hashcat_ctx , " # version: %s " , version_tag ) ;
2016-09-28 21:53:46 +00:00
}
}
else if ( user_options - > restore = = true )
{
2021-06-22 09:37:59 +00:00
event_log_info ( hashcat_ctx , " %s (%s) starting in restore mode " , PROGNAME , version_tag ) ;
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-10-14 19:38:52 +00:00
}
else if ( user_options - > speed_only = = true )
{
2021-06-22 09:37:59 +00:00
event_log_info ( hashcat_ctx , " %s (%s) starting in speed-only mode " , PROGNAME , version_tag ) ;
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-09-28 21:53:46 +00:00
}
2016-12-09 22:44:43 +00:00
else if ( user_options - > progress_only = = true )
{
2021-06-22 09:37:59 +00:00
event_log_info ( hashcat_ctx , " %s (%s) starting in progress-only mode " , PROGNAME , version_tag ) ;
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-12-09 22:44:43 +00:00
}
2021-06-09 11:25:25 +00:00
else if ( user_options - > backend_info = = true )
{
2021-06-22 09:37:59 +00:00
event_log_info ( hashcat_ctx , " %s (%s) starting in backend information mode " , PROGNAME , version_tag ) ;
2021-06-09 11:25:25 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
}
else if ( user_options - > hash_mode_chgd = = false )
2021-06-05 20:11:18 +00:00
{
2021-06-22 09:37:59 +00:00
event_log_info ( hashcat_ctx , " %s (%s) starting in autodetect mode " , PROGNAME , version_tag ) ;
2021-06-19 10:32:02 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
}
else if ( user_options - > hash_info = = true )
{
2021-06-22 09:37:59 +00:00
event_log_info ( hashcat_ctx , " %s (%s) starting in hash-info mode " , PROGNAME , version_tag ) ;
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-12-09 22:44:43 +00:00
}
2016-09-28 21:53:46 +00:00
else
{
2021-06-22 09:37:59 +00:00
event_log_info ( hashcat_ctx , " %s (%s) starting " , PROGNAME , version_tag ) ;
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-09-28 21:53:46 +00:00
}
2019-07-10 14:55:50 +00:00
2019-05-10 11:43:50 +00:00
if ( user_options - > force = = true )
{
event_log_warning ( hashcat_ctx , " You have enabled --force to bypass dangerous warnings and errors! " ) ;
event_log_warning ( hashcat_ctx , " This can hide serious problems and should only be done when debugging. " ) ;
event_log_warning ( hashcat_ctx , " Do not report hashcat issues encountered when using --force. " ) ;
2021-06-28 21:09:41 +00:00
event_log_warning ( hashcat_ctx , NULL ) ;
2019-05-10 11:43:50 +00:00
}
2016-09-28 21:53:46 +00:00
}
2017-12-10 00:40:45 +00:00
void goodbye_screen ( hashcat_ctx_t * hashcat_ctx , const time_t proc_start , const time_t proc_stop )
2016-09-28 21:53:46 +00:00
{
2016-10-06 18:57:29 +00:00
const user_options_t * user_options = hashcat_ctx - > user_options ;
2016-09-28 21:53:46 +00:00
if ( user_options - > quiet = = true ) return ;
if ( user_options - > keyspace = = true ) return ;
if ( user_options - > stdout_flag = = true ) return ;
if ( user_options - > show = = true ) return ;
if ( user_options - > left = = true ) return ;
2021-06-12 08:47:48 +00:00
if ( user_options - > identify = = true ) return ;
2016-09-28 21:53:46 +00:00
2017-01-27 15:29:18 +00:00
char start_buf [ 32 ] ; memset ( start_buf , 0 , sizeof ( start_buf ) ) ;
char stop_buf [ 32 ] ; memset ( start_buf , 0 , sizeof ( stop_buf ) ) ;
2016-12-03 05:32:18 +00:00
2017-12-11 21:44:58 +00:00
event_log_info_nn ( hashcat_ctx , " Started: %s " , ctime_r ( & proc_start , start_buf ) ) ;
event_log_info_nn ( hashcat_ctx , " Stopped: %s " , ctime_r ( & proc_stop , stop_buf ) ) ;
2016-09-28 21:53:46 +00:00
}
2016-10-23 15:31:22 +00:00
int setup_console ( )
2016-09-28 21:40:16 +00:00
{
# if defined (_WIN)
SetConsoleWindowSize ( 132 ) ;
if ( _setmode ( _fileno ( stdin ) , _O_BINARY ) = = - 1 )
{
2016-12-17 01:30:03 +00:00
__mingw_fprintf ( stderr , " %s: %m " , " stdin " ) ;
2016-09-28 21:40:16 +00:00
return - 1 ;
}
if ( _setmode ( _fileno ( stdout ) , _O_BINARY ) = = - 1 )
{
2019-07-10 14:55:50 +00:00
__mingw_fprintf ( stderr , " %s: %m " , " stdin " ) ; // stdout ?
2016-09-28 21:40:16 +00:00
return - 1 ;
}
if ( _setmode ( _fileno ( stderr ) , _O_BINARY ) = = - 1 )
{
2019-07-10 14:55:50 +00:00
__mingw_fprintf ( stderr , " %s: %m " , " stdin " ) ; // stderr ?
2016-09-28 21:40:16 +00:00
return - 1 ;
}
# endif
return 0 ;
}
2017-11-26 09:50:22 +00:00
void send_prompt ( hashcat_ctx_t * hashcat_ctx )
2016-09-11 08:39:19 +00:00
{
2017-11-26 09:50:22 +00:00
const status_ctx_t * status_ctx = hashcat_ctx - > status_ctx ;
if ( status_ctx - > devices_status = = STATUS_PAUSED )
{
fprintf ( stdout , " %s " , PROMPT_PAUSED ) ;
}
else
{
fprintf ( stdout , " %s " , PROMPT_ACTIVE ) ;
}
2016-09-11 08:39:19 +00:00
fflush ( stdout ) ;
}
2017-11-26 09:50:22 +00:00
void clear_prompt ( hashcat_ctx_t * hashcat_ctx )
2016-09-11 08:39:19 +00:00
{
2017-11-26 09:50:22 +00:00
const status_ctx_t * status_ctx = hashcat_ctx - > status_ctx ;
size_t prompt_sz = 0 ;
if ( status_ctx - > devices_status = = STATUS_PAUSED )
{
prompt_sz = strlen ( PROMPT_PAUSED ) ;
}
else
{
prompt_sz = strlen ( PROMPT_ACTIVE ) ;
}
2016-09-11 08:39:19 +00:00
fputc ( ' \r ' , stdout ) ;
2017-11-26 09:50:22 +00:00
for ( size_t i = 0 ; i < prompt_sz ; i + + )
2016-09-11 08:39:19 +00:00
{
fputc ( ' ' , stdout ) ;
}
fputc ( ' \r ' , stdout ) ;
fflush ( stdout ) ;
}
2016-09-30 20:52:44 +00:00
static void keypress ( hashcat_ctx_t * hashcat_ctx )
2016-09-15 02:21:41 +00:00
{
2016-10-06 14:34:30 +00:00
status_ctx_t * status_ctx = hashcat_ctx - > status_ctx ;
user_options_t * user_options = hashcat_ctx - > user_options ;
2016-09-20 10:32:39 +00:00
2016-09-30 20:52:44 +00:00
// this is required, because some of the variables down there are not initialized at that point
2017-09-23 20:02:34 +00:00
while ( status_ctx - > devices_status = = STATUS_INIT ) usleep ( 100000 ) ;
2016-09-20 10:32:39 +00:00
2016-09-24 23:02:44 +00:00
const bool quiet = user_options - > quiet ;
2016-09-15 02:21:41 +00:00
2016-09-20 10:32:39 +00:00
tty_break ( ) ;
2016-09-15 02:21:41 +00:00
2016-09-29 21:49:33 +00:00
while ( status_ctx - > shutdown_outer = = false )
2016-09-15 02:21:41 +00:00
{
2016-09-20 10:32:39 +00:00
int ch = tty_getchar ( ) ;
2016-09-15 02:21:41 +00:00
if ( ch = = - 1 ) break ;
if ( ch = = 0 ) continue ;
//https://github.com/hashcat/hashcat/issues/302
//#if defined (_POSIX)
//if (ch != '\n')
//#endif
2016-09-29 22:04:12 +00:00
hc_thread_mutex_lock ( status_ctx - > mux_display ) ;
2016-09-15 02:21:41 +00:00
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-09-15 02:21:41 +00:00
switch ( ch )
{
case ' s ' :
case ' \r ' :
case ' \n ' :
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-09-15 02:21:41 +00:00
2016-10-04 14:35:24 +00:00
status_display ( hashcat_ctx ) ;
2016-09-15 02:21:41 +00:00
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-09-15 02:21:41 +00:00
2017-11-26 09:50:22 +00:00
if ( quiet = = false ) send_prompt ( hashcat_ctx ) ;
2016-09-15 02:21:41 +00:00
break ;
case ' b ' :
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-09-15 02:21:41 +00:00
2016-10-09 20:41:55 +00:00
bypass ( hashcat_ctx ) ;
2016-09-15 02:21:41 +00:00
2017-04-02 07:50:06 +00:00
event_log_info ( hashcat_ctx , " Next dictionary / mask in queue selected. Bypassing current one. " ) ;
2016-10-09 20:41:55 +00:00
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-09-15 02:21:41 +00:00
2017-11-26 09:50:22 +00:00
if ( quiet = = false ) send_prompt ( hashcat_ctx ) ;
2016-09-15 02:21:41 +00:00
break ;
case ' p ' :
2017-11-26 09:50:22 +00:00
if ( status_ctx - > devices_status ! = STATUS_PAUSED )
{
event_log_info ( hashcat_ctx , NULL ) ;
2016-10-09 20:41:55 +00:00
2021-07-01 19:33:14 +00:00
time_t now ;
time ( & now ) ;
2017-11-26 09:50:22 +00:00
SuspendThreads ( hashcat_ctx ) ;
2016-09-15 02:21:41 +00:00
2017-11-26 09:50:22 +00:00
if ( status_ctx - > devices_status = = STATUS_PAUSED )
{
2021-07-01 19:33:14 +00:00
char buf [ 32 ] = { 0 } ;
char * pause_time = ctime_r ( & now , buf ) ;
const size_t pause_time_len = strlen ( pause_time ) ;
if ( pause_time [ pause_time_len - 1 ] = = ' \n ' ) pause_time [ pause_time_len - 1 ] = 0 ;
if ( pause_time [ pause_time_len - 2 ] = = ' \r ' ) pause_time [ pause_time_len - 2 ] = 0 ;
event_log_info ( hashcat_ctx , " Paused at %s " , pause_time ) ;
2017-11-26 09:50:22 +00:00
}
2016-09-15 02:21:41 +00:00
2017-11-26 09:50:22 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
}
2016-09-15 02:21:41 +00:00
2017-11-26 09:50:22 +00:00
if ( quiet = = false ) send_prompt ( hashcat_ctx ) ;
2016-09-15 02:21:41 +00:00
break ;
case ' r ' :
2017-11-26 09:50:22 +00:00
if ( status_ctx - > devices_status = = STATUS_PAUSED )
{
event_log_info ( hashcat_ctx , NULL ) ;
2016-10-09 20:41:55 +00:00
2021-07-01 19:33:14 +00:00
time_t now ;
time ( & now ) ;
const double msec_paused = hc_timer_get ( status_ctx - > timer_paused ) ;
2017-11-26 09:50:22 +00:00
ResumeThreads ( hashcat_ctx ) ;
2016-09-15 02:21:41 +00:00
2017-11-26 09:50:22 +00:00
if ( status_ctx - > devices_status ! = STATUS_PAUSED )
{
2021-07-01 19:33:14 +00:00
char buf [ 32 ] = { 0 } ;
char * resume_time = ctime_r ( & now , buf ) ;
const size_t resume_time_len = strlen ( resume_time ) ;
if ( resume_time [ resume_time_len - 1 ] = = ' \n ' ) resume_time [ resume_time_len - 1 ] = 0 ;
if ( resume_time [ resume_time_len - 2 ] = = ' \r ' ) resume_time [ resume_time_len - 2 ] = 0 ;
struct tm * tmp ;
struct tm tm ;
time_t sec_run = msec_paused / 1000 ;
tmp = gmtime_r ( & sec_run , & tm ) ;
char * display_pause = ( char * ) hcmalloc ( HCBUFSIZ_TINY ) ;
format_timer_display ( tmp , display_pause , HCBUFSIZ_TINY ) ;
event_log_info ( hashcat_ctx , " Resumed at %s (paused for %s) " , resume_time , display_pause ) ;
hcfree ( display_pause ) ;
2017-11-26 09:50:22 +00:00
}
2016-09-15 02:21:41 +00:00
2017-11-26 09:50:22 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
}
2016-09-15 02:21:41 +00:00
2017-11-26 09:50:22 +00:00
if ( quiet = = false ) send_prompt ( hashcat_ctx ) ;
2016-09-15 02:21:41 +00:00
break ;
case ' c ' :
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-09-15 02:21:41 +00:00
2016-10-06 14:34:30 +00:00
stop_at_checkpoint ( hashcat_ctx ) ;
2016-09-15 02:21:41 +00:00
2016-10-23 11:38:41 +00:00
if ( status_ctx - > checkpoint_shutdown = = true )
{
2017-04-02 07:50:06 +00:00
event_log_info ( hashcat_ctx , " Checkpoint enabled. Will quit at next restore-point update. " ) ;
2016-10-23 11:38:41 +00:00
}
else
{
2017-04-02 07:50:06 +00:00
event_log_info ( hashcat_ctx , " Checkpoint disabled. Restore-point updates will no longer be monitored. " ) ;
2016-10-23 11:38:41 +00:00
}
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-09-15 02:21:41 +00:00
2017-11-26 09:50:22 +00:00
if ( quiet = = false ) send_prompt ( hashcat_ctx ) ;
2016-09-15 02:21:41 +00:00
break ;
2021-05-05 20:53:04 +00:00
case ' f ' :
event_log_info ( hashcat_ctx , NULL ) ;
finish_after_attack ( hashcat_ctx ) ;
if ( status_ctx - > finish_shutdown = = true )
{
event_log_info ( hashcat_ctx , " Finish enabled. Will quit after this attack. " ) ;
}
else
{
event_log_info ( hashcat_ctx , " Finish disabled. Will continue after this attack. " ) ;
}
event_log_info ( hashcat_ctx , NULL ) ;
if ( quiet = = false ) send_prompt ( hashcat_ctx ) ;
break ;
2016-09-15 02:21:41 +00:00
case ' q ' :
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-09-15 02:21:41 +00:00
2016-10-16 17:32:43 +00:00
myquit ( hashcat_ctx ) ;
2016-09-15 02:21:41 +00:00
2017-11-26 09:50:22 +00:00
break ;
default :
if ( quiet = = false ) send_prompt ( hashcat_ctx ) ;
2016-09-15 02:21:41 +00:00
break ;
}
//https://github.com/hashcat/hashcat/issues/302
//#if defined (_POSIX)
//if (ch != '\n')
//#endif
2016-09-29 22:04:12 +00:00
hc_thread_mutex_unlock ( status_ctx - > mux_display ) ;
2016-09-15 02:21:41 +00:00
}
2016-09-20 10:32:39 +00:00
tty_fix ( ) ;
2016-09-30 20:52:44 +00:00
}
2018-09-18 21:37:30 +00:00
HC_API_CALL void * thread_keypress ( void * p )
2016-09-30 20:52:44 +00:00
{
hashcat_ctx_t * hashcat_ctx = ( hashcat_ctx_t * ) p ;
keypress ( hashcat_ctx ) ;
2016-09-15 02:21:41 +00:00
2016-09-30 20:52:44 +00:00
return NULL ;
2016-09-15 02:21:41 +00:00
}
2016-09-08 07:21:25 +00:00
# if defined (_WIN)
void SetConsoleWindowSize ( const int x )
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE ) ;
if ( h = = INVALID_HANDLE_VALUE ) return ;
CONSOLE_SCREEN_BUFFER_INFO bufferInfo ;
if ( ! GetConsoleScreenBufferInfo ( h , & bufferInfo ) ) return ;
SMALL_RECT * sr = & bufferInfo . srWindow ;
sr - > Right = MAX ( sr - > Right , x - 1 ) ;
COORD co ;
co . X = sr - > Right + 1 ;
co . Y = 9999 ;
if ( ! SetConsoleScreenBufferSize ( h , co ) ) return ;
if ( ! SetConsoleWindowInfo ( h , TRUE , sr ) ) return ;
}
# endif
2016-11-29 21:39:22 +00:00
# if defined (__linux__) || defined (__CYGWIN__)
2016-09-06 11:16:38 +00:00
static struct termios savemodes ;
static int havemodes = 0 ;
2020-06-13 09:19:00 +00:00
int tty_break ( )
2016-09-06 11:16:38 +00:00
{
struct termios modmodes ;
if ( tcgetattr ( fileno ( stdin ) , & savemodes ) < 0 ) return - 1 ;
havemodes = 1 ;
modmodes = savemodes ;
modmodes . c_lflag & = ~ ICANON ;
modmodes . c_cc [ VMIN ] = 1 ;
modmodes . c_cc [ VTIME ] = 0 ;
return tcsetattr ( fileno ( stdin ) , TCSANOW , & modmodes ) ;
}
2020-06-13 09:19:00 +00:00
int tty_getchar ( )
2016-09-06 11:16:38 +00:00
{
fd_set rfds ;
FD_ZERO ( & rfds ) ;
FD_SET ( fileno ( stdin ) , & rfds ) ;
struct timeval tv ;
tv . tv_sec = 1 ;
tv . tv_usec = 0 ;
int retval = select ( 1 , & rfds , NULL , NULL , & tv ) ;
if ( retval = = 0 ) return 0 ;
if ( retval = = - 1 ) return - 1 ;
return getchar ( ) ;
}
2020-06-13 09:19:00 +00:00
int tty_fix ( )
2016-09-06 11:16:38 +00:00
{
if ( ! havemodes ) return 0 ;
return tcsetattr ( fileno ( stdin ) , TCSADRAIN , & savemodes ) ;
}
# endif
2017-02-23 23:55:06 +00:00
# if defined (__APPLE__) || defined (__FreeBSD__)
2016-09-06 11:16:38 +00:00
static struct termios savemodes ;
static int havemodes = 0 ;
2020-06-13 09:19:00 +00:00
int tty_break ( )
2016-09-06 11:16:38 +00:00
{
struct termios modmodes ;
if ( ioctl ( fileno ( stdin ) , TIOCGETA , & savemodes ) < 0 ) return - 1 ;
havemodes = 1 ;
modmodes = savemodes ;
modmodes . c_lflag & = ~ ICANON ;
modmodes . c_cc [ VMIN ] = 1 ;
modmodes . c_cc [ VTIME ] = 0 ;
return ioctl ( fileno ( stdin ) , TIOCSETAW , & modmodes ) ;
}
2020-06-13 09:19:00 +00:00
int tty_getchar ( )
2016-09-06 11:16:38 +00:00
{
fd_set rfds ;
FD_ZERO ( & rfds ) ;
FD_SET ( fileno ( stdin ) , & rfds ) ;
struct timeval tv ;
tv . tv_sec = 1 ;
tv . tv_usec = 0 ;
int retval = select ( 1 , & rfds , NULL , NULL , & tv ) ;
if ( retval = = 0 ) return 0 ;
if ( retval = = - 1 ) return - 1 ;
return getchar ( ) ;
}
2020-06-13 09:19:00 +00:00
int tty_fix ( )
2016-09-06 11:16:38 +00:00
{
if ( ! havemodes ) return 0 ;
return ioctl ( fileno ( stdin ) , TIOCSETAW , & savemodes ) ;
}
# endif
2016-09-07 20:29:57 +00:00
# if defined (_WIN)
2016-09-06 11:16:38 +00:00
static DWORD saveMode = 0 ;
2020-06-13 09:19:00 +00:00
int tty_break ( )
2016-09-06 11:16:38 +00:00
{
HANDLE stdinHandle = GetStdHandle ( STD_INPUT_HANDLE ) ;
GetConsoleMode ( stdinHandle , & saveMode ) ;
SetConsoleMode ( stdinHandle , ENABLE_PROCESSED_INPUT ) ;
return 0 ;
}
2020-06-13 09:19:00 +00:00
int tty_getchar ( )
2016-09-06 11:16:38 +00:00
{
HANDLE stdinHandle = GetStdHandle ( STD_INPUT_HANDLE ) ;
DWORD rc = WaitForSingleObject ( stdinHandle , 1000 ) ;
if ( rc = = WAIT_TIMEOUT ) return 0 ;
if ( rc = = WAIT_ABANDONED ) return - 1 ;
if ( rc = = WAIT_FAILED ) return - 1 ;
// The whole ReadConsoleInput () part is a workaround.
// For some unknown reason, maybe a mingw bug, a random signal
// is sent to stdin which unblocks WaitForSingleObject () and sets rc 0.
// Then it wants to read with getche () a keyboard input
// which has never been made.
INPUT_RECORD buf [ 100 ] ;
DWORD num = 0 ;
memset ( buf , 0 , sizeof ( buf ) ) ;
ReadConsoleInput ( stdinHandle , buf , 100 , & num ) ;
FlushConsoleInputBuffer ( stdinHandle ) ;
for ( DWORD i = 0 ; i < num ; i + + )
{
if ( buf [ i ] . EventType ! = KEY_EVENT ) continue ;
KEY_EVENT_RECORD KeyEvent = buf [ i ] . Event . KeyEvent ;
if ( KeyEvent . bKeyDown ! = TRUE ) continue ;
return KeyEvent . uChar . AsciiChar ;
}
return 0 ;
}
2020-06-13 09:19:00 +00:00
int tty_fix ( )
2016-09-06 11:16:38 +00:00
{
HANDLE stdinHandle = GetStdHandle ( STD_INPUT_HANDLE ) ;
SetConsoleMode ( stdinHandle , saveMode ) ;
return 0 ;
}
# endif
2016-10-16 17:32:43 +00:00
2017-03-24 09:45:40 +00:00
void compress_terminal_line_length ( char * out_buf , const size_t keep_from_beginning , const size_t keep_from_end )
{
const size_t target_len = TERMINAL_LINE_LENGTH - keep_from_beginning ;
const size_t out_len = strlen ( out_buf ) ;
if ( out_len < target_len ) return ;
char * ptr1 = out_buf + target_len - 3 - keep_from_end ;
char * ptr2 = out_buf + out_len - keep_from_end ;
* ptr1 + + = ' . ' ;
* ptr1 + + = ' . ' ;
* ptr1 + + = ' . ' ;
for ( size_t i = 0 ; i < keep_from_end ; i + + )
{
* ptr1 + + = * ptr2 + + ;
}
* ptr1 = 0 ;
}
2021-07-22 16:54:02 +00:00
void hash_info_single ( hashcat_ctx_t * hashcat_ctx , user_options_extra_t * user_options_extra )
2017-08-22 09:09:46 +00:00
{
2020-12-29 03:58:58 +00:00
if ( hashconfig_init ( hashcat_ctx ) = = 0 )
2017-08-22 09:09:46 +00:00
{
2020-12-29 03:58:58 +00:00
hashconfig_t * hashconfig = hashcat_ctx - > hashconfig ;
event_log_info ( hashcat_ctx , " Hash mode #%u " , hashconfig - > hash_mode ) ;
event_log_info ( hashcat_ctx , " Name................: %s " , hashconfig - > hash_name ) ;
event_log_info ( hashcat_ctx , " Category............: %s " , strhashcategory ( hashconfig - > hash_category ) ) ;
2020-12-30 18:16:57 +00:00
event_log_info ( hashcat_ctx , " Slow.Hash...........: %s " , ( hashconfig - > attack_exec = = ATTACK_EXEC_INSIDE_KERNEL ) ? " No " : " Yes " ) ;
2020-12-29 03:58:58 +00:00
event_log_info ( hashcat_ctx , " Password.Len.Min....: %d " , hashconfig - > pw_min ) ;
event_log_info ( hashcat_ctx , " Password.Len.Max....: %d " , hashconfig - > pw_max ) ;
if ( hashconfig - > is_salted = = true )
2017-08-22 09:09:46 +00:00
{
2020-12-30 18:16:57 +00:00
u32 t = hashconfig - > salt_type ;
char * t_desc = ( t = = SALT_TYPE_EMBEDDED ) ? " Embedded \0 " : ( t = = SALT_TYPE_GENERIC ) ? " Generic \0 " : " Virtual \0 " ;
event_log_info ( hashcat_ctx , " Salt.Type...........: %s " , t_desc ) ;
2020-12-29 03:58:58 +00:00
event_log_info ( hashcat_ctx , " Salt.Len.Min........: %d " , hashconfig - > salt_min ) ;
event_log_info ( hashcat_ctx , " Salt.Len.Max........: %d " , hashconfig - > salt_max ) ;
}
2017-08-22 09:09:46 +00:00
2021-04-03 11:40:06 +00:00
// almost always 1 and -1
//event_log_info (hashcat_ctx, " Hashes.Count.Min....: %d", hashconfig->hashes_count_min);
//event_log_info (hashcat_ctx, " Hashes.Count.Max....: %u", hashconfig->hashes_count_max);
2017-08-22 09:09:46 +00:00
2021-04-03 11:40:06 +00:00
if ( ( hashconfig - > has_pure_kernel ) & & ( hashconfig - > has_optimized_kernel ) )
{
event_log_info ( hashcat_ctx , " Kernel.Type(s)......: pure, optimized " ) ;
}
else if ( hashconfig - > has_pure_kernel )
{
event_log_info ( hashcat_ctx , " Kernel.Type(s)......: pure " ) ;
}
else if ( hashconfig - > has_optimized_kernel )
{
event_log_info ( hashcat_ctx , " Kernel.Type(s)......: optimized " ) ;
}
2020-12-29 03:58:58 +00:00
if ( ( hashconfig - > st_hash ! = NULL ) & & ( hashconfig - > st_pass ! = NULL ) )
{
if ( hashconfig - > opts_type & OPTS_TYPE_BINARY_HASHFILE )
2017-08-22 09:09:46 +00:00
{
2020-12-29 03:58:58 +00:00
event_log_info ( hashcat_ctx , " Example.Hash.Format.: hex-encoded " ) ;
event_log_info ( hashcat_ctx , " Example.Hash........: %s " , hashconfig - > st_hash ) ;
}
else
{
event_log_info ( hashcat_ctx , " Example.Hash.Format.: plain " ) ;
event_log_info ( hashcat_ctx , " Example.Hash........: %s " , hashconfig - > st_hash ) ;
}
2017-08-22 13:52:41 +00:00
2021-07-22 16:54:02 +00:00
if ( need_hexify ( ( const u8 * ) hashconfig - > st_pass , strlen ( hashconfig - > st_pass ) , user_options_extra - > separator , false ) )
2020-12-29 03:58:58 +00:00
{
2021-06-30 19:01:55 +00:00
char * tmp_buf = ( char * ) hcmalloc ( HCBUFSIZ_LARGE ) ;
2017-08-22 13:52:41 +00:00
2020-12-29 03:58:58 +00:00
int tmp_len = 0 ;
2017-08-22 13:52:41 +00:00
2020-12-29 03:58:58 +00:00
tmp_buf [ tmp_len + + ] = ' $ ' ;
tmp_buf [ tmp_len + + ] = ' H ' ;
tmp_buf [ tmp_len + + ] = ' E ' ;
tmp_buf [ tmp_len + + ] = ' X ' ;
tmp_buf [ tmp_len + + ] = ' [ ' ;
2017-08-22 13:52:41 +00:00
2020-12-29 03:58:58 +00:00
exec_hexify ( ( const u8 * ) hashconfig - > st_pass , strlen ( hashconfig - > st_pass ) , ( u8 * ) tmp_buf + tmp_len ) ;
2017-08-22 13:52:41 +00:00
2020-12-29 03:58:58 +00:00
tmp_len + = strlen ( hashconfig - > st_pass ) * 2 ;
2017-08-22 13:52:41 +00:00
2020-12-29 03:58:58 +00:00
tmp_buf [ tmp_len + + ] = ' ] ' ;
tmp_buf [ tmp_len + + ] = 0 ;
2017-08-22 13:52:41 +00:00
2020-12-29 03:58:58 +00:00
event_log_info ( hashcat_ctx , " Example.Pass........: %s " , tmp_buf ) ;
2021-06-30 19:01:55 +00:00
hcfree ( tmp_buf ) ;
2017-08-22 09:09:46 +00:00
}
else
{
2020-12-29 03:58:58 +00:00
event_log_info ( hashcat_ctx , " Example.Pass........: %s " , hashconfig - > st_pass ) ;
2017-08-22 09:09:46 +00:00
}
2020-12-29 03:58:58 +00:00
}
else
{
event_log_info ( hashcat_ctx , " Example.Hash.Format.: N/A " ) ;
event_log_info ( hashcat_ctx , " Example.Hash........: N/A " ) ;
event_log_info ( hashcat_ctx , " Example.Pass........: N/A " ) ;
}
2017-08-22 09:09:46 +00:00
2020-12-29 03:58:58 +00:00
if ( hashconfig - > benchmark_mask ! = NULL )
{
event_log_info ( hashcat_ctx , " Benchmark.Mask......: %s " , hashconfig - > benchmark_mask ) ;
}
else
{
event_log_info ( hashcat_ctx , " Benchmark.Mask......: N/A " ) ;
2017-08-22 09:09:46 +00:00
}
2020-12-29 03:58:58 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
}
hashconfig_destroy ( hashcat_ctx ) ;
}
void hash_info ( hashcat_ctx_t * hashcat_ctx )
{
2021-07-22 16:54:02 +00:00
folder_config_t * folder_config = hashcat_ctx - > folder_config ;
user_options_t * user_options = hashcat_ctx - > user_options ;
user_options_extra_t * user_options_extra = hashcat_ctx - > user_options_extra ;
2020-12-29 03:58:58 +00:00
event_log_info ( hashcat_ctx , " Hash Info: " ) ;
event_log_info ( hashcat_ctx , " ========== " ) ;
event_log_info ( hashcat_ctx , NULL ) ;
if ( user_options - > hash_mode_chgd = = true )
{
2021-07-22 16:54:02 +00:00
hash_info_single ( hashcat_ctx , user_options_extra ) ;
2017-08-22 09:09:46 +00:00
}
else
{
2019-01-06 12:48:41 +00:00
char * modulefile = ( char * ) hcmalloc ( HCBUFSIZ_TINY ) ;
for ( int i = 0 ; i < MODULE_HASH_MODES_MAXIMUM ; i + + )
2017-08-22 09:09:46 +00:00
{
user_options - > hash_mode = i ;
2019-01-14 14:15:21 +00:00
module_filename ( folder_config , i , modulefile , HCBUFSIZ_TINY ) ;
2019-01-06 12:48:41 +00:00
if ( hc_path_exist ( modulefile ) = = false ) continue ;
2021-07-22 16:54:02 +00:00
hash_info_single ( hashcat_ctx , user_options_extra ) ;
2017-08-22 09:09:46 +00:00
}
2019-01-06 12:48:41 +00:00
hcfree ( modulefile ) ;
2017-08-22 09:09:46 +00:00
}
}
2019-05-01 13:52:56 +00:00
void backend_info ( hashcat_ctx_t * hashcat_ctx )
2016-10-25 14:40:06 +00:00
{
2019-04-25 12:45:17 +00:00
const backend_ctx_t * backend_ctx = hashcat_ctx - > backend_ctx ;
2016-10-25 14:40:06 +00:00
2019-04-30 11:38:44 +00:00
if ( backend_ctx - > cuda )
{
event_log_info ( hashcat_ctx , " CUDA Info: " ) ;
event_log_info ( hashcat_ctx , " ========== " ) ;
event_log_info ( hashcat_ctx , NULL ) ;
2016-10-25 14:40:06 +00:00
2019-04-30 11:38:44 +00:00
int cuda_devices_cnt = backend_ctx - > cuda_devices_cnt ;
int cuda_driver_version = backend_ctx - > cuda_driver_version ;
2016-10-25 14:40:06 +00:00
2019-04-30 14:24:13 +00:00
event_log_info ( hashcat_ctx , " CUDA.Version.: %d.%d " , cuda_driver_version / 1000 , ( cuda_driver_version % 100 ) / 10 ) ;
2019-04-30 11:38:44 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
for ( int cuda_devices_idx = 0 ; cuda_devices_idx < cuda_devices_cnt ; cuda_devices_idx + + )
{
const int backend_devices_idx = backend_ctx - > backend_device_from_cuda [ cuda_devices_idx ] ;
const hc_device_param_t * device_param = backend_ctx - > devices_param + backend_devices_idx ;
int device_id = device_param - > device_id ;
char * device_name = device_param - > device_name ;
u32 device_processors = device_param - > device_processors ;
u32 device_maxclock_frequency = device_param - > device_maxclock_frequency ;
2019-11-14 11:47:05 +00:00
u64 device_available_mem = device_param - > device_available_mem ;
2019-04-30 11:38:44 +00:00
u64 device_global_mem = device_param - > device_global_mem ;
2021-06-14 11:18:33 +00:00
u8 pcie_domain = device_param - > pcie_domain ;
u8 pcie_bus = device_param - > pcie_bus ;
u8 pcie_device = device_param - > pcie_device ;
2021-07-11 12:47:48 +00:00
u8 pcie_function = device_param - > pcie_function ;
if ( device_param - > device_id_alias_cnt )
{
event_log_info ( hashcat_ctx , " Backend Device ID #%d (Alias: #%d) " , device_id + 1 , device_param - > device_id_alias_buf [ 0 ] + 1 ) ;
}
else
{
event_log_info ( hashcat_ctx , " Backend Device ID #%d " , device_id + 1 ) ;
}
event_log_info ( hashcat_ctx , " Name...........: %s " , device_name ) ;
event_log_info ( hashcat_ctx , " Processor(s)...: %u " , device_processors ) ;
event_log_info ( hashcat_ctx , " Clock..........: %u " , device_maxclock_frequency ) ;
event_log_info ( hashcat_ctx , " Memory.Total...: % " PRIu64 " MB " , device_global_mem / 1024 / 1024 ) ;
event_log_info ( hashcat_ctx , " Memory.Free....: % " PRIu64 " MB " , device_available_mem / 1024 / 1024 ) ;
event_log_info ( hashcat_ctx , " PCI.Addr.BDFe..: %04x:%02x:%02x.%d " , ( u16 ) pcie_domain , pcie_bus , pcie_device , pcie_function ) ;
event_log_info ( hashcat_ctx , NULL ) ;
}
}
if ( backend_ctx - > hip )
{
event_log_info ( hashcat_ctx , " HIP Info: " ) ;
event_log_info ( hashcat_ctx , " ========= " ) ;
event_log_info ( hashcat_ctx , NULL ) ;
int hip_devices_cnt = backend_ctx - > hip_devices_cnt ;
int hip_driver_version = backend_ctx - > hip_driver_version ;
event_log_info ( hashcat_ctx , " HIP.Version.: %d.%d " , hip_driver_version / 1000 , ( hip_driver_version % 100 ) / 10 ) ;
event_log_info ( hashcat_ctx , NULL ) ;
for ( int hip_devices_idx = 0 ; hip_devices_idx < hip_devices_cnt ; hip_devices_idx + + )
{
const int backend_devices_idx = backend_ctx - > backend_device_from_hip [ hip_devices_idx ] ;
const hc_device_param_t * device_param = backend_ctx - > devices_param + backend_devices_idx ;
int device_id = device_param - > device_id ;
char * device_name = device_param - > device_name ;
u32 device_processors = device_param - > device_processors ;
u32 device_maxclock_frequency = device_param - > device_maxclock_frequency ;
u64 device_available_mem = device_param - > device_available_mem ;
u64 device_global_mem = device_param - > device_global_mem ;
u8 pcie_domain = device_param - > pcie_domain ;
u8 pcie_bus = device_param - > pcie_bus ;
u8 pcie_device = device_param - > pcie_device ;
2021-06-14 11:18:33 +00:00
u8 pcie_function = device_param - > pcie_function ;
2019-04-30 11:38:44 +00:00
2019-05-01 05:27:10 +00:00
if ( device_param - > device_id_alias_cnt )
{
2019-05-01 13:52:56 +00:00
event_log_info ( hashcat_ctx , " Backend Device ID #%d (Alias: #%d) " , device_id + 1 , device_param - > device_id_alias_buf [ 0 ] + 1 ) ;
2019-05-01 05:27:10 +00:00
}
else
{
event_log_info ( hashcat_ctx , " Backend Device ID #%d " , device_id + 1 ) ;
}
2019-04-30 14:24:13 +00:00
event_log_info ( hashcat_ctx , " Name...........: %s " , device_name ) ;
event_log_info ( hashcat_ctx , " Processor(s)...: %u " , device_processors ) ;
event_log_info ( hashcat_ctx , " Clock..........: %u " , device_maxclock_frequency ) ;
2019-11-14 11:47:05 +00:00
event_log_info ( hashcat_ctx , " Memory.Total...: % " PRIu64 " MB " , device_global_mem / 1024 / 1024 ) ;
event_log_info ( hashcat_ctx , " Memory.Free....: % " PRIu64 " MB " , device_available_mem / 1024 / 1024 ) ;
2021-06-14 11:18:33 +00:00
event_log_info ( hashcat_ctx , " PCI.Addr.BDFe..: %04x:%02x:%02x.%d " , ( u16 ) pcie_domain , pcie_bus , pcie_device , pcie_function ) ;
2019-04-30 11:38:44 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
}
}
if ( backend_ctx - > ocl )
2016-10-25 14:40:06 +00:00
{
2019-04-30 11:38:44 +00:00
event_log_info ( hashcat_ctx , " OpenCL Info: " ) ;
event_log_info ( hashcat_ctx , " ============ " ) ;
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-10-25 14:40:06 +00:00
2019-04-30 11:38:44 +00:00
cl_uint opencl_platforms_cnt = backend_ctx - > opencl_platforms_cnt ;
cl_uint * opencl_platforms_devices_cnt = backend_ctx - > opencl_platforms_devices_cnt ;
char * * opencl_platforms_name = backend_ctx - > opencl_platforms_name ;
char * * opencl_platforms_vendor = backend_ctx - > opencl_platforms_vendor ;
char * * opencl_platforms_version = backend_ctx - > opencl_platforms_version ;
for ( cl_uint opencl_platforms_idx = 0 ; opencl_platforms_idx < opencl_platforms_cnt ; opencl_platforms_idx + + )
2016-10-25 14:40:06 +00:00
{
2019-04-30 11:38:44 +00:00
char * opencl_platform_vendor = opencl_platforms_vendor [ opencl_platforms_idx ] ;
char * opencl_platform_name = opencl_platforms_name [ opencl_platforms_idx ] ;
char * opencl_platform_version = opencl_platforms_version [ opencl_platforms_idx ] ;
cl_uint opencl_platform_devices_cnt = opencl_platforms_devices_cnt [ opencl_platforms_idx ] ;
event_log_info ( hashcat_ctx , " OpenCL Platform ID #%u " , opencl_platforms_idx + 1 ) ;
event_log_info ( hashcat_ctx , " Vendor..: %s " , opencl_platform_vendor ) ;
event_log_info ( hashcat_ctx , " Name....: %s " , opencl_platform_name ) ;
event_log_info ( hashcat_ctx , " Version.: %s " , opencl_platform_version ) ;
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2019-04-30 11:38:44 +00:00
for ( cl_uint opencl_platform_devices_idx = 0 ; opencl_platform_devices_idx < opencl_platform_devices_cnt ; opencl_platform_devices_idx + + )
{
const int backend_devices_idx = backend_ctx - > backend_device_from_opencl_platform [ opencl_platforms_idx ] [ opencl_platform_devices_idx ] ;
const hc_device_param_t * device_param = backend_ctx - > devices_param + backend_devices_idx ;
int device_id = device_param - > device_id ;
char * device_name = device_param - > device_name ;
u32 device_processors = device_param - > device_processors ;
u32 device_maxclock_frequency = device_param - > device_maxclock_frequency ;
u64 device_maxmem_alloc = device_param - > device_maxmem_alloc ;
2019-11-14 11:47:05 +00:00
u64 device_available_mem = device_param - > device_available_mem ;
2019-04-30 11:38:44 +00:00
u64 device_global_mem = device_param - > device_global_mem ;
cl_device_type opencl_device_type = device_param - > opencl_device_type ;
cl_uint opencl_device_vendor_id = device_param - > opencl_device_vendor_id ;
char * opencl_device_vendor = device_param - > opencl_device_vendor ;
char * opencl_device_c_version = device_param - > opencl_device_c_version ;
char * opencl_device_version = device_param - > opencl_device_version ;
char * opencl_driver_version = device_param - > opencl_driver_version ;
2019-05-01 05:27:10 +00:00
if ( device_param - > device_id_alias_cnt )
{
2019-05-01 13:52:56 +00:00
event_log_info ( hashcat_ctx , " Backend Device ID #%d (Alias: #%d) " , device_id + 1 , device_param - > device_id_alias_buf [ 0 ] + 1 ) ;
2019-05-01 05:27:10 +00:00
}
else
{
event_log_info ( hashcat_ctx , " Backend Device ID #%d " , device_id + 1 ) ;
}
2019-04-30 11:38:44 +00:00
event_log_info ( hashcat_ctx , " Type...........: %s " , ( ( opencl_device_type & CL_DEVICE_TYPE_CPU ) ? " CPU " : ( ( opencl_device_type & CL_DEVICE_TYPE_GPU ) ? " GPU " : " Accelerator " ) ) ) ;
event_log_info ( hashcat_ctx , " Vendor.ID......: %u " , opencl_device_vendor_id ) ;
event_log_info ( hashcat_ctx , " Vendor.........: %s " , opencl_device_vendor ) ;
event_log_info ( hashcat_ctx , " Name...........: %s " , device_name ) ;
event_log_info ( hashcat_ctx , " Version........: %s " , opencl_device_version ) ;
event_log_info ( hashcat_ctx , " Processor(s)...: %u " , device_processors ) ;
event_log_info ( hashcat_ctx , " Clock..........: %u " , device_maxclock_frequency ) ;
2019-11-14 11:47:05 +00:00
event_log_info ( hashcat_ctx , " Memory.Total...: % " PRIu64 " MB (limited to % " PRIu64 " MB allocatable in one block) " , device_global_mem / 1024 / 1024 , device_maxmem_alloc / 1024 / 1024 ) ;
event_log_info ( hashcat_ctx , " Memory.Free....: % " PRIu64 " MB " , device_available_mem / 1024 / 1024 ) ;
2019-04-30 11:38:44 +00:00
event_log_info ( hashcat_ctx , " OpenCL.Version.: %s " , opencl_device_c_version ) ;
event_log_info ( hashcat_ctx , " Driver.Version.: %s " , opencl_driver_version ) ;
2021-06-14 11:18:33 +00:00
if ( device_param - > opencl_device_type & CL_DEVICE_TYPE_GPU )
{
u8 pcie_bus = device_param - > pcie_bus ;
u8 pcie_device = device_param - > pcie_device ;
u8 pcie_function = device_param - > pcie_function ;
if ( ( device_param - > opencl_platform_vendor_id = = VENDOR_ID_AMD ) & & ( device_param - > opencl_device_vendor_id = = VENDOR_ID_AMD ) )
{
event_log_info ( hashcat_ctx , " PCI.Addr.BDF...: %02x:%02x.%d " , pcie_bus , pcie_device , pcie_function ) ;
}
if ( ( device_param - > opencl_platform_vendor_id = = VENDOR_ID_NV ) & & ( device_param - > opencl_device_vendor_id = = VENDOR_ID_NV ) )
{
event_log_info ( hashcat_ctx , " PCI.Addr.BDF...: %02x:%02x.%d " , pcie_bus , pcie_device , pcie_function ) ;
}
}
2019-04-30 11:38:44 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
}
2016-10-25 14:40:06 +00:00
}
}
}
2019-05-01 13:52:56 +00:00
void backend_info_compact ( hashcat_ctx_t * hashcat_ctx )
2016-10-26 09:24:00 +00:00
{
2019-04-25 12:45:17 +00:00
const backend_ctx_t * backend_ctx = hashcat_ctx - > backend_ctx ;
2016-10-26 09:24:00 +00:00
const user_options_t * user_options = hashcat_ctx - > user_options ;
if ( user_options - > quiet = = true ) return ;
if ( user_options - > machine_readable = = true ) return ;
2019-03-27 10:09:24 +00:00
if ( user_options - > status_json = = true ) return ;
2016-10-26 09:24:00 +00:00
2021-07-11 13:54:13 +00:00
/**
* CUDA
*/
2019-04-30 14:24:13 +00:00
if ( backend_ctx - > cuda )
2016-10-26 09:24:00 +00:00
{
2019-04-30 14:24:13 +00:00
int cuda_devices_cnt = backend_ctx - > cuda_devices_cnt ;
int cuda_driver_version = backend_ctx - > cuda_driver_version ;
2016-10-26 09:24:00 +00:00
2019-04-30 14:24:13 +00:00
const size_t len = event_log_info ( hashcat_ctx , " CUDA API (CUDA %d.%d) " , cuda_driver_version / 1000 , ( cuda_driver_version % 100 ) / 10 ) ;
2016-10-26 09:24:00 +00:00
2019-07-10 14:55:50 +00:00
char line [ HCBUFSIZ_TINY ] = { 0 } ;
2016-10-26 09:24:00 +00:00
2019-04-30 14:24:13 +00:00
memset ( line , ' = ' , len ) ;
2016-10-26 09:24:00 +00:00
2019-04-30 14:24:13 +00:00
line [ len ] = 0 ;
2016-10-26 09:24:00 +00:00
2019-04-30 14:24:13 +00:00
event_log_info ( hashcat_ctx , " %s " , line ) ;
2016-10-26 09:24:00 +00:00
2019-04-30 14:24:13 +00:00
for ( int cuda_devices_idx = 0 ; cuda_devices_idx < cuda_devices_cnt ; cuda_devices_idx + + )
2016-10-26 09:24:00 +00:00
{
2019-04-30 14:24:13 +00:00
const int backend_devices_idx = backend_ctx - > backend_device_from_cuda [ cuda_devices_idx ] ;
2016-10-26 09:24:00 +00:00
2019-04-30 14:24:13 +00:00
const hc_device_param_t * device_param = backend_ctx - > devices_param + backend_devices_idx ;
2016-10-26 09:24:00 +00:00
2019-11-14 11:47:05 +00:00
int device_id = device_param - > device_id ;
char * device_name = device_param - > device_name ;
u32 device_processors = device_param - > device_processors ;
u64 device_global_mem = device_param - > device_global_mem ;
u64 device_available_mem = device_param - > device_available_mem ;
2016-10-26 09:24:00 +00:00
2019-03-04 09:29:57 +00:00
if ( ( device_param - > skipped = = false ) & & ( device_param - > skipped_warning = = false ) )
2016-10-26 09:24:00 +00:00
{
2019-11-14 11:47:05 +00:00
event_log_info ( hashcat_ctx , " * Device #%u: %s, % " PRIu64 " /% " PRIu64 " MB, %uMCU " ,
2019-04-30 14:24:13 +00:00
device_id + 1 ,
2016-10-26 09:24:00 +00:00
device_name ,
2019-11-14 11:47:05 +00:00
device_available_mem / 1024 / 1024 ,
device_global_mem / 1024 / 1024 ,
2016-10-31 08:19:37 +00:00
device_processors ) ;
2016-10-26 09:24:00 +00:00
}
else
{
2019-04-30 14:24:13 +00:00
event_log_info ( hashcat_ctx , " * Device #%u: %s, skipped " ,
device_id + 1 ,
2016-10-26 09:24:00 +00:00
device_name ) ;
}
}
2017-02-10 18:46:52 +00:00
event_log_info ( hashcat_ctx , NULL ) ;
2016-10-26 09:24:00 +00:00
}
2019-04-30 14:24:13 +00:00
2021-07-11 13:54:13 +00:00
/**
* HIP
*/
2021-07-09 03:50:40 +00:00
if ( backend_ctx - > hip )
{
int hip_devices_cnt = backend_ctx - > hip_devices_cnt ;
int hip_driver_version = backend_ctx - > hip_driver_version ;
const size_t len = event_log_info ( hashcat_ctx , " HIP API (HIP %d.%d) " , hip_driver_version / 1000 , ( hip_driver_version % 100 ) / 10 ) ;
char line [ HCBUFSIZ_TINY ] = { 0 } ;
memset ( line , ' = ' , len ) ;
line [ len ] = 0 ;
event_log_info ( hashcat_ctx , " %s " , line ) ;
for ( int hip_devices_idx = 0 ; hip_devices_idx < hip_devices_cnt ; hip_devices_idx + + )
{
const int backend_devices_idx = backend_ctx - > backend_device_from_hip [ hip_devices_idx ] ;
const hc_device_param_t * device_param = backend_ctx - > devices_param + backend_devices_idx ;
int device_id = device_param - > device_id ;
char * device_name = device_param - > device_name ;
u32 device_processors = device_param - > device_processors ;
u64 device_global_mem = device_param - > device_global_mem ;
u64 device_available_mem = device_param - > device_available_mem ;
if ( ( device_param - > skipped = = false ) & & ( device_param - > skipped_warning = = false ) )
{
event_log_info ( hashcat_ctx , " * Device #%u: %s, % " PRIu64 " /% " PRIu64 " MB, %uMCU " ,
device_id + 1 ,
device_name ,
device_available_mem / 1024 / 1024 ,
device_global_mem / 1024 / 1024 ,
device_processors ) ;
}
else
{
event_log_info ( hashcat_ctx , " * Device #%u: %s, skipped " ,
device_id + 1 ,
device_name ) ;
}
}
event_log_info ( hashcat_ctx , NULL ) ;
}
2021-07-11 13:54:13 +00:00
/**
* OpenCL
*/
2019-04-30 14:24:13 +00:00
if ( backend_ctx - > ocl )
{
cl_uint opencl_platforms_cnt = backend_ctx - > opencl_platforms_cnt ;
cl_uint * opencl_platforms_devices_cnt = backend_ctx - > opencl_platforms_devices_cnt ;
char * * opencl_platforms_vendor = backend_ctx - > opencl_platforms_vendor ;
char * * opencl_platforms_version = backend_ctx - > opencl_platforms_version ;
for ( cl_uint opencl_platforms_idx = 0 ; opencl_platforms_idx < opencl_platforms_cnt ; opencl_platforms_idx + + )
{
char * opencl_platform_vendor = opencl_platforms_vendor [ opencl_platforms_idx ] ;
char * opencl_platform_version = opencl_platforms_version [ opencl_platforms_idx ] ;
cl_uint opencl_platform_devices_cnt = opencl_platforms_devices_cnt [ opencl_platforms_idx ] ;
const size_t len = event_log_info ( hashcat_ctx , " OpenCL API (%s) - Platform #%u [%s] " , opencl_platform_version , opencl_platforms_idx + 1 , opencl_platform_vendor ) ;
2019-07-10 14:55:50 +00:00
char line [ HCBUFSIZ_TINY ] = { 0 } ;
2019-04-30 14:24:13 +00:00
memset ( line , ' = ' , len ) ;
line [ len ] = 0 ;
event_log_info ( hashcat_ctx , " %s " , line ) ;
for ( cl_uint opencl_platform_devices_idx = 0 ; opencl_platform_devices_idx < opencl_platform_devices_cnt ; opencl_platform_devices_idx + + )
{
const int backend_devices_idx = backend_ctx - > backend_device_from_opencl_platform [ opencl_platforms_idx ] [ opencl_platform_devices_idx ] ;
const hc_device_param_t * device_param = backend_ctx - > devices_param + backend_devices_idx ;
2019-11-14 11:47:05 +00:00
int device_id = device_param - > device_id ;
char * device_name = device_param - > device_name ;
u32 device_processors = device_param - > device_processors ;
u64 device_maxmem_alloc = device_param - > device_maxmem_alloc ;
u64 device_global_mem = device_param - > device_global_mem ;
u64 device_available_mem = device_param - > device_available_mem ;
2019-04-30 14:24:13 +00:00
if ( ( device_param - > skipped = = false ) & & ( device_param - > skipped_warning = = false ) )
{
2019-11-14 11:47:05 +00:00
event_log_info ( hashcat_ctx , " * Device #%u: %s, % " PRIu64 " /% " PRIu64 " MB (% " PRIu64 " MB allocatable), %uMCU " ,
2019-04-30 14:24:13 +00:00
device_id + 1 ,
device_name ,
2019-11-14 11:47:05 +00:00
device_available_mem / 1024 / 1024 ,
device_global_mem / 1024 / 1024 ,
device_maxmem_alloc / 1024 / 1024 ,
2019-04-30 14:24:13 +00:00
device_processors ) ;
}
else
{
event_log_info ( hashcat_ctx , " * Device #%u: %s, skipped " ,
device_id + 1 ,
device_name ) ;
}
}
event_log_info ( hashcat_ctx , NULL ) ;
}
}
2016-10-26 09:24:00 +00:00
}
2016-10-16 17:32:43 +00:00
void status_display_machine_readable ( hashcat_ctx_t * hashcat_ctx )
{
2018-08-28 20:28:44 +00:00
const hwmon_ctx_t * hwmon_ctx = hashcat_ctx - > hwmon_ctx ;
2016-10-16 17:32:43 +00:00
2016-11-20 21:54:52 +00:00
hashcat_status_t * hashcat_status = ( hashcat_status_t * ) hcmalloc ( sizeof ( hashcat_status_t ) ) ;
2016-10-17 22:13:40 +00:00
2019-07-10 14:55:50 +00:00
if ( hashcat_get_status ( hashcat_ctx , hashcat_status ) = = - 1 )
2016-10-16 17:32:43 +00:00
{
2016-10-17 22:13:40 +00:00
hcfree ( hashcat_status ) ;
2016-10-16 17:32:43 +00:00
return ;
}
2016-11-14 00:56:31 +00:00
printf ( " STATUS \t %d \t " , hashcat_status - > status_number ) ;
2016-10-16 17:32:43 +00:00
2016-10-17 22:13:40 +00:00
printf ( " SPEED \t " ) ;
2016-10-16 17:32:43 +00:00
2016-10-17 22:13:40 +00:00
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
2016-10-16 17:32:43 +00:00
{
2016-10-17 22:13:40 +00:00
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
2016-10-16 17:32:43 +00:00
2016-10-17 22:13:40 +00:00
if ( device_info - > skipped_dev = = true ) continue ;
2016-10-16 17:32:43 +00:00
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2017-10-20 10:19:33 +00:00
printf ( " % " PRIu64 " \t " , ( u64 ) ( device_info - > hashes_msec_dev * 1000 ) ) ;
2016-10-17 22:15:25 +00:00
// that 1\t is for backward compatibility
2017-07-19 12:53:43 +00:00
printf ( " 1000 \t " ) ;
2016-10-16 17:32:43 +00:00
}
2016-10-17 22:13:40 +00:00
printf ( " EXEC_RUNTIME \t " ) ;
2016-10-16 17:32:43 +00:00
2016-10-17 22:13:40 +00:00
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
2016-10-16 17:32:43 +00:00
{
2016-10-17 22:13:40 +00:00
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
2016-10-16 17:32:43 +00:00
2016-10-17 22:13:40 +00:00
if ( device_info - > skipped_dev = = true ) continue ;
2016-10-16 17:32:43 +00:00
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2016-10-17 22:13:40 +00:00
printf ( " %f \t " , device_info - > exec_msec_dev ) ;
2016-10-16 17:32:43 +00:00
}
2017-10-20 10:19:33 +00:00
printf ( " CURKU \t % " PRIu64 " \t " , hashcat_status - > restore_point ) ;
2016-10-16 17:32:43 +00:00
2017-10-20 10:19:33 +00:00
printf ( " PROGRESS \t % " PRIu64 " \t % " PRIu64 " \t " , hashcat_status - > progress_cur_relative_skip , hashcat_status - > progress_end_relative_skip ) ;
2016-10-16 17:32:43 +00:00
2016-11-14 00:56:31 +00:00
printf ( " RECHASH \t %d \t %d \t " , hashcat_status - > digests_done , hashcat_status - > digests_cnt ) ;
2016-10-16 17:32:43 +00:00
2016-11-14 00:56:31 +00:00
printf ( " RECSALT \t %d \t %d \t " , hashcat_status - > salts_done , hashcat_status - > salts_cnt ) ;
2016-10-16 17:32:43 +00:00
2018-08-28 20:28:44 +00:00
if ( hwmon_ctx - > enabled = = true )
2016-10-16 17:32:43 +00:00
{
2016-10-17 22:13:40 +00:00
printf ( " TEMP \t " ) ;
2016-10-16 17:32:43 +00:00
2016-10-17 22:13:40 +00:00
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
2016-10-16 17:32:43 +00:00
{
2016-10-17 22:13:40 +00:00
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
2016-10-16 17:32:43 +00:00
2016-10-17 22:13:40 +00:00
if ( device_info - > skipped_dev = = true ) continue ;
2016-10-16 17:32:43 +00:00
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2019-04-30 11:38:44 +00:00
const int temp = hm_get_temperature_with_devices_idx ( hashcat_ctx , device_id ) ;
2016-10-16 17:32:43 +00:00
2016-10-17 22:13:40 +00:00
printf ( " %d \t " , temp ) ;
}
2016-10-16 17:32:43 +00:00
}
2017-10-20 10:19:33 +00:00
printf ( " REJECTED \t % " PRIu64 " \t " , hashcat_status - > progress_rejected ) ;
2017-03-30 07:47:52 +00:00
2018-07-18 16:14:42 +00:00
printf ( " UTIL \t " ) ;
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
{
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
if ( device_info - > skipped_dev = = true ) continue ;
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2018-07-18 16:14:42 +00:00
// ok, little cheat here again...
2019-04-30 11:38:44 +00:00
const int util = hm_get_utilization_with_devices_idx ( hashcat_ctx , device_id ) ;
2018-07-18 16:14:42 +00:00
printf ( " %d \t " , util ) ;
}
2019-06-27 18:18:47 +00:00
fwrite ( EOL , strlen ( EOL ) , 1 , stdout ) ;
2016-10-17 22:13:40 +00:00
fflush ( stdout ) ;
2016-10-16 17:32:43 +00:00
2017-05-30 10:15:55 +00:00
status_status_destroy ( hashcat_ctx , hashcat_status ) ;
2016-10-17 22:13:40 +00:00
hcfree ( hashcat_status ) ;
2016-10-16 17:32:43 +00:00
}
2019-03-27 10:09:24 +00:00
void status_display_status_json ( hashcat_ctx_t * hashcat_ctx )
{
2019-04-02 18:11:55 +00:00
const hwmon_ctx_t * hwmon_ctx = hashcat_ctx - > hwmon_ctx ;
2019-04-05 06:52:35 +00:00
2019-04-02 19:55:05 +00:00
const status_ctx_t * status_ctx = hashcat_ctx - > status_ctx ;
2019-04-05 06:52:35 +00:00
2019-03-27 10:09:24 +00:00
hashcat_status_t * hashcat_status = ( hashcat_status_t * ) hcmalloc ( sizeof ( hashcat_status_t ) ) ;
2019-04-05 06:52:35 +00:00
2019-07-10 14:55:50 +00:00
if ( hashcat_get_status ( hashcat_ctx , hashcat_status ) = = - 1 )
2019-03-27 10:09:24 +00:00
{
hcfree ( hashcat_status ) ;
return ;
}
2019-04-05 06:52:35 +00:00
2019-04-02 19:55:05 +00:00
time_t time_now ;
2019-04-05 06:52:35 +00:00
2019-04-02 19:55:05 +00:00
time ( & time_now ) ;
2019-04-05 06:52:35 +00:00
2019-04-02 21:23:05 +00:00
time_t end ;
2019-04-05 06:52:35 +00:00
2019-04-02 19:55:05 +00:00
time_t sec_etc = status_get_sec_etc ( hashcat_ctx ) ;
2019-04-05 06:52:35 +00:00
2019-04-02 19:55:05 +00:00
if ( overflow_check_u64_add ( time_now , sec_etc ) = = false )
{
2019-04-02 20:32:25 +00:00
end = 1 ;
2019-04-02 19:55:05 +00:00
}
else
{
2019-04-02 20:32:25 +00:00
end = time_now + sec_etc ;
2019-04-02 19:55:05 +00:00
}
2020-05-13 11:37:30 +00:00
/*
* As the hash target can contain the hash ( in case of a single attacked hash ) , especially
* some salts can contain chars which need to be escaped to not break the JSON encoding .
* Based on https : //www.freeformatter.com/json-escape.html, below these 7 different chars
* are getting escaped before being printed .
*/
char * target_json_encoded = ( char * ) hcmalloc ( strlen ( hashcat_status - > hash_target ) * 2 ) ;
2020-05-11 21:22:47 +00:00
unsigned long i , j ;
2020-05-13 11:37:30 +00:00
for ( i = 0 , j = 0 ; i < strlen ( hashcat_status - > hash_target ) ; i + + , j + + )
2020-05-11 21:22:47 +00:00
{
2020-05-13 11:37:30 +00:00
char c = hashcat_status - > hash_target [ i ] ;
2020-05-11 21:22:47 +00:00
2020-05-13 11:37:30 +00:00
switch ( c )
2020-05-11 21:22:47 +00:00
{
2020-05-13 11:37:30 +00:00
case ' \b ' : c = ' b ' ; target_json_encoded [ j ] = ' \\ ' ; j + + ; break ;
case ' \t ' : c = ' t ' ; target_json_encoded [ j ] = ' \\ ' ; j + + ; break ;
case ' \n ' : c = ' n ' ; target_json_encoded [ j ] = ' \\ ' ; j + + ; break ;
case ' \f ' : c = ' f ' ; target_json_encoded [ j ] = ' \\ ' ; j + + ; break ;
case ' \r ' : c = ' r ' ; target_json_encoded [ j ] = ' \\ ' ; j + + ; break ;
case ' \\ ' : c = ' \\ ' ; target_json_encoded [ j ] = ' \\ ' ; j + + ; break ;
case ' " ' : c = ' " ' ; target_json_encoded [ j ] = ' \\ ' ; j + + ; break ;
2020-05-11 21:22:47 +00:00
}
2020-05-13 11:37:30 +00:00
target_json_encoded [ j ] = c ;
2020-05-11 21:22:47 +00:00
}
2020-05-13 11:37:30 +00:00
target_json_encoded [ j ] = 0 ;
2020-05-11 21:22:47 +00:00
2019-04-02 21:06:18 +00:00
printf ( " { \" session \" : \" %s \" , " , hashcat_status - > session ) ;
2019-04-02 18:11:55 +00:00
printf ( " \" status \" : %d, " , hashcat_status - > status_number ) ;
2020-05-13 11:37:30 +00:00
printf ( " \" target \" : \" %s \" , " , target_json_encoded ) ;
2019-04-02 21:10:23 +00:00
printf ( " \" progress \" : [% " PRIu64 " , % " PRIu64 " ], " , hashcat_status - > progress_cur_relative_skip , hashcat_status - > progress_end_relative_skip ) ;
2019-04-02 18:26:46 +00:00
printf ( " \" restore_point \" : % " PRIu64 " , " , hashcat_status - > restore_point ) ;
2019-04-02 21:06:18 +00:00
printf ( " \" recovered_hashes \" : [%d, %d], " , hashcat_status - > digests_done , hashcat_status - > digests_cnt ) ;
printf ( " \" recovered_salts \" : [%d, %d], " , hashcat_status - > salts_done , hashcat_status - > salts_cnt ) ;
2019-04-02 18:25:36 +00:00
printf ( " \" rejected \" : % " PRIu64 " , " , hashcat_status - > progress_rejected ) ;
2019-04-02 21:06:18 +00:00
printf ( " \" devices \" : [ " ) ;
2019-04-05 06:52:35 +00:00
2020-05-14 17:21:59 +00:00
hcfree ( target_json_encoded ) ;
2020-05-11 21:22:47 +00:00
2019-04-02 21:53:59 +00:00
int device_num = 0 ;
2019-04-05 06:52:35 +00:00
2019-04-02 18:11:55 +00:00
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
{
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
if ( device_info - > skipped_dev = = true ) continue ;
if ( device_info - > skipped_warning_dev = = true ) continue ;
2019-04-05 06:52:35 +00:00
2019-04-02 21:53:59 +00:00
if ( device_num ! = 0 )
2019-04-02 18:11:55 +00:00
{
2020-06-13 09:19:00 +00:00
printf ( " , " ) ;
2019-04-02 18:11:55 +00:00
}
2020-06-13 09:19:00 +00:00
2019-04-02 21:10:23 +00:00
printf ( " { \" device_id \" : %d, " , device_id + 1 ) ;
2019-04-02 18:25:36 +00:00
printf ( " \" speed \" : % " PRIu64 " , " , ( u64 ) ( device_info - > hashes_msec_dev * 1000 ) ) ;
2019-04-05 06:52:35 +00:00
2019-04-02 18:11:55 +00:00
if ( hwmon_ctx - > enabled = = true )
{
2019-04-30 11:38:44 +00:00
const int temp = hm_get_temperature_with_devices_idx ( hashcat_ctx , device_id ) ;
2019-04-02 18:11:55 +00:00
2019-04-05 06:52:35 +00:00
printf ( " \" temp \" : %d, " , temp ) ;
}
2019-04-30 11:38:44 +00:00
const int util = hm_get_utilization_with_devices_idx ( hashcat_ctx , device_id ) ;
2019-04-02 18:11:55 +00:00
2019-04-02 21:10:23 +00:00
printf ( " \" util \" : %d } " , util ) ;
2019-04-05 06:52:35 +00:00
2019-04-02 21:53:59 +00:00
device_num + + ;
2019-04-02 18:11:55 +00:00
}
2019-04-02 21:10:54 +00:00
printf ( " ], " ) ;
2019-04-05 06:52:35 +00:00
printf ( " \" time_start \" : % " PRIu64 " , " , ( u64 ) status_ctx - > runtime_start ) ;
printf ( " \" estimated_stop \" : % " PRIu64 " } " , ( u64 ) end ) ;
2019-06-27 18:18:47 +00:00
fwrite ( EOL , strlen ( EOL ) , 1 , stdout ) ;
2019-04-05 06:52:35 +00:00
2019-04-02 18:11:55 +00:00
fflush ( stdout ) ;
2019-03-27 11:10:28 +00:00
status_status_destroy ( hashcat_ctx , hashcat_status ) ;
hcfree ( hashcat_status ) ;
2019-03-27 10:09:24 +00:00
}
2016-10-16 17:32:43 +00:00
void status_display ( hashcat_ctx_t * hashcat_ctx )
{
2017-07-18 12:45:15 +00:00
const hashconfig_t * hashconfig = hashcat_ctx - > hashconfig ;
2018-08-28 20:28:44 +00:00
const hwmon_ctx_t * hwmon_ctx = hashcat_ctx - > hwmon_ctx ;
2016-10-17 21:49:44 +00:00
const user_options_t * user_options = hashcat_ctx - > user_options ;
2016-10-16 17:32:43 +00:00
2016-10-17 21:49:44 +00:00
if ( user_options - > machine_readable = = true )
2016-10-16 17:32:43 +00:00
{
2016-10-17 21:49:44 +00:00
status_display_machine_readable ( hashcat_ctx ) ;
2016-10-16 17:32:43 +00:00
return ;
}
2019-04-05 06:52:35 +00:00
2019-03-27 10:09:24 +00:00
if ( user_options - > status_json = = true )
{
status_display_status_json ( hashcat_ctx ) ;
2019-04-05 06:52:35 +00:00
2019-03-27 10:09:24 +00:00
return ;
}
2016-10-16 17:32:43 +00:00
2016-11-20 21:54:52 +00:00
hashcat_status_t * hashcat_status = ( hashcat_status_t * ) hcmalloc ( sizeof ( hashcat_status_t ) ) ;
2016-10-16 17:32:43 +00:00
2019-07-10 14:55:50 +00:00
if ( hashcat_get_status ( hashcat_ctx , hashcat_status ) = = - 1 )
2016-10-16 17:32:43 +00:00
{
2016-10-17 21:49:44 +00:00
hcfree ( hashcat_status ) ;
2016-10-16 17:32:43 +00:00
return ;
}
/**
* show something
*/
2018-10-28 15:47:13 +00:00
# ifdef WITH_BRAIN
if ( user_options - > brain_client = = true )
{
event_log_info ( hashcat_ctx ,
" Session..........: %s (Brain Session/Attack:0x%08x/0x%08x) " ,
hashcat_status - > session ,
hashcat_status - > brain_session ,
hashcat_status - > brain_attack ) ;
}
else
{
event_log_info ( hashcat_ctx ,
" Session..........: %s " ,
hashcat_status - > session ) ;
}
# else
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Session..........: %s " ,
2016-10-17 21:49:44 +00:00
hashcat_status - > session ) ;
2018-10-28 15:47:13 +00:00
# endif
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Status...........: %s " ,
2016-10-17 22:27:15 +00:00
hashcat_status - > status_string ) ;
event_log_info ( hashcat_ctx ,
2019-01-21 09:00:44 +00:00
" Hash.Name........: %s " ,
hashcat_status - > hash_name ) ;
2016-10-17 22:27:15 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Hash.Target......: %s " ,
2016-10-17 22:27:15 +00:00
hashcat_status - > hash_target ) ;
2019-11-21 09:47:07 +00:00
2019-11-17 21:12:27 +00:00
if ( user_options - > force = = true )
{
event_log_info ( hashcat_ctx ,
" Time.Started.....: %s, (%s) " ,
hashcat_status - > time_started_absolute ,
hashcat_status - > time_started_relative ) ;
}
else
{
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Time.Started.....: %s (%s) " ,
2016-10-17 21:49:44 +00:00
hashcat_status - > time_started_absolute ,
hashcat_status - > time_started_relative ) ;
2019-11-21 09:47:07 +00:00
}
2019-11-17 21:12:27 +00:00
if ( user_options - > force = = true )
{
event_log_info ( hashcat_ctx ,
" Time.Estimated...: %s, (%s) " ,
hashcat_status - > time_estimated_absolute ,
hashcat_status - > time_estimated_relative ) ;
}
else
{
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Time.Estimated...: %s (%s) " ,
2016-10-17 21:49:44 +00:00
hashcat_status - > time_estimated_absolute ,
hashcat_status - > time_estimated_relative ) ;
2019-11-17 21:12:27 +00:00
}
2019-11-21 09:47:07 +00:00
2021-05-19 06:32:24 +00:00
if ( hashconfig - > opti_type & OPTI_TYPE_OPTIMIZED_KERNEL )
{
event_log_info ( hashcat_ctx , " Kernel.Feature...: Optimized Kernel " ) ;
}
else
{
event_log_info ( hashcat_ctx , " Kernel.Feature...: Pure Kernel " ) ;
}
2017-03-24 22:39:09 +00:00
switch ( hashcat_status - > guess_mode )
2016-10-16 17:32:43 +00:00
{
2017-03-24 22:39:09 +00:00
case GUESS_MODE_STRAIGHT_FILE :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Base.......: File (%s) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base ) ;
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
2016-10-17 21:49:44 +00:00
2017-03-24 22:39:09 +00:00
case GUESS_MODE_STRAIGHT_FILE_RULES_FILE :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Base.......: File (%s) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base ) ;
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Mod........: Rules (%s) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_mod ) ;
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
2016-10-17 21:49:44 +00:00
2017-03-24 22:39:09 +00:00
case GUESS_MODE_STRAIGHT_FILE_RULES_GEN :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Base.......: File (%s) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base ) ;
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Mod........: Rules (Generated) " ) ;
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
2016-10-17 21:49:44 +00:00
2017-03-24 22:39:09 +00:00
case GUESS_MODE_STRAIGHT_STDIN :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Base.......: Pipe " ) ;
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
2016-10-17 21:49:44 +00:00
2017-03-24 22:39:09 +00:00
case GUESS_MODE_STRAIGHT_STDIN_RULES_FILE :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Base.......: Pipe " ) ;
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Mod........: Rules (%s) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_mod ) ;
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
2016-10-17 21:49:44 +00:00
2017-03-24 22:39:09 +00:00
case GUESS_MODE_STRAIGHT_STDIN_RULES_GEN :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Base.......: Pipe " ) ;
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Mod........: Rules (Generated) " ) ;
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
2016-10-17 21:49:44 +00:00
2017-03-24 22:39:09 +00:00
case GUESS_MODE_COMBINATOR_BASE_LEFT :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Base.......: File (%s), Left Side " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base ) ;
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Mod........: File (%s), Right Side " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_mod ) ;
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
2016-10-17 21:49:44 +00:00
2017-03-24 22:39:09 +00:00
case GUESS_MODE_COMBINATOR_BASE_RIGHT :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Base.......: File (%s), Right Side " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base ) ;
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Mod........: File (%s), Left Side " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_mod ) ;
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
2016-10-17 21:49:44 +00:00
2017-03-24 22:39:09 +00:00
case GUESS_MODE_MASK :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Mask.......: %s [%d] " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base ,
hashcat_status - > guess_mask_length ) ;
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
2016-10-17 21:49:44 +00:00
2017-03-24 22:39:09 +00:00
case GUESS_MODE_MASK_CS :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Mask.......: %s [%d] " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base ,
hashcat_status - > guess_mask_length ) ;
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Charset....: %s " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_charset ) ;
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
2016-10-17 21:49:44 +00:00
2017-03-24 22:39:09 +00:00
case GUESS_MODE_HYBRID1 :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Base.......: File (%s), Left Side " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base ) ;
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Mod........: Mask (%s) [%d], Right Side " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_mod ,
hashcat_status - > guess_mask_length ) ;
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
2016-10-17 21:49:44 +00:00
2017-03-24 22:39:09 +00:00
case GUESS_MODE_HYBRID1_CS :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Base.......: File (%s), Left Side " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base ) ;
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Mod........: Mask (%s) [%d], Right Side " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_mod ,
hashcat_status - > guess_mask_length ) ;
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Charset....: %s " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_charset ) ;
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
2016-10-17 21:49:44 +00:00
2017-03-24 22:39:09 +00:00
case GUESS_MODE_HYBRID2 :
2016-10-17 21:49:44 +00:00
2017-07-18 12:45:15 +00:00
if ( hashconfig - > opti_type & OPTI_TYPE_OPTIMIZED_KERNEL )
2017-06-30 14:51:57 +00:00
{
event_log_info ( hashcat_ctx ,
" Guess.Base.......: Mask (%s) [%d], Left Side " ,
hashcat_status - > guess_base ,
hashcat_status - > guess_mask_length ) ;
event_log_info ( hashcat_ctx ,
" Guess.Mod........: File (%s), Right Side " ,
hashcat_status - > guess_mod ) ;
}
else
{
event_log_info ( hashcat_ctx ,
" Guess.Base.......: File (%s), Right Side " ,
hashcat_status - > guess_base ) ;
event_log_info ( hashcat_ctx ,
" Guess.Mod........: Mask (%s) [%d], Left Side " ,
hashcat_status - > guess_mod ,
hashcat_status - > guess_mask_length ) ;
}
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
2016-10-17 21:49:44 +00:00
2017-03-24 22:39:09 +00:00
case GUESS_MODE_HYBRID2_CS :
2016-10-17 21:49:44 +00:00
2017-07-18 12:45:15 +00:00
if ( hashconfig - > opti_type & OPTI_TYPE_OPTIMIZED_KERNEL )
2017-06-30 14:51:57 +00:00
{
event_log_info ( hashcat_ctx ,
" Guess.Base.......: Mask (%s) [%d], Left Side " ,
hashcat_status - > guess_base ,
hashcat_status - > guess_mask_length ) ;
event_log_info ( hashcat_ctx ,
" Guess.Mod........: File (%s), Right Side " ,
hashcat_status - > guess_mod ) ;
event_log_info ( hashcat_ctx ,
" Guess.Charset....: %s " ,
hashcat_status - > guess_charset ) ;
}
else
{
event_log_info ( hashcat_ctx ,
" Guess.Base.......: File (%s), Right Side " ,
hashcat_status - > guess_base ) ;
event_log_info ( hashcat_ctx ,
" Guess.Mod........: Mask (%s) [%d], Left Side " ,
hashcat_status - > guess_mod ,
hashcat_status - > guess_mask_length ) ;
event_log_info ( hashcat_ctx ,
" Guess.Charset....: %s " ,
hashcat_status - > guess_charset ) ;
}
2016-10-17 21:49:44 +00:00
2016-10-16 17:32:43 +00:00
break ;
}
2017-03-24 22:39:09 +00:00
switch ( hashcat_status - > guess_mode )
2016-11-10 21:30:17 +00:00
{
2017-03-24 22:39:09 +00:00
case GUESS_MODE_STRAIGHT_FILE :
2016-11-10 21:30:17 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Queue......: %d/%d (%.02f%%) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base_offset ,
hashcat_status - > guess_base_count ,
hashcat_status - > guess_base_percent ) ;
2016-11-10 21:30:17 +00:00
break ;
2017-03-24 22:39:09 +00:00
case GUESS_MODE_STRAIGHT_FILE_RULES_FILE :
2016-12-31 12:37:26 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Queue......: %d/%d (%.02f%%) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base_offset ,
hashcat_status - > guess_base_count ,
hashcat_status - > guess_base_percent ) ;
2016-12-31 12:37:26 +00:00
break ;
2017-03-24 22:39:09 +00:00
case GUESS_MODE_STRAIGHT_FILE_RULES_GEN :
2016-12-31 12:37:26 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Queue......: %d/%d (%.02f%%) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base_offset ,
hashcat_status - > guess_base_count ,
hashcat_status - > guess_base_percent ) ;
2016-12-31 12:37:26 +00:00
break ;
2017-03-24 22:39:09 +00:00
case GUESS_MODE_MASK :
2016-11-10 21:30:17 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Queue......: %d/%d (%.02f%%) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base_offset ,
hashcat_status - > guess_base_count ,
hashcat_status - > guess_base_percent ) ;
2016-11-10 21:30:17 +00:00
break ;
2017-03-24 22:39:09 +00:00
case GUESS_MODE_MASK_CS :
2016-12-29 09:43:58 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Queue......: %d/%d (%.02f%%) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base_offset ,
hashcat_status - > guess_base_count ,
hashcat_status - > guess_base_percent ) ;
2016-12-29 09:43:58 +00:00
break ;
2017-03-24 22:39:09 +00:00
case GUESS_MODE_HYBRID1 :
2016-11-10 21:30:17 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Queue.Base.: %d/%d (%.02f%%) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base_offset ,
hashcat_status - > guess_base_count ,
hashcat_status - > guess_base_percent ) ;
2016-11-10 21:30:17 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Queue.Mod..: %d/%d (%.02f%%) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_mod_offset ,
hashcat_status - > guess_mod_count ,
hashcat_status - > guess_mod_percent ) ;
2016-11-10 21:30:17 +00:00
break ;
2017-03-24 22:39:09 +00:00
case GUESS_MODE_HYBRID2 :
2016-11-10 21:30:17 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Queue.Base.: %d/%d (%.02f%%) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_base_offset ,
hashcat_status - > guess_base_count ,
hashcat_status - > guess_base_percent ) ;
2016-11-10 21:30:17 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Guess.Queue.Mod..: %d/%d (%.02f%%) " ,
2017-03-24 22:39:09 +00:00
hashcat_status - > guess_mod_offset ,
hashcat_status - > guess_mod_count ,
hashcat_status - > guess_mod_percent ) ;
2016-11-10 21:30:17 +00:00
break ;
}
2016-10-17 21:49:44 +00:00
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
2016-10-17 14:46:16 +00:00
{
2016-10-17 21:49:44 +00:00
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
2016-10-17 14:46:16 +00:00
2016-10-17 21:49:44 +00:00
if ( device_info - > skipped_dev = = true ) continue ;
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2018-09-01 10:31:17 +00:00
" Speed.#%d.........: %9sH/s (%0.2fms) @ Accel:%d Loops:%d Thr:%d Vec:%d " , device_id + 1 ,
2016-10-17 22:27:15 +00:00
device_info - > speed_sec_dev ,
2018-02-02 22:22:21 +00:00
device_info - > exec_msec_dev ,
device_info - > kernel_accel_dev ,
device_info - > kernel_loops_dev ,
device_info - > kernel_threads_dev ,
device_info - > vector_width_dev ) ;
2016-10-17 22:27:15 +00:00
}
if ( hashcat_status - > device_info_active > 1 )
{
event_log_info ( hashcat_ctx ,
2018-09-01 10:31:17 +00:00
" Speed.#*.........: %9sH/s " ,
2016-10-17 22:27:15 +00:00
hashcat_status - > speed_sec_all ) ;
2016-10-17 14:46:16 +00:00
}
2019-08-06 09:26:56 +00:00
2019-07-12 17:54:21 +00:00
if ( hashcat_status - > salts_cnt > 1 )
{
2019-08-06 09:26:56 +00:00
event_log_info ( hashcat_ctx ,
" Recovered........: %d/%d (%.2f%%) Digests, %d/%d (%.2f%%) Salts " ,
hashcat_status - > digests_done ,
hashcat_status - > digests_cnt ,
hashcat_status - > digests_percent ,
hashcat_status - > salts_done ,
hashcat_status - > salts_cnt ,
hashcat_status - > salts_percent ) ;
2019-07-12 17:54:21 +00:00
}
else
{
2019-08-06 09:26:56 +00:00
event_log_info ( hashcat_ctx ,
" Recovered........: %d/%d (%.2f%%) Digests " ,
hashcat_status - > digests_done ,
hashcat_status - > digests_cnt ,
hashcat_status - > digests_percent ) ;
2019-07-12 17:54:21 +00:00
}
2019-08-06 09:26:56 +00:00
2019-07-12 17:54:21 +00:00
if ( hashcat_status - > digests_cnt > 1000 )
{
2019-08-06 09:26:56 +00:00
const int digests_remain = hashcat_status - > digests_cnt - hashcat_status - > digests_done ;
const double digests_remain_percent = ( double ) digests_remain / ( double ) hashcat_status - > digests_cnt * 100 ;
const int salts_remain = hashcat_status - > salts_cnt - hashcat_status - > salts_done ;
const double salts_remain_percent = ( double ) salts_remain / ( double ) hashcat_status - > salts_cnt * 100 ;
2019-07-12 17:54:21 +00:00
if ( hashcat_status - > salts_cnt > 1 )
{
2019-08-06 09:26:56 +00:00
event_log_info ( hashcat_ctx ,
" Remaining........: %d (%.2f%%) Digests, %d (%.2f%%) Salts " ,
digests_remain ,
digests_remain_percent ,
salts_remain ,
salts_remain_percent ) ;
2019-07-12 17:54:21 +00:00
}
else
{
2019-08-06 09:26:56 +00:00
event_log_info ( hashcat_ctx ,
" Remaining........: %d (%.2f%%) Digests " ,
digests_remain ,
digests_remain_percent ) ;
2019-07-12 17:54:21 +00:00
}
}
2019-08-06 09:26:56 +00:00
2016-11-30 10:12:30 +00:00
if ( hashcat_status - > digests_cnt > 1000 )
{
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Recovered/Time...: %s " ,
2016-11-30 10:12:30 +00:00
hashcat_status - > cpt ) ;
}
2016-10-17 22:27:15 +00:00
2016-10-17 21:49:44 +00:00
switch ( hashcat_status - > progress_mode )
2016-10-17 14:22:32 +00:00
{
case PROGRESS_MODE_KEYSPACE_KNOWN :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-10-20 10:19:33 +00:00
" Progress.........: % " PRIu64 " /% " PRIu64 " (%.02f%%) " ,
2016-10-17 21:49:44 +00:00
hashcat_status - > progress_cur_relative_skip ,
hashcat_status - > progress_end_relative_skip ,
hashcat_status - > progress_finished_percent ) ;
event_log_info ( hashcat_ctx ,
2017-10-20 10:19:33 +00:00
" Rejected.........: % " PRIu64 " /% " PRIu64 " (%.02f%%) " ,
2016-10-17 21:49:44 +00:00
hashcat_status - > progress_rejected ,
hashcat_status - > progress_cur_relative_skip ,
hashcat_status - > progress_rejected_percent ) ;
2016-10-17 14:22:32 +00:00
break ;
2016-10-17 21:49:44 +00:00
2016-10-17 14:22:32 +00:00
case PROGRESS_MODE_KEYSPACE_UNKNOWN :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-10-20 10:19:33 +00:00
" Progress.........: % " PRIu64 ,
2016-10-17 21:49:44 +00:00
hashcat_status - > progress_cur_relative_skip ) ;
event_log_info ( hashcat_ctx ,
2017-10-20 10:19:33 +00:00
" Rejected.........: % " PRIu64 ,
2016-10-17 21:49:44 +00:00
hashcat_status - > progress_rejected ) ;
2018-09-01 10:31:17 +00:00
break ;
}
2018-10-28 15:47:13 +00:00
# ifdef WITH_BRAIN
if ( user_options - > brain_client = = true )
{
2019-06-15 22:46:40 +00:00
event_log_info ( hashcat_ctx ,
" Brain.Link.All...: RX: %sB, TX: %sB " ,
hashcat_status - > brain_rx_all ,
hashcat_status - > brain_tx_all ) ;
2019-07-10 14:55:50 +00:00
2018-10-28 15:47:13 +00:00
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
{
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
if ( device_info - > skipped_dev = = true ) continue ;
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2018-10-28 15:47:13 +00:00
if ( device_info - > brain_link_status_dev = = BRAIN_LINK_STATUS_CONNECTED )
{
event_log_info ( hashcat_ctx ,
" Brain.Link.#%d....: RX: %sB (%sbps), TX: %sB (%sbps), idle " , device_id + 1 ,
device_info - > brain_link_recv_bytes_dev ,
device_info - > brain_link_recv_bytes_sec_dev ,
device_info - > brain_link_send_bytes_dev ,
device_info - > brain_link_send_bytes_sec_dev ) ;
}
else if ( device_info - > brain_link_status_dev = = BRAIN_LINK_STATUS_RECEIVING )
{
event_log_info ( hashcat_ctx ,
" Brain.Link.#%d....: RX: %sB (%sbps), TX: %sB (%sbps), receiving " , device_id + 1 ,
device_info - > brain_link_recv_bytes_dev ,
device_info - > brain_link_recv_bytes_sec_dev ,
device_info - > brain_link_send_bytes_dev ,
device_info - > brain_link_send_bytes_sec_dev ) ;
}
else if ( device_info - > brain_link_status_dev = = BRAIN_LINK_STATUS_SENDING )
{
event_log_info ( hashcat_ctx ,
" Brain.Link.#%d....: RX: %sB (%sbps), TX: %sB (%sbps), sending " , device_id + 1 ,
device_info - > brain_link_recv_bytes_dev ,
device_info - > brain_link_recv_bytes_sec_dev ,
device_info - > brain_link_send_bytes_dev ,
device_info - > brain_link_send_bytes_sec_dev ) ;
}
else
{
if ( ( device_info - > brain_link_time_recv_dev > 0 ) & & ( device_info - > brain_link_time_send_dev > 0 ) )
{
event_log_info ( hashcat_ctx ,
" Brain.Link.#%d....: RX: %sB (%sbps), TX: %sB (%sbps) " , device_id + 1 ,
device_info - > brain_link_recv_bytes_dev ,
device_info - > brain_link_recv_bytes_sec_dev ,
device_info - > brain_link_send_bytes_dev ,
device_info - > brain_link_send_bytes_sec_dev ) ;
}
else
{
event_log_info ( hashcat_ctx ,
" Brain.Link.#%d....: N/A " , device_id + 1 ) ;
}
}
}
}
# endif
2018-09-01 10:31:17 +00:00
switch ( hashcat_status - > progress_mode )
{
case PROGRESS_MODE_KEYSPACE_KNOWN :
event_log_info ( hashcat_ctx ,
" Restore.Point....: % " PRIu64 " /% " PRIu64 " (%.02f%%) " ,
hashcat_status - > restore_point ,
hashcat_status - > restore_total ,
hashcat_status - > restore_percent ) ;
break ;
case PROGRESS_MODE_KEYSPACE_UNKNOWN :
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-10-20 10:19:33 +00:00
" Restore.Point....: % " PRIu64 ,
2016-10-17 21:49:44 +00:00
hashcat_status - > restore_point ) ;
2016-10-17 14:22:32 +00:00
break ;
}
2018-08-17 23:41:07 +00:00
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
{
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
if ( device_info - > skipped_dev = = true ) continue ;
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2018-08-17 23:41:07 +00:00
event_log_info ( hashcat_ctx ,
2018-08-18 00:17:42 +00:00
" Restore.Sub.#%d...: Salt:%d Amplifier:%d-%d Iteration:%d-%d " , device_id + 1 ,
2018-08-17 23:41:07 +00:00
device_info - > salt_pos_dev ,
device_info - > innerloop_pos_dev ,
2018-08-18 00:17:42 +00:00
device_info - > innerloop_pos_dev + device_info - > innerloop_left_dev ,
device_info - > iteration_pos_dev ,
device_info - > iteration_pos_dev + device_info - > iteration_left_dev ) ;
2018-08-17 23:41:07 +00:00
}
2021-05-19 06:32:24 +00:00
//if (hashconfig->opts_type & OPTS_TYPE_SLOW_CANDIDATES)
if ( user_options - > slow_candidates = = true )
{
event_log_info ( hashcat_ctx , " Candidate.Engine.: Host Generator + PCIe " ) ;
}
else
{
event_log_info ( hashcat_ctx , " Candidate.Engine.: Device Generator " ) ;
}
2016-10-17 21:49:44 +00:00
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
2016-10-17 13:19:25 +00:00
{
2016-10-17 21:49:44 +00:00
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
if ( device_info - > skipped_dev = = true ) continue ;
2016-10-16 17:32:43 +00:00
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2017-03-24 22:39:09 +00:00
if ( device_info - > guess_candidates_dev = = NULL ) continue ;
2016-10-23 15:31:22 +00:00
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2017-03-25 15:11:01 +00:00
" Candidates.#%d....: %s " , device_id + 1 ,
2017-03-24 22:39:09 +00:00
device_info - > guess_candidates_dev ) ;
2016-10-17 15:02:56 +00:00
}
2016-10-16 17:32:43 +00:00
2018-08-28 20:28:44 +00:00
if ( hwmon_ctx - > enabled = = true )
2016-10-16 17:32:43 +00:00
{
2021-06-19 18:32:07 +00:00
# if defined(__APPLE__)
bool first_dev = true ;
# endif
2016-10-17 21:49:44 +00:00
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
2016-10-16 17:32:43 +00:00
{
2016-10-17 21:49:44 +00:00
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
if ( device_info - > skipped_dev = = true ) continue ;
2016-10-23 15:31:22 +00:00
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2016-10-23 15:31:22 +00:00
if ( device_info - > hwmon_dev = = NULL ) continue ;
2016-10-16 17:32:43 +00:00
2021-06-19 18:32:07 +00:00
# if defined(__APPLE__)
2021-06-19 18:46:09 +00:00
if ( first_dev & & strlen ( device_info - > hwmon_fan_dev ) > 0 )
2021-06-19 18:32:07 +00:00
{
event_log_info ( hashcat_ctx , " Hardware.Mon.SMC.: %s " , device_info - > hwmon_fan_dev ) ;
first_dev = false ;
}
# endif
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2018-09-01 10:31:17 +00:00
" Hardware.Mon.#%d..: %s " , device_id + 1 ,
2016-10-17 21:49:44 +00:00
device_info - > hwmon_dev ) ;
2016-10-16 17:32:43 +00:00
}
}
2016-10-17 21:49:44 +00:00
2017-05-30 10:15:55 +00:00
status_status_destroy ( hashcat_ctx , hashcat_status ) ;
2016-10-17 21:49:44 +00:00
hcfree ( hashcat_status ) ;
2016-10-16 17:32:43 +00:00
}
2016-12-09 22:44:43 +00:00
void status_benchmark_machine_readable ( hashcat_ctx_t * hashcat_ctx )
2016-10-16 17:32:43 +00:00
{
hashconfig_t * hashconfig = hashcat_ctx - > hashconfig ;
2016-10-17 15:20:19 +00:00
const u32 hash_mode = hashconfig - > hash_mode ;
2016-10-16 17:32:43 +00:00
2016-11-20 21:54:52 +00:00
hashcat_status_t * hashcat_status = ( hashcat_status_t * ) hcmalloc ( sizeof ( hashcat_status_t ) ) ;
2016-10-16 17:32:43 +00:00
2019-07-10 14:55:50 +00:00
if ( hashcat_get_status ( hashcat_ctx , hashcat_status ) = = - 1 )
2016-10-16 17:32:43 +00:00
{
2016-10-17 21:49:44 +00:00
hcfree ( hashcat_status ) ;
2016-10-16 17:32:43 +00:00
return ;
}
2016-10-17 21:49:44 +00:00
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
2016-10-16 17:32:43 +00:00
{
2016-10-17 21:49:44 +00:00
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
2016-10-16 17:32:43 +00:00
2016-10-17 21:49:44 +00:00
if ( device_info - > skipped_dev = = true ) continue ;
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2017-10-20 10:19:33 +00:00
event_log_info ( hashcat_ctx , " %d:%u:%d:%d:%.2f:% " PRIu64 , device_id + 1 , hash_mode , device_info - > corespeed_dev , device_info - > memoryspeed_dev , device_info - > exec_msec_dev , ( u64 ) ( device_info - > hashes_msec_dev_benchmark * 1000 ) ) ;
2016-10-16 17:32:43 +00:00
}
2017-05-30 10:15:55 +00:00
status_status_destroy ( hashcat_ctx , hashcat_status ) ;
2016-10-17 21:49:44 +00:00
hcfree ( hashcat_status ) ;
}
void status_benchmark ( hashcat_ctx_t * hashcat_ctx )
{
const user_options_t * user_options = hashcat_ctx - > user_options ;
2016-10-16 17:32:43 +00:00
if ( user_options - > machine_readable = = true )
{
2016-12-09 22:44:43 +00:00
status_benchmark_machine_readable ( hashcat_ctx ) ;
return ;
}
hashcat_status_t * hashcat_status = ( hashcat_status_t * ) hcmalloc ( sizeof ( hashcat_status_t ) ) ;
2019-07-10 14:55:50 +00:00
if ( hashcat_get_status ( hashcat_ctx , hashcat_status ) = = - 1 )
2016-12-09 22:44:43 +00:00
{
hcfree ( hashcat_status ) ;
return ;
}
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
{
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
if ( device_info - > skipped_dev = = true ) continue ;
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2016-12-09 22:44:43 +00:00
event_log_info ( hashcat_ctx ,
2018-09-01 10:31:17 +00:00
" Speed.#%d.........: %9sH/s (%0.2fms) @ Accel:%d Loops:%d Thr:%d Vec:%d " , device_id + 1 ,
2016-12-09 22:44:43 +00:00
device_info - > speed_sec_dev ,
2018-02-02 22:22:21 +00:00
device_info - > exec_msec_dev ,
device_info - > kernel_accel_dev ,
device_info - > kernel_loops_dev ,
device_info - > kernel_threads_dev ,
device_info - > vector_width_dev ) ;
2016-12-09 22:44:43 +00:00
}
if ( hashcat_status - > device_info_active > 1 )
{
event_log_info ( hashcat_ctx ,
2018-09-01 10:31:17 +00:00
" Speed.#*.........: %9sH/s " ,
2016-12-09 22:44:43 +00:00
hashcat_status - > speed_sec_all ) ;
}
2017-05-30 10:15:55 +00:00
status_status_destroy ( hashcat_ctx , hashcat_status ) ;
2016-12-09 22:44:43 +00:00
hcfree ( hashcat_status ) ;
}
void status_speed_machine_readable ( hashcat_ctx_t * hashcat_ctx )
{
hashcat_status_t * hashcat_status = ( hashcat_status_t * ) hcmalloc ( sizeof ( hashcat_status_t ) ) ;
2019-07-10 14:55:50 +00:00
if ( hashcat_get_status ( hashcat_ctx , hashcat_status ) = = - 1 )
2016-12-09 22:44:43 +00:00
{
hcfree ( hashcat_status ) ;
return ;
}
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
{
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
if ( device_info - > skipped_dev = = true ) continue ;
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2017-10-20 10:19:33 +00:00
event_log_info ( hashcat_ctx , " %d:% " PRIu64 , device_id + 1 , ( u64 ) ( device_info - > hashes_msec_dev_benchmark * 1000 ) ) ;
2016-12-09 22:44:43 +00:00
}
2017-05-30 10:15:55 +00:00
status_status_destroy ( hashcat_ctx , hashcat_status ) ;
2016-12-09 22:44:43 +00:00
hcfree ( hashcat_status ) ;
}
2019-03-27 10:09:24 +00:00
void status_speed_json ( hashcat_ctx_t * hashcat_ctx )
{
hashcat_status_t * hashcat_status = ( hashcat_status_t * ) hcmalloc ( sizeof ( hashcat_status_t ) ) ;
2019-07-10 14:55:50 +00:00
if ( hashcat_get_status ( hashcat_ctx , hashcat_status ) = = - 1 )
2019-03-27 10:09:24 +00:00
{
hcfree ( hashcat_status ) ;
return ;
}
2019-04-05 06:52:35 +00:00
2019-04-02 21:06:18 +00:00
printf ( " { \" devices \" : [ " ) ;
2019-04-05 06:52:35 +00:00
2019-04-02 21:53:59 +00:00
int device_num = 0 ;
2019-04-05 06:52:35 +00:00
2019-04-02 20:32:25 +00:00
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
{
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
2019-03-27 11:10:28 +00:00
2019-04-02 20:32:25 +00:00
if ( device_info - > skipped_dev = = true ) continue ;
if ( device_info - > skipped_warning_dev = = true ) continue ;
2019-04-05 06:52:35 +00:00
2019-04-02 21:53:59 +00:00
if ( device_num ! = 0 )
2019-04-02 20:32:25 +00:00
{
2020-06-13 09:19:00 +00:00
printf ( " , " ) ;
2019-04-02 20:32:25 +00:00
}
2019-04-05 06:52:35 +00:00
2019-04-02 21:06:18 +00:00
printf ( " { \" device_id \" : %d, " , device_id + 1 ) ;
printf ( " \" speed \" : % " PRIu64 " } " , ( u64 ) ( device_info - > hashes_msec_dev_benchmark * 1000 ) ) ;
2019-04-02 21:53:59 +00:00
device_num + + ;
2019-04-02 20:32:25 +00:00
}
2020-06-13 09:19:00 +00:00
printf ( " ] } " ) ;
2019-04-05 06:52:35 +00:00
2019-03-27 11:10:28 +00:00
status_status_destroy ( hashcat_ctx , hashcat_status ) ;
hcfree ( hashcat_status ) ;
2019-03-27 10:09:24 +00:00
}
2016-12-09 22:44:43 +00:00
void status_speed ( hashcat_ctx_t * hashcat_ctx )
{
const user_options_t * user_options = hashcat_ctx - > user_options ;
if ( user_options - > machine_readable = = true )
{
status_speed_machine_readable ( hashcat_ctx ) ;
2016-10-16 17:32:43 +00:00
return ;
}
2019-04-05 06:52:35 +00:00
2019-03-27 10:09:24 +00:00
if ( user_options - > status_json = = true )
{
status_speed_json ( hashcat_ctx ) ;
return ;
}
2016-10-16 17:32:43 +00:00
2016-11-20 21:54:52 +00:00
hashcat_status_t * hashcat_status = ( hashcat_status_t * ) hcmalloc ( sizeof ( hashcat_status_t ) ) ;
2016-10-16 17:32:43 +00:00
2019-07-10 14:55:50 +00:00
if ( hashcat_get_status ( hashcat_ctx , hashcat_status ) = = - 1 )
2016-10-16 17:32:43 +00:00
{
2016-10-17 21:49:44 +00:00
hcfree ( hashcat_status ) ;
2016-10-16 17:32:43 +00:00
2016-10-17 21:49:44 +00:00
return ;
2016-10-16 17:32:43 +00:00
}
2016-10-17 21:49:44 +00:00
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
2016-10-16 17:32:43 +00:00
{
2016-10-17 21:49:44 +00:00
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
2016-10-16 17:32:43 +00:00
2016-10-17 21:49:44 +00:00
if ( device_info - > skipped_dev = = true ) continue ;
2016-10-16 17:32:43 +00:00
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2018-09-01 10:31:17 +00:00
" Speed.#%d.........: %9sH/s (%0.2fms) " , device_id + 1 ,
2016-10-17 21:49:44 +00:00
device_info - > speed_sec_dev ,
device_info - > exec_msec_dev ) ;
2016-10-16 17:32:43 +00:00
}
2016-10-17 21:49:44 +00:00
if ( hashcat_status - > device_info_active > 1 )
2016-10-16 17:32:43 +00:00
{
2016-10-17 21:49:44 +00:00
event_log_info ( hashcat_ctx ,
2018-09-01 10:31:17 +00:00
" Speed.#*.........: %9sH/s " ,
2016-10-17 21:49:44 +00:00
hashcat_status - > speed_sec_all ) ;
2016-10-16 17:32:43 +00:00
}
2017-05-30 10:15:55 +00:00
status_status_destroy ( hashcat_ctx , hashcat_status ) ;
2016-10-17 21:49:44 +00:00
hcfree ( hashcat_status ) ;
2016-10-16 17:32:43 +00:00
}
2016-12-09 22:44:43 +00:00
void status_progress_machine_readable ( hashcat_ctx_t * hashcat_ctx )
{
hashcat_status_t * hashcat_status = ( hashcat_status_t * ) hcmalloc ( sizeof ( hashcat_status_t ) ) ;
2019-07-10 14:55:50 +00:00
if ( hashcat_get_status ( hashcat_ctx , hashcat_status ) = = - 1 )
2016-12-09 22:44:43 +00:00
{
hcfree ( hashcat_status ) ;
return ;
}
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
{
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
if ( device_info - > skipped_dev = = true ) continue ;
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2018-02-08 18:13:29 +00:00
event_log_info ( hashcat_ctx , " %d:% " PRIu64 " :%0.2f " , device_id + 1 , device_info - > progress_dev , device_info - > runtime_msec_dev ) ;
2016-12-09 22:44:43 +00:00
}
2017-05-30 10:15:55 +00:00
status_status_destroy ( hashcat_ctx , hashcat_status ) ;
2016-12-09 22:44:43 +00:00
hcfree ( hashcat_status ) ;
}
2019-03-27 10:09:24 +00:00
void status_progress_json ( hashcat_ctx_t * hashcat_ctx )
{
hashcat_status_t * hashcat_status = ( hashcat_status_t * ) hcmalloc ( sizeof ( hashcat_status_t ) ) ;
2019-07-10 14:55:50 +00:00
if ( hashcat_get_status ( hashcat_ctx , hashcat_status ) = = - 1 )
2019-03-27 10:09:24 +00:00
{
hcfree ( hashcat_status ) ;
return ;
}
2019-04-05 06:52:35 +00:00
2019-04-02 21:06:18 +00:00
printf ( " { \" devices \" : [ " ) ;
2019-04-05 06:52:35 +00:00
2019-04-02 21:53:59 +00:00
int device_num = 0 ;
2019-04-05 06:52:35 +00:00
2019-04-02 20:32:25 +00:00
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
{
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
if ( device_info - > skipped_dev = = true ) continue ;
if ( device_info - > skipped_warning_dev = = true ) continue ;
2019-04-05 06:52:35 +00:00
2019-04-02 21:53:59 +00:00
if ( device_num ! = 0 )
2019-04-02 20:32:25 +00:00
{
2020-06-13 09:19:00 +00:00
printf ( " , " ) ;
2019-04-02 20:32:25 +00:00
}
2019-04-05 06:52:35 +00:00
2019-04-02 21:06:18 +00:00
printf ( " { \" device_id \" : %d, " , device_id + 1 ) ;
2019-04-02 20:32:25 +00:00
printf ( " \" progress \" : % " PRIu64 " , " , device_info - > progress_dev ) ;
2019-04-02 21:06:18 +00:00
printf ( " \" runtime \" : %0.2f } " , device_info - > runtime_msec_dev ) ;
2019-04-02 21:53:59 +00:00
device_num + + ;
2019-04-02 20:32:25 +00:00
}
2019-07-10 14:55:50 +00:00
2020-06-13 09:19:00 +00:00
printf ( " ] } " ) ;
2019-04-05 06:52:35 +00:00
2019-03-27 11:10:28 +00:00
status_status_destroy ( hashcat_ctx , hashcat_status ) ;
hcfree ( hashcat_status ) ;
2019-03-27 10:09:24 +00:00
}
2016-12-09 22:44:43 +00:00
void status_progress ( hashcat_ctx_t * hashcat_ctx )
{
const user_options_t * user_options = hashcat_ctx - > user_options ;
if ( user_options - > machine_readable = = true )
{
status_progress_machine_readable ( hashcat_ctx ) ;
return ;
}
2019-04-05 06:52:35 +00:00
2019-03-27 10:09:24 +00:00
if ( user_options - > status_json = = true )
{
status_progress_json ( hashcat_ctx ) ;
return ;
}
2016-12-09 22:44:43 +00:00
hashcat_status_t * hashcat_status = ( hashcat_status_t * ) hcmalloc ( sizeof ( hashcat_status_t ) ) ;
2019-07-10 14:55:50 +00:00
if ( hashcat_get_status ( hashcat_ctx , hashcat_status ) = = - 1 )
2016-12-09 22:44:43 +00:00
{
hcfree ( hashcat_status ) ;
return ;
}
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
{
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
if ( device_info - > skipped_dev = = true ) continue ;
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2016-12-09 22:44:43 +00:00
event_log_info ( hashcat_ctx ,
2018-09-01 10:31:17 +00:00
" Progress.#%d......: % " PRIu64 , device_id + 1 ,
2016-12-09 22:44:43 +00:00
device_info - > progress_dev ) ;
}
for ( int device_id = 0 ; device_id < hashcat_status - > device_info_cnt ; device_id + + )
{
const device_info_t * device_info = hashcat_status - > device_info_buf + device_id ;
if ( device_info - > skipped_dev = = true ) continue ;
2019-03-04 09:29:57 +00:00
if ( device_info - > skipped_warning_dev = = true ) continue ;
2016-12-09 22:44:43 +00:00
event_log_info ( hashcat_ctx ,
2018-09-01 10:31:17 +00:00
" Runtime.#%d.......: %0.2fms " , device_id + 1 ,
2016-12-09 22:44:43 +00:00
device_info - > runtime_msec_dev ) ;
}
2017-05-30 10:15:55 +00:00
status_status_destroy ( hashcat_ctx , hashcat_status ) ;
2016-12-09 22:44:43 +00:00
hcfree ( hashcat_status ) ;
}