Get rid of logging.c and most exit() calls replaced with return() for true library usage

pull/544/head
jsteube 8 years ago
parent 7ed79bf42e
commit 27bec8be13

@ -34,11 +34,11 @@ void *hc_dlsym (void *module, const char *symbol);
if (noerr != -1) { \
if (!ptr->name) { \
if (noerr == 1) { \
log_error ("ERROR: %s is missing from %s shared library.", #name, #libname); \
exit (-1); \
} else { \
log_info ("WARNING: %s is missing from %s shared library.", #name, #libname); \
event_log_error (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
return -1; \
} else { \
event_log_warning (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
return 0; \
} \
} \
}
@ -48,11 +48,11 @@ void *hc_dlsym (void *module, const char *symbol);
if (noerr != -1) { \
if (!ptr->name) { \
if (noerr == 1) { \
log_error ("ERROR: %s is missing from %s shared library.", #name, #libname); \
exit (-1); \
} else { \
log_info ("WARNING: %s is missing from %s shared library.", #name, #libname); \
event_log_error (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
return -1; \
} else { \
event_log_warning (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
return 0; \
} \
} \
}
@ -61,13 +61,12 @@ void *hc_dlsym (void *module, const char *symbol);
ptr->name = (type) (*ptr->func) (addr); \
if (!ptr->name) { \
if (noerr == 1) { \
log_error ("ERROR: %s at address %08x is missing from %s shared library.", #name, addr, #libname); \
exit (-1); \
} else { \
log_error ("WARNING: %s at address %08x is missing from %s shared library.", #name, addr, #libname); \
event_log_error (hashcat_ctx, "%s at address %08x is missing from %s shared library.", #name, addr, #libname); \
return -1; \
} else { \
event_log_warning (hashcat_ctx, "%s at address %08x is missing from %s shared library.", #name, addr, #libname); \
return 0; \
} \
}
#endif // _DYNALOADER_H

@ -352,44 +352,6 @@ typedef struct hm_adl_lib
typedef hm_adl_lib_t ADL_PTR;
int adl_init (ADL_PTR *lib);
void adl_close (ADL_PTR *lib);
void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize);
int hm_ADL_Main_Control_Destroy (ADL_PTR *adl);
int hm_ADL_Main_Control_Create (ADL_PTR *adl, ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters);
int hm_ADL_Adapter_NumberOfAdapters_Get (ADL_PTR *adl, int *lpNumAdapters);
int hm_ADL_Adapter_AdapterInfo_Get (ADL_PTR *adl, LPAdapterInfo lpInfo, int iInputSize);
int hm_ADL_Display_DisplayInfo_Get (ADL_PTR *adl, int iAdapterIndex, int *iNumDisplays, ADLDisplayInfo **lppInfo, int iForceDetect);
int hm_ADL_Overdrive5_Temperature_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature);
int hm_ADL_Overdrive6_Temperature_Get (ADL_PTR *adl, int iAdapterIndex, int *iTemperature);
int hm_ADL_Overdrive_CurrentActivity_Get (ADL_PTR *adl, int iAdapterIndex, ADLPMActivity *lpActivity);
int hm_ADL_Overdrive_ThermalDevices_Enum (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLThermalControllerInfo *lpThermalControllerInfo);
int hm_ADL_Adapter_ID_Get (ADL_PTR *adl, int iAdapterIndex, int *lpAdapterID);
int hm_ADL_Adapter_VideoBiosInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLBiosInfo *lpBiosInfo);
int hm_ADL_Overdrive5_FanSpeedInfo_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedInfo *lpFanSpeedInfo);
int hm_ADL_Overdrive5_FanSpeed_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
int hm_ADL_Overdrive6_FanSpeed_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo);
int hm_ADL_Overdrive5_FanSpeed_Set (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
int hm_ADL_Overdrive6_FanSpeed_Set (ADL_PTR *adl, int iAdapterIndex, ADLOD6FanSpeedValue *lpFanSpeedValue);
int hm_ADL_Overdrive5_FanSpeedToDefault_Set (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex);
int hm_ADL_Overdrive_ODParameters_Get (ADL_PTR *adl, int iAdapterIndex, ADLODParameters *lpOdParameters);
int hm_ADL_Overdrive_ODPerformanceLevels_Get (ADL_PTR *adl, int iAdapterIndex, int iDefault, ADLODPerformanceLevels *lpOdPerformanceLevels);
int hm_ADL_Overdrive_ODPerformanceLevels_Set (ADL_PTR *adl, int iAdapterIndex, ADLODPerformanceLevels *lpOdPerformanceLevels);
int hm_ADL_Overdrive_PowerControlInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6PowerControlInfo *);
int hm_ADL_Overdrive_PowerControl_Get (ADL_PTR *adl, int iAdapterIndex, int *level);
int hm_ADL_Overdrive_PowerControl_Set (ADL_PTR *adl, int iAdapterIndex, int level);
int hm_ADL_Adapter_Active_Get (ADL_PTR *adl, int iAdapterIndex, int *lpStatus);
//int hm_ADL_DisplayEnable_Set (ADL_PTR *adl, int iAdapterIndex, int *lpDisplayIndexList, int iDisplayListSize, int bPersistOnly);
int hm_ADL_Overdrive_Caps (ADL_PTR *adl, int iAdapterIndex, int *od_supported, int *od_enabled, int *od_version);
int hm_ADL_Overdrive_CurrentStatus_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6CurrentStatus *status);
int hm_ADL_Overdrive_StateInfo_Get (ADL_PTR *adl, int iAdapterIndex, int type, ADLOD6MemClockState *state);
int hm_ADL_Overdrive_Capabilities_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6Capabilities *caps);
int hm_ADL_Overdrive_State_Set (ADL_PTR *adl, int iAdapterIndex, int type, ADLOD6StateInfo *state);
int hm_ADL_Overdrive6_PowerControl_Caps (ADL_PTR *adl, int iAdapterIndex, int *lpSupported);
int hm_ADL_Overdrive6_TargetTemperatureData_Get (ADL_PTR *adl, int iAdapterIndex, int *cur_temp, int *default_temp);
int hm_ADL_Overdrive6_TargetTemperatureRangeInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6ParameterRange *lpTargetTemperatureInfo);
int hm_ADL_Overdrive6_FanSpeed_Reset (ADL_PTR *adl, int iAdapterIndex);
#endif // _EXT_ADL_H

@ -109,40 +109,4 @@ typedef hc_opencl_lib_t OCL_PTR;
const char *val2cstr_cl (cl_int CL_err);
int ocl_init (OCL_PTR *ocl);
void ocl_close (OCL_PTR *ocl);
cl_int hc_clBuildProgram (OCL_PTR *ocl, cl_program program, cl_uint num_devices, const cl_device_id *device_list, const char *options, void (CL_CALLBACK *pfn_notify) (cl_program program, void *user_data), void *user_data);
cl_int hc_clCreateBuffer (OCL_PTR *ocl, cl_context context, cl_mem_flags flags, size_t size, void *host_ptr, cl_mem *mem);
cl_int hc_clCreateCommandQueue (OCL_PTR *ocl, cl_context context, cl_device_id device, cl_command_queue_properties properties, cl_command_queue *command_queue);
cl_int hc_clCreateContext (OCL_PTR *ocl, cl_context_properties *properties, cl_uint num_devices, const cl_device_id *devices, void (CL_CALLBACK *pfn_notify) (const char *, const void *, size_t, void *), void *user_data, cl_context *context);
cl_int hc_clCreateKernel (OCL_PTR *ocl, cl_program program, const char *kernel_name, cl_kernel *kernel);
cl_int hc_clCreateProgramWithBinary (OCL_PTR *ocl, cl_context context, cl_uint num_devices, const cl_device_id *device_list, const size_t *lengths, const unsigned char **binaries, cl_int *binary_status, cl_program *program);
cl_int hc_clCreateProgramWithSource (OCL_PTR *ocl, cl_context context, cl_uint count, const char **strings, const size_t *lengths, cl_program *program);
cl_int hc_clEnqueueCopyBuffer (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, size_t src_offset, size_t dst_offset, size_t cb, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
cl_int hc_clEnqueueMapBuffer (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map, cl_map_flags map_flags, size_t offset, size_t cb, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event, void **buf);
cl_int hc_clEnqueueNDRangeKernel (OCL_PTR *ocl, cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, const size_t *global_work_offset, const size_t *global_work_size, const size_t *local_work_size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
cl_int hc_clEnqueueReadBuffer (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, size_t offset, size_t cb, void *ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
cl_int hc_clEnqueueUnmapMemObject (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem memobj, void *mapped_ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
cl_int hc_clEnqueueWriteBuffer (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, size_t offset, size_t cb, const void *ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
cl_int hc_clFinish (OCL_PTR *ocl, cl_command_queue command_queue);
cl_int hc_clFlush (OCL_PTR *ocl, cl_command_queue command_queue);
cl_int hc_clGetDeviceIDs (OCL_PTR *ocl, cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices);
cl_int hc_clGetDeviceInfo (OCL_PTR *ocl, cl_device_id device, cl_device_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret);
cl_int hc_clGetEventInfo (OCL_PTR *ocl, cl_event event, cl_event_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret);
cl_int hc_clGetEventProfilingInfo (OCL_PTR *ocl, cl_event event, cl_profiling_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret);
cl_int hc_clGetKernelWorkGroupInfo (OCL_PTR *ocl, cl_kernel kernel, cl_device_id device, cl_kernel_work_group_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret);
cl_int hc_clGetPlatformIDs (OCL_PTR *ocl, cl_uint num_entries, cl_platform_id *platforms, cl_uint *num_platforms);
cl_int hc_clGetPlatformInfo (OCL_PTR *ocl, cl_platform_id platform, cl_platform_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret);
cl_int hc_clGetProgramBuildInfo (OCL_PTR *ocl, cl_program program, cl_device_id device, cl_program_build_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret);
cl_int hc_clGetProgramInfo (OCL_PTR *ocl, cl_program program, cl_program_info param_name, size_t param_value_size, void *param_value, size_t * param_value_size_ret);
cl_int hc_clReleaseCommandQueue (OCL_PTR *ocl, cl_command_queue command_queue);
cl_int hc_clReleaseContext (OCL_PTR *ocl, cl_context context);
cl_int hc_clReleaseEvent (OCL_PTR *ocl, cl_event event);
cl_int hc_clReleaseKernel (OCL_PTR *ocl, cl_kernel kernel);
cl_int hc_clReleaseMemObject (OCL_PTR *ocl, cl_mem mem);
cl_int hc_clReleaseProgram (OCL_PTR *ocl, cl_program program);
cl_int hc_clSetKernelArg (OCL_PTR *ocl, cl_kernel kernel, cl_uint arg_index, size_t arg_size, const void *arg_value);
cl_int hc_clWaitForEvents (OCL_PTR *ocl, cl_uint num_events, const cl_event *event_list);
#endif // _EXT_OPENCL_H

@ -255,18 +255,4 @@ typedef struct hm_nvapi_lib
typedef hm_nvapi_lib_t NVAPI_PTR;
int nvapi_init (NVAPI_PTR *nvapi);
void nvapi_close (NVAPI_PTR *nvapi);
int hm_NvAPI_QueryInterface (NVAPI_PTR *nvapi, unsigned int offset);
int hm_NvAPI_GetErrorMessage (NVAPI_PTR *nvapi, NvAPI_Status nr, NvAPI_ShortString szDesc);
NvAPI_Status hm_NvAPI_Initialize (NVAPI_PTR *nvapi);
NvAPI_Status hm_NvAPI_Unload (NVAPI_PTR *nvapi);
NvAPI_Status hm_NvAPI_EnumPhysicalGPUs (NVAPI_PTR *nvapi, NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
NvAPI_Status hm_NvAPI_GPU_GetPerfPoliciesInfo (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 *perfPolicies_info);
NvAPI_Status hm_NvAPI_GPU_GetPerfPoliciesStatus (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 *perfPolicies_status);
NvAPI_Status hm_NvAPI_GPU_SetCoolerLevels (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex, NV_GPU_COOLER_LEVELS *pCoolerLevels);
NvAPI_Status hm_NvAPI_GPU_RestoreCoolerSettings (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex);
#endif // _EXT_NVAPI_H

@ -221,28 +221,4 @@ typedef struct hm_nvml_lib
typedef hm_nvml_lib_t NVML_PTR;
int nvml_init (NVML_PTR *lib);
void nvml_close (NVML_PTR *lib);
const char * hm_NVML_nvmlErrorString (NVML_PTR *nvml, nvmlReturn_t nvml_rc);
nvmlReturn_t hm_NVML_nvmlInit (NVML_PTR *nvml);
nvmlReturn_t hm_NVML_nvmlShutdown (NVML_PTR *nvml);
nvmlReturn_t hm_NVML_nvmlDeviceGetName (NVML_PTR *nvml, int, nvmlDevice_t device, char *name, unsigned int length);
nvmlReturn_t hm_NVML_nvmlDeviceGetHandleByIndex (NVML_PTR *nvml, int, unsigned int index, nvmlDevice_t *device);
nvmlReturn_t hm_NVML_nvmlDeviceGetTemperature (NVML_PTR *nvml, int, nvmlDevice_t device, nvmlTemperatureSensors_t sensorType, unsigned int *temp);
nvmlReturn_t hm_NVML_nvmlDeviceGetFanSpeed (NVML_PTR *nvml, int, nvmlDevice_t device, unsigned int *speed);
nvmlReturn_t hm_NVML_nvmlDeviceGetPowerUsage (NVML_PTR *nvml, int, nvmlDevice_t device, unsigned int *power);
nvmlReturn_t hm_NVML_nvmlDeviceGetUtilizationRates (NVML_PTR *nvml, int, nvmlDevice_t device, nvmlUtilization_t *utilization);
nvmlReturn_t hm_NVML_nvmlDeviceGetClockInfo (NVML_PTR *nvml, int, nvmlDevice_t device, nvmlClockType_t type, unsigned int *clock);
nvmlReturn_t hm_NVML_nvmlDeviceGetTemperatureThreshold (NVML_PTR *nvml, int, nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int *temp);
nvmlReturn_t hm_NVML_nvmlDeviceGetCurrPcieLinkGeneration (NVML_PTR *nvml, int, nvmlDevice_t device, unsigned int *currLinkGen);
nvmlReturn_t hm_NVML_nvmlDeviceGetCurrPcieLinkWidth (NVML_PTR *nvml, int, nvmlDevice_t device, unsigned int *currLinkWidth);
nvmlReturn_t hm_NVML_nvmlDeviceGetCurrentClocksThrottleReasons (NVML_PTR *nvml, int, nvmlDevice_t device, unsigned long long *clocksThrottleReasons);
nvmlReturn_t hm_NVML_nvmlDeviceGetSupportedClocksThrottleReasons (NVML_PTR *nvml, int, nvmlDevice_t device, unsigned long long *supportedClocksThrottleReasons);
nvmlReturn_t hm_NVML_nvmlDeviceSetComputeMode (NVML_PTR *nvml, int, nvmlDevice_t device, nvmlComputeMode_t mode);
nvmlReturn_t hm_NVML_nvmlDeviceSetGpuOperationMode (NVML_PTR *nvml, int, nvmlDevice_t device, nvmlGpuOperationMode_t mode);
nvmlReturn_t hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (NVML_PTR *nvml, int, nvmlDevice_t device, unsigned int *minLimit, unsigned int *maxLimit);
nvmlReturn_t hm_NVML_nvmlDeviceSetPowerManagementLimit (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned int limit);
nvmlReturn_t hm_NVML_nvmlDeviceGetPowerManagementLimit (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned int *limit);
#endif // _NVML_H

@ -72,19 +72,4 @@ typedef struct hm_xnvctrl_lib
typedef hm_xnvctrl_lib_t XNVCTRL_PTR;
int xnvctrl_init (XNVCTRL_PTR *xnvctrl);
void xnvctrl_close (XNVCTRL_PTR *xnvctrl);
int hm_XNVCTRL_XOpenDisplay (XNVCTRL_PTR *xnvctrl);
void hm_XNVCTRL_XCloseDisplay (XNVCTRL_PTR *xnvctrl);
int get_core_threshold (XNVCTRL_PTR *xnvctrl, int gpu, int *val);
int get_fan_control (XNVCTRL_PTR *xnvctrl, int gpu, int *val);
int set_fan_control (XNVCTRL_PTR *xnvctrl, int gpu, int val);
int get_fan_speed_current (XNVCTRL_PTR *xnvctrl, int gpu, int *val);
int get_fan_speed_target (XNVCTRL_PTR *xnvctrl, int gpu, int *val);
int set_fan_speed_target (XNVCTRL_PTR *xnvctrl, int gpu, int val);
#endif // _EXT_XNVCTRL_H

@ -29,7 +29,6 @@
int sort_by_stringptr (const void *p1, const void *p2);
char *get_exec_path (void);
char *get_install_dir (const char *progname);
char *get_profile_dir (const char *homedir);
char *get_session_dir (const char *profile_dir);

@ -11,7 +11,7 @@ int sort_by_salt (const void *v1, const void *v2);
int sort_by_hash (const void *v1, const void *v2, void *v3);
int sort_by_hash_no_salt (const void *v1, const void *v2, void *v3);
void save_hash (hashcat_ctx_t *hashcat_ctx);
int save_hash (hashcat_ctx_t *hashcat_ctx);
void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain);

@ -6,6 +6,109 @@
#ifndef _HWMON_H
#define _HWMON_H
// nvml functions
int nvml_init (hashcat_ctx_t *hashcat_ctx);
void nvml_close (hashcat_ctx_t *hashcat_ctx);
int hm_NVML_nvmlInit (hashcat_ctx_t *hashcat_ctx);
int hm_NVML_nvmlShutdown (hashcat_ctx_t *hashcat_ctx);
int hm_NVML_nvmlDeviceGetHandleByIndex (hashcat_ctx_t *hashcat_ctx, unsigned int index, nvmlDevice_t *device);
int hm_NVML_nvmlDeviceGetName (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, char *name, unsigned int length);
int hm_NVML_nvmlDeviceGetTemperature (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, nvmlTemperatureSensors_t sensorType, unsigned int *temp);
int hm_NVML_nvmlDeviceGetFanSpeed (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, unsigned int *speed);
int hm_NVML_nvmlDeviceGetPowerUsage (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, unsigned int *power);
int hm_NVML_nvmlDeviceGetUtilizationRates (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, nvmlUtilization_t *utilization);
int hm_NVML_nvmlDeviceGetClockInfo (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, nvmlClockType_t type, unsigned int *clock);
int hm_NVML_nvmlDeviceGetTemperatureThreshold (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int *temp);
int hm_NVML_nvmlDeviceGetCurrPcieLinkGeneration (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, unsigned int *currLinkGen);
int hm_NVML_nvmlDeviceGetCurrPcieLinkWidth (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, unsigned int *currLinkWidth);
int hm_NVML_nvmlDeviceGetCurrentClocksThrottleReasons (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, unsigned long long *clocksThrottleReasons);
int hm_NVML_nvmlDeviceGetSupportedClocksThrottleReasons (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, unsigned long long *supportedClocksThrottleReasons);
int hm_NVML_nvmlDeviceSetComputeMode (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, nvmlComputeMode_t mode);
int hm_NVML_nvmlDeviceSetGpuOperationMode (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, nvmlGpuOperationMode_t mode);
int hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, unsigned int *minLimit, unsigned int *maxLimit);
int hm_NVML_nvmlDeviceSetPowerManagementLimit (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, unsigned int limit);
int hm_NVML_nvmlDeviceGetPowerManagementLimit (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, unsigned int *limit);
// nvapi functions
int nvapi_init (hashcat_ctx_t *hashcat_ctx);
void nvapi_close (hashcat_ctx_t *hashcat_ctx);
int hm_NvAPI_QueryInterface (hashcat_ctx_t *hashcat_ctx, unsigned int offset);
int hm_NvAPI_Initialize (hashcat_ctx_t *hashcat_ctx);
int hm_NvAPI_Unload (hashcat_ctx_t *hashcat_ctx);
int hm_NvAPI_EnumPhysicalGPUs (hashcat_ctx_t *hashcat_ctx, NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
int hm_NvAPI_GPU_GetPerfPoliciesInfo (hashcat_ctx_t *hashcat_ctx, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 *perfPolicies_info);
int hm_NvAPI_GPU_GetPerfPoliciesStatus (hashcat_ctx_t *hashcat_ctx, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 *perfPolicies_status);
int hm_NvAPI_GPU_SetCoolerLevels (hashcat_ctx_t *hashcat_ctx, NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex, NV_GPU_COOLER_LEVELS *pCoolerLevels);
int hm_NvAPI_GPU_RestoreCoolerSettings (hashcat_ctx_t *hashcat_ctx, NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex);
// xnvctrl functions
int xnvctrl_init (hashcat_ctx_t *hashcat_ctx);
void xnvctrl_close (hashcat_ctx_t *hashcat_ctx);
int hm_XNVCTRL_XOpenDisplay (hashcat_ctx_t *hashcat_ctx);
void hm_XNVCTRL_XCloseDisplay (hashcat_ctx_t *hashcat_ctx);
int get_core_threshold (hashcat_ctx_t *hashcat_ctx, const int gpu, int *val);
int get_fan_control (hashcat_ctx_t *hashcat_ctx, const int gpu, int *val);
int set_fan_control (hashcat_ctx_t *hashcat_ctx, const int gpu, int val);
int get_fan_speed_current (hashcat_ctx_t *hashcat_ctx, const int gpu, int *val);
int get_fan_speed_target (hashcat_ctx_t *hashcat_ctx, const int gpu, int *val);
int set_fan_speed_target (hashcat_ctx_t *hashcat_ctx, const int gpu, int val);
// ADL functions
int adl_init (hashcat_ctx_t *hashcat_ctx);
void adl_close (hashcat_ctx_t *hashcat_ctx);
int hm_ADL_Main_Control_Destroy (hashcat_ctx_t *hashcat_ctx);
int hm_ADL_Main_Control_Create (hashcat_ctx_t *hashcat_ctx, ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters);
int hm_ADL_Adapter_NumberOfAdapters_Get (hashcat_ctx_t *hashcat_ctx, int *lpNumAdapters);
int hm_ADL_Adapter_AdapterInfo_Get (hashcat_ctx_t *hashcat_ctx, LPAdapterInfo lpInfo, int iInputSize);
int hm_ADL_Display_DisplayInfo_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int *iNumDisplays, ADLDisplayInfo **lppInfo, int iForceDetect);
int hm_ADL_Overdrive5_Temperature_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature);
int hm_ADL_Overdrive6_Temperature_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int *iTemperature);
int hm_ADL_Overdrive_CurrentActivity_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, ADLPMActivity *lpActivity);
int hm_ADL_Overdrive_ThermalDevices_Enum (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int iThermalControllerIndex, ADLThermalControllerInfo *lpThermalControllerInfo);
int hm_ADL_Adapter_ID_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int *lpAdapterID);
int hm_ADL_Adapter_VideoBiosInfo_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, ADLBiosInfo *lpBiosInfo);
int hm_ADL_Overdrive5_FanSpeedInfo_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedInfo *lpFanSpeedInfo);
int hm_ADL_Overdrive5_FanSpeed_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
int hm_ADL_Overdrive6_FanSpeed_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo);
int hm_ADL_Overdrive5_FanSpeed_Set (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
int hm_ADL_Overdrive6_FanSpeed_Set (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, ADLOD6FanSpeedValue *lpFanSpeedValue);
int hm_ADL_Overdrive5_FanSpeedToDefault_Set (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int iThermalControllerIndex);
int hm_ADL_Overdrive_ODParameters_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, ADLODParameters *lpOdParameters);
int hm_ADL_Overdrive_ODPerformanceLevels_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int iDefault, ADLODPerformanceLevels *lpOdPerformanceLevels);
int hm_ADL_Overdrive_ODPerformanceLevels_Set (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, ADLODPerformanceLevels *lpOdPerformanceLevels);
int hm_ADL_Overdrive_PowerControlInfo_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, ADLOD6PowerControlInfo *);
int hm_ADL_Overdrive_PowerControl_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int *level);
int hm_ADL_Overdrive_PowerControl_Set (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int level);
int hm_ADL_Adapter_Active_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int *lpStatus);
//int hm_ADL_DisplayEnable_Set (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int *lpDisplayIndexList, int iDisplayListSize, int bPersistOnly);
int hm_ADL_Overdrive_Caps (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int *od_supported, int *od_enabled, int *od_version);
int hm_ADL_Overdrive_CurrentStatus_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, ADLOD6CurrentStatus *status);
int hm_ADL_Overdrive_StateInfo_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int type, ADLOD6MemClockState *state);
int hm_ADL_Overdrive_Capabilities_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, ADLOD6Capabilities *caps);
int hm_ADL_Overdrive_State_Set (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int type, ADLOD6StateInfo *state);
int hm_ADL_Overdrive6_PowerControl_Caps (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int *lpSupported);
int hm_ADL_Overdrive6_TargetTemperatureData_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, int *cur_temp, int *default_temp);
int hm_ADL_Overdrive6_TargetTemperatureRangeInfo_Get (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, ADLOD6ParameterRange *lpTargetTemperatureInfo);
int hm_ADL_Overdrive6_FanSpeed_Reset (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex);
// general functions
int hm_get_threshold_slowdown_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device_id);
int hm_get_threshold_shutdown_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device_id);
int hm_get_temperature_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device_id);

@ -15,13 +15,13 @@
#if defined (F_SETLKW)
void lock_file (FILE *fp);
int lock_file (FILE *fp);
void unlock_file (FILE *fp);
#else
#define lock_file(dummy) {}
#define unlock_file(dummy) {}
#define lock_file(dummy) 0
#define unlock_file(dummy)
#endif

@ -1,20 +0,0 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#ifndef _LOGGING_H
#define _LOGGING_H
#include <stdio.h>
#include <stdarg.h>
int log_out_nn (FILE *fp, const char *fmt, ...);
int log_info_nn (const char *fmt, ...);
int log_error_nn (const char *fmt, ...);
int log_out (FILE *fp, const char *fmt, ...);
int log_info (const char *fmt, ...);
int log_error (const char *fmt, ...);
#endif // _LOGGING_H

@ -6,6 +6,7 @@
#ifndef _MEMORY_H
#define _MEMORY_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

@ -23,20 +23,18 @@
void mp_css_split_cnt (const mask_ctx_t *mask_ctx, const hashconfig_t *hashconfig, const u32 css_cnt_orig, u32 css_cnt_rl[2]);
void mp_css_append_salt (mask_ctx_t *mask_ctx, salt_t *salt_buf);
void mp_css_unicode_expand (mask_ctx_t *mask_ctx);
void mp_css_to_uniq_tbl (u32 css_cnt, cs_t *css, u32 uniq_tbls[SP_PW_MAX][CHARSIZ]);
int mp_css_to_uniq_tbl (hashcat_ctx_t *hashcat_ctx, u32 css_cnt, cs_t *css, u32 uniq_tbls[SP_PW_MAX][CHARSIZ]);
void mp_cut_at (char *mask, u32 max);
u32 mp_get_length (char *mask);
void mp_exec (u64 val, char *buf, cs_t *css, int css_cnt);
cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, u32 *css_cnt, const hashconfig_t *hashconfig, const user_options_t *user_options);
u64 mp_get_sum (u32 css_cnt, cs_t *css);
void mp_setup_sys (cs_t *mp_sys);
void mp_setup_usr (cs_t *mp_sys, cs_t *mp_usr, char *buf, u32 index, const hashconfig_t *hashconfig, const user_options_t *user_options);
int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr, char *buf, u32 index);
void mp_reset_usr (cs_t *mp_usr, u32 index);
u64 sp_get_sum (u32 start, u32 stop, cs_t *root_css_buf);
void sp_exec (u64 ctx, char *pw_buf, cs_t *root_css_buf, cs_t *markov_css_buf, u32 start, u32 stop);
int sp_comp_val (const void *p1, const void *p2);
void sp_setup_tbl (const char *install_dir, char *hcstat, u32 disable, u32 classic, hcstat_table_t *root_table_buf, hcstat_table_t *markov_table_buf);
void sp_tbl_to_css (hcstat_table_t *root_table_buf, hcstat_table_t *markov_table_buf, cs_t *root_css_buf, cs_t *markov_css_buf, u32 threshold, u32 uniq_tbls[SP_PW_MAX][CHARSIZ]);
void sp_stretch_markov (hcstat_table_t *in, hcstat_table_t *out);
void sp_stretch_root (hcstat_table_t *in, hcstat_table_t *out);

@ -18,6 +18,42 @@ static const char CL_VENDOR_MESA[] = "Mesa";
static const char CL_VENDOR_NV[] = "NVIDIA Corporation";
static const char CL_VENDOR_POCL[] = "The pocl project";
int ocl_init (hashcat_ctx_t *hashcat_ctx);
void ocl_close (hashcat_ctx_t *hashcat_ctx);
int hc_clBuildProgram (hashcat_ctx_t *hashcat_ctx, cl_program program, cl_uint num_devices, const cl_device_id *device_list, const char *options, void (CL_CALLBACK *pfn_notify) (cl_program program, void *user_data), void *user_data);
int hc_clCreateBuffer (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_mem_flags flags, size_t size, void *host_ptr, cl_mem *mem);
int hc_clCreateCommandQueue (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_device_id device, cl_command_queue_properties properties, cl_command_queue *command_queue);
int hc_clCreateContext (hashcat_ctx_t *hashcat_ctx, cl_context_properties *properties, cl_uint num_devices, const cl_device_id *devices, void (CL_CALLBACK *pfn_notify) (const char *, const void *, size_t, void *), void *user_data, cl_context *context);
int hc_clCreateKernel (hashcat_ctx_t *hashcat_ctx, cl_program program, const char *kernel_name, cl_kernel *kernel);
int hc_clCreateProgramWithBinary (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint num_devices, const cl_device_id *device_list, const size_t *lengths, const unsigned char **binaries, cl_int *binary_status, cl_program *program);
int hc_clCreateProgramWithSource (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint count, const char **strings, const size_t *lengths, cl_program *program);
int hc_clEnqueueCopyBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, size_t src_offset, size_t dst_offset, size_t cb, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
int hc_clEnqueueMapBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map, cl_map_flags map_flags, size_t offset, size_t cb, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event, void **buf);
int hc_clEnqueueNDRangeKernel (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, const size_t *global_work_offset, const size_t *global_work_size, const size_t *local_work_size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
int hc_clEnqueueReadBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, size_t offset, size_t cb, void *ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
int hc_clEnqueueUnmapMemObject (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem memobj, void *mapped_ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
int hc_clEnqueueWriteBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, size_t offset, size_t cb, const void *ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
int hc_clFinish (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue);
int hc_clFlush (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue);
int hc_clGetDeviceIDs (hashcat_ctx_t *hashcat_ctx, cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices);
int hc_clGetDeviceInfo (hashcat_ctx_t *hashcat_ctx, cl_device_id device, cl_device_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret);
int hc_clGetEventInfo (hashcat_ctx_t *hashcat_ctx, cl_event event, cl_event_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret);
int hc_clGetEventProfilingInfo (hashcat_ctx_t *hashcat_ctx, cl_event event, cl_profiling_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret);
int hc_clGetKernelWorkGroupInfo (hashcat_ctx_t *hashcat_ctx, cl_kernel kernel, cl_device_id device, cl_kernel_work_group_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret);
int hc_clGetPlatformIDs (hashcat_ctx_t *hashcat_ctx, cl_uint num_entries, cl_platform_id *platforms, cl_uint *num_platforms);
int hc_clGetPlatformInfo (hashcat_ctx_t *hashcat_ctx, cl_platform_id platform, cl_platform_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret);
int hc_clGetProgramBuildInfo (hashcat_ctx_t *hashcat_ctx, cl_program program, cl_device_id device, cl_program_build_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret);
int hc_clGetProgramInfo (hashcat_ctx_t *hashcat_ctx, cl_program program, cl_program_info param_name, size_t param_value_size, void *param_value, size_t * param_value_size_ret);
int hc_clReleaseCommandQueue (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue);
int hc_clReleaseContext (hashcat_ctx_t *hashcat_ctx, cl_context context);
int hc_clReleaseEvent (hashcat_ctx_t *hashcat_ctx, cl_event event);
int hc_clReleaseKernel (hashcat_ctx_t *hashcat_ctx, cl_kernel kernel);
int hc_clReleaseMemObject (hashcat_ctx_t *hashcat_ctx, cl_mem mem);
int hc_clReleaseProgram (hashcat_ctx_t *hashcat_ctx, cl_program program);
int hc_clSetKernelArg (hashcat_ctx_t *hashcat_ctx, cl_kernel kernel, cl_uint arg_index, size_t arg_size, const void *arg_value);
int hc_clWaitForEvents (hashcat_ctx_t *hashcat_ctx, cl_uint num_events, const cl_event *event_list);
int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 gidd, pw_t *pw);
int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 highest_pw_len, const u32 pws_cnt, const u32 fast_iteration, const u32 salt_pos);
int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u32 num, const u32 event_update, const u32 iteration);

@ -25,13 +25,7 @@
u64 get_lowest_words_done (hashcat_ctx_t *hashcat_ctx);
void init_restore (hashcat_ctx_t *hashcat_ctx);
void read_restore (hashcat_ctx_t *hashcat_ctx);
void write_restore (hashcat_ctx_t *hashcat_ctx);
void cycle_restore (hashcat_ctx_t *hashcat_ctx);
int cycle_restore (hashcat_ctx_t *hashcat_ctx);
void unlink_restore (hashcat_ctx_t *hashcat_ctx);

@ -20,6 +20,6 @@
#include <pwd.h>
#endif // _POSIX
void process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt);
int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt);
#endif // _STDOUT_H

@ -26,7 +26,7 @@
void welcome_screen (hashcat_ctx_t *hashcat_ctx, const time_t proc_start, const char *version_tag);
void goodbye_screen (hashcat_ctx_t *hashcat_ctx, const time_t proc_start, const time_t proc_stop);
int setup_console ();
int setup_console (hashcat_ctx_t *hashcat_ctx);
void send_prompt ();
void clear_prompt ();

@ -56,12 +56,12 @@ void hc_signal (void (callback) (int));
#endif
*/
void mycracked (status_ctx_t *status_ctx);
void myabort (status_ctx_t *status_ctx);
void myquit (status_ctx_t *status_ctx);
void bypass (status_ctx_t *status_ctx);
void mycracked (hashcat_ctx_t *hashcat_ctx);
void myabort (hashcat_ctx_t *hashcat_ctx);
void myquit (hashcat_ctx_t *hashcat_ctx);
void bypass (hashcat_ctx_t *hashcat_ctx);
void SuspendThreads (status_ctx_t *status_ctx);
void ResumeThreads (status_ctx_t *status_ctx);
void SuspendThreads (hashcat_ctx_t *hashcat_ctx);
void ResumeThreads (hashcat_ctx_t *hashcat_ctx);
#endif // _THREAD_H

@ -37,12 +37,6 @@ typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
#include "ext_OpenCL.h"
#include "ext_ADL.h"
#include "ext_nvapi.h"
#include "ext_nvml.h"
#include "ext_xnvctrl.h"
// timer
#if defined (_WIN)
@ -418,6 +412,7 @@ typedef enum parser_rc
PARSER_TC_FILE_SIZE = -15,
PARSER_VC_FILE_SIZE = -16,
PARSER_SIP_AUTH_DIRECTIVE = -17,
PARSER_HASH_FILE = -18,
PARSER_UNKNOWN_ERROR = -255
} parser_rc_t;
@ -613,6 +608,8 @@ typedef struct wordr
} wordr_t;
#include "ext_OpenCL.h"
typedef struct hc_device_param
{
cl_device_id device;
@ -819,15 +816,51 @@ typedef struct opencl_ctx
double target_ms;
int need_adl;
int need_nvml;
int need_nvapi;
int need_xnvctrl;
bool need_adl;
bool need_nvml;
bool need_nvapi;
bool need_xnvctrl;
int force_jit_compilation;
} opencl_ctx_t;
#include "ext_ADL.h"
#include "ext_nvapi.h"
#include "ext_nvml.h"
#include "ext_xnvctrl.h"
typedef struct hm_attrs
{
HM_ADAPTER_ADL adl;
HM_ADAPTER_NVML nvml;
HM_ADAPTER_NVAPI nvapi;
HM_ADAPTER_XNVCTRL xnvctrl;
int od_version;
bool fan_get_supported;
bool fan_set_supported;
} hm_attrs_t;
typedef struct hwmon_ctx
{
bool enabled;
void *hm_adl;
void *hm_nvml;
void *hm_nvapi;
void *hm_xnvctrl;
hm_attrs_t *hm_device;
ADLOD6MemClockState *od_clock_mem_status;
int *od_power_control_status;
unsigned int *nvml_power_limit;
} hwmon_ctx_t;
#if defined (__APPLE__)
typedef struct cpu_set
{
@ -888,20 +921,6 @@ typedef struct dictstat_ctx
} dictstat_ctx_t;
typedef struct hm_attrs
{
HM_ADAPTER_ADL adl;
HM_ADAPTER_NVML nvml;
HM_ADAPTER_NVAPI nvapi;
HM_ADAPTER_XNVCTRL xnvctrl;
int od_version;
bool fan_get_supported;
bool fan_set_supported;
} hm_attrs_t;
typedef struct loopback_ctx
{
bool enabled;
@ -1301,23 +1320,6 @@ typedef struct mask_ctx
} mask_ctx_t;
typedef struct hwmon_ctx
{
bool enabled;
void *hm_adl;
void *hm_nvml;
void *hm_nvapi;
void *hm_xnvctrl;
hm_attrs_t *hm_device;
ADLOD6MemClockState *od_clock_mem_status;
int *od_power_control_status;
unsigned int *nvml_power_limit;
} hwmon_ctx_t;
typedef struct cpt_ctx
{
bool enabled;

@ -6,6 +6,8 @@
#ifndef _USAGE_H
#define _USAGE_H
#include <stdio.h>
void usage_mini_print (const char *progname);
void usage_big_print (const char *progname);

@ -163,7 +163,7 @@ LFLAGS_CROSS_WIN := -lpsapi
## Objects
##
OBJS_ALL := affinity autotune benchmark bitmap bitops combinator common convert cpt cpu_aes cpu_crc32 cpu_des cpu_md5 cpu_sha1 cpu_sha256 debugfile dictstat dispatch dynloader event ext_ADL ext_nvapi ext_nvml ext_OpenCL ext_xnvctrl filehandling folder hashcat hashes hlfmt hwmon induct interface locking logfile logging loopback memory monitor mpsp opencl outfile_check outfile potfile restore rp rp_cpu rp_kernel_on_cpu shared status stdout straight terminal thread timer tuningdb usage user_options weak_hash wordlist
OBJS_ALL := affinity autotune benchmark bitmap bitops combinator common convert cpt cpu_aes cpu_crc32 cpu_des cpu_md5 cpu_sha1 cpu_sha256 debugfile dictstat dispatch dynloader event ext_ADL ext_nvapi ext_nvml ext_OpenCL ext_xnvctrl filehandling folder hashcat hashes hlfmt hwmon induct interface locking logfile loopback memory monitor mpsp opencl outfile_check outfile potfile restore rp rp_cpu rp_kernel_on_cpu shared status stdout straight terminal thread timer tuningdb usage user_options weak_hash wordlist
NATIVE_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.o)

@ -95,7 +95,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
device_param->pws_buf[i].pw_len = 7 + (i & 7);
}
cl_int CL_err = hc_clEnqueueWriteBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
cl_int CL_err = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
if (CL_err != CL_SUCCESS)
{
@ -109,7 +109,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
{
if (straight_ctx->kernel_rules_cnt > 1)
{
cl_int CL_err = hc_clEnqueueCopyBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_rules, device_param->d_rules_c, 0, 0, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), 0, NULL, NULL);
cl_int CL_err = hc_clEnqueueCopyBuffer (hashcat_ctx, device_param->command_queue, device_param->d_rules, device_param->d_rules_c, 0, 0, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), 0, NULL, NULL);
if (CL_err != CL_SUCCESS)
{
@ -248,8 +248,8 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
/*
memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
hc_clEnqueueWriteBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
hc_clEnqueueWriteBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_pws_amp_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_amp_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
*/
run_kernel_memset (hashcat_ctx, device_param, device_param->d_pws_buf, 0, kernel_power_max * sizeof (pw_t));
@ -280,6 +280,8 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
#if defined (DEBUG)
user_options_t *user_options = hashcat_ctx->user_options;
if (user_options->quiet == false)
{
clear_prompt ();

@ -4,612 +4,11 @@
*/
#include "common.h"
#include "logging.h"
#include "types.h"
#include "memory.h"
#include "dynloader.h"
#include "ext_ADL.h"
int adl_init (ADL_PTR *adl)
{
if (!adl) return -1;
memset (adl, 0, sizeof (ADL_PTR));
#if defined (_WIN)
adl->lib = hc_dlopen ("atiadlxx.dll");
if (!adl->lib)
{
adl->lib = hc_dlopen ("atiadlxy.dll");
}
#elif defined (_POSIX)
adl->lib = hc_dlopen ("libatiadlxx.so", RTLD_NOW);
#endif
if (!adl->lib)
{
//if (user_options->quiet == false)
// log_info ("WARNING: load ADL library failed, proceed without ADL HWMon enabled.");
return -1;
}
HC_LOAD_FUNC(adl, ADL_Main_Control_Destroy, ADL_MAIN_CONTROL_DESTROY, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Main_Control_Create, ADL_MAIN_CONTROL_CREATE, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Adapter_NumberOfAdapters_Get, ADL_ADAPTER_NUMBEROFADAPTERS_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Adapter_AdapterInfo_Get, ADL_ADAPTER_ADAPTERINFO_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Display_DisplayInfo_Get, ADL_DISPLAY_DISPLAYINFO_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Adapter_ID_Get, ADL_ADAPTER_ID_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Adapter_VideoBiosInfo_Get, ADL_ADAPTER_VIDEOBIOSINFO_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive5_ThermalDevices_Enum, ADL_OVERDRIVE5_THERMALDEVICES_ENUM, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive5_Temperature_Get, ADL_OVERDRIVE5_TEMPERATURE_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_Temperature_Get, ADL_OVERDRIVE6_TEMPERATURE_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive5_CurrentActivity_Get, ADL_OVERDRIVE5_CURRENTACTIVITY_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeedInfo_Get, ADL_OVERDRIVE5_FANSPEEDINFO_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeed_Get, ADL_OVERDRIVE5_FANSPEED_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_FanSpeed_Get, ADL_OVERDRIVE6_FANSPEED_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeed_Set, ADL_OVERDRIVE5_FANSPEED_SET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_FanSpeed_Set, ADL_OVERDRIVE6_FANSPEED_SET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeedToDefault_Set, ADL_OVERDRIVE5_FANSPEEDTODEFAULT_SET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive5_ODParameters_Get, ADL_OVERDRIVE5_ODPARAMETERS_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive5_ODPerformanceLevels_Get, ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive5_ODPerformanceLevels_Set, ADL_OVERDRIVE5_ODPERFORMANCELEVELS_SET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_PowerControlInfo_Get, ADL_OVERDRIVE6_POWERCONTROLINFO_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_PowerControl_Get, ADL_OVERDRIVE6_POWERCONTROL_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_PowerControl_Set, ADL_OVERDRIVE6_POWERCONTROL_SET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Adapter_Active_Get, ADL_ADAPTER_ACTIVE_GET, ADL, 0)
//HC_LOAD_FUNC(adl, ADL_DisplayEnable_Set, ADL_DISPLAYENABLE_SET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive_Caps, ADL_OVERDRIVE_CAPS, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_PowerControl_Caps, ADL_OVERDRIVE6_POWERCONTROL_CAPS, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_Capabilities_Get, ADL_OVERDRIVE6_CAPABILITIES_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_StateInfo_Get, ADL_OVERDRIVE6_STATEINFO_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_CurrentStatus_Get, ADL_OVERDRIVE6_CURRENTSTATUS_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_State_Set, ADL_OVERDRIVE6_STATE_SET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_TargetTemperatureData_Get, ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_TargetTemperatureRangeInfo_Get, ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET, ADL, 0)
HC_LOAD_FUNC(adl, ADL_Overdrive6_FanSpeed_Reset, ADL_OVERDRIVE6_FANSPEED_RESET, ADL, 0)
return 0;
}
void adl_close (ADL_PTR *adl)
{
if (adl)
{
if (adl->lib)
hc_dlclose (adl->lib);
myfree (adl);
}
}
void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize)
{
return mymalloc ((size_t) iSize);
}
int hm_ADL_Main_Control_Destroy (ADL_PTR *adl)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Main_Control_Destroy ();
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Main_Control_Destroy()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Main_Control_Create (ADL_PTR *adl, ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Main_Control_Create (callback, iEnumConnectedAdapters);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Main_Control_Create()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Adapter_NumberOfAdapters_Get (ADL_PTR *adl, int *lpNumAdapters)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Adapter_NumberOfAdapters_Get (lpNumAdapters);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Adapter_NumberOfAdapters_Get()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Adapter_AdapterInfo_Get (ADL_PTR *adl, LPAdapterInfo lpInfo, int iInputSize)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Adapter_AdapterInfo_Get (lpInfo, iInputSize);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Adapter_AdapterInfo_Get()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Display_DisplayInfo_Get (ADL_PTR *adl, int iAdapterIndex, int *iNumDisplays, ADLDisplayInfo **lppInfo, int iForceDetect)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Display_DisplayInfo_Get (iAdapterIndex, iNumDisplays, lppInfo, iForceDetect);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Display_DisplayInfo_Get()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Adapter_ID_Get (ADL_PTR *adl, int iAdapterIndex, int *lpAdapterID)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Adapter_ID_Get (iAdapterIndex, lpAdapterID);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Adapter_ID_Get()", ADL_rc);
}
return ADL_rc;
}
int hm_ADL_Adapter_VideoBiosInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLBiosInfo *lpBiosInfo)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Adapter_VideoBiosInfo_Get (iAdapterIndex, lpBiosInfo);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Adapter_VideoBiosInfo_Get()", ADL_rc);
}
return ADL_rc;
}
int hm_ADL_Overdrive_ThermalDevices_Enum (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLThermalControllerInfo *lpThermalControllerInfo)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive5_ThermalDevices_Enum (iAdapterIndex, iThermalControllerIndex, lpThermalControllerInfo);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_ThermalDevices_Enum()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Overdrive5_Temperature_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive5_Temperature_Get (iAdapterIndex, iThermalControllerIndex, lpTemperature);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_Temperature_Get()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Overdrive6_Temperature_Get (ADL_PTR *adl, int iAdapterIndex, int *iTemperature)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive6_Temperature_Get (iAdapterIndex, iTemperature);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Overdrive6_Temperature_Get()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Overdrive_CurrentActivity_Get (ADL_PTR *adl, int iAdapterIndex, ADLPMActivity *lpActivity)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive5_CurrentActivity_Get (iAdapterIndex, lpActivity);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_CurrentActivity_Get()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Overdrive5_FanSpeedInfo_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedInfo *lpFanSpeedInfo)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive5_FanSpeedInfo_Get (iAdapterIndex, iThermalControllerIndex, lpFanSpeedInfo);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_FanSpeedInfo_Get()", ADL_rc);
}
return ADL_rc;
}
int hm_ADL_Overdrive5_FanSpeed_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive5_FanSpeed_Get (iAdapterIndex, iThermalControllerIndex, lpFanSpeedValue);
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
{
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_FanSpeed_Get()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Overdrive6_FanSpeed_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive6_FanSpeed_Get (iAdapterIndex, lpFanSpeedInfo);
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
{
log_info ("WARN: %s: %d\n", "ADL_Overdrive6_FanSpeed_Get()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Overdrive5_FanSpeed_Set (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive5_FanSpeed_Set (iAdapterIndex, iThermalControllerIndex, lpFanSpeedValue);
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
{
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_FanSpeed_Set()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Overdrive6_FanSpeed_Set (ADL_PTR *adl, int iAdapterIndex, ADLOD6FanSpeedValue *lpFanSpeedValue)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive6_FanSpeed_Set (iAdapterIndex, lpFanSpeedValue);
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
{
log_info ("WARN: %s: %d\n", "ADL_Overdrive6_FanSpeed_Set()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Overdrive5_FanSpeedToDefault_Set (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive5_FanSpeedToDefault_Set (iAdapterIndex, iThermalControllerIndex);
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
{
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_FanSpeedToDefault_Set()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Overdrive_ODParameters_Get (ADL_PTR *adl, int iAdapterIndex, ADLODParameters *lpOdParameters)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive5_ODParameters_Get (iAdapterIndex, lpOdParameters);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_ODParameters_Get()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Overdrive_ODPerformanceLevels_Get (ADL_PTR *adl, int iAdapterIndex, int iDefault, ADLODPerformanceLevels *lpOdPerformanceLevels)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive5_ODPerformanceLevels_Get (iAdapterIndex, iDefault, lpOdPerformanceLevels);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_ODPerformanceLevels_Get()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Overdrive_ODPerformanceLevels_Set (ADL_PTR *adl, int iAdapterIndex, ADLODPerformanceLevels *lpOdPerformanceLevels)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive5_ODPerformanceLevels_Set (iAdapterIndex, lpOdPerformanceLevels);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Overdrive5_ODPerformanceLevels_Set()", ADL_rc);
}
return (ADL_rc);
}
int hm_ADL_Overdrive_PowerControlInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6PowerControlInfo *powertune)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive6_PowerControlInfo_Get (iAdapterIndex, powertune);
return (ADL_rc);
}
int hm_ADL_Overdrive_PowerControl_Get (ADL_PTR *adl, int iAdapterIndex, int *iCurrentValue)
{
if (!adl) return -1;
int default_value = 0;
int ADL_rc = adl->ADL_Overdrive6_PowerControl_Get (iAdapterIndex, iCurrentValue, &default_value);
return (ADL_rc);
}
int hm_ADL_Overdrive_PowerControl_Set (ADL_PTR *adl, int iAdapterIndex, int level)
{
if (!adl) return -1;
int ADL_rc = ADL_ERR;
ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (adl, iAdapterIndex, &powertune)) != ADL_OK)
{
log_info ("WARN: %s\n", "ADL_Overdrive6_PowerControl_Get", ADL_rc);
}
else
{
int min = powertune.iMinValue;
int max = powertune.iMaxValue;
int step = powertune.iStepValue;
if (level < min || level > max)
{
log_info ("WARN: ADL PowerControl level invalid");
return ADL_ERR;
}
if (level % step != 0)
{
log_info ("WARN: ADL PowerControl step invalid");
return ADL_ERR;
}
ADL_rc = adl->ADL_Overdrive6_PowerControl_Set (iAdapterIndex, level);
}
return (ADL_rc);
}
int hm_ADL_Adapter_Active_Get (ADL_PTR *adl, int iAdapterIndex, int *lpStatus)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Adapter_Active_Get (iAdapterIndex, lpStatus);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_Adapter_Active_Get()", ADL_rc);
}
return (ADL_rc);
}
/*
int hm_ADL_DisplayEnable_Set (ADL_PTR *adl, int iAdapterIndex, int *lpDisplayIndexList, int iDisplayListSize, int bPersistOnly)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_DisplayEnable_Set (iAdapterIndex, lpDisplayIndexList, iDisplayListSize, bPersistOnly);
if (ADL_rc != ADL_OK)
{
log_info ("WARN: %s: %d\n", "ADL_DisplayEnable_Set()", ADL_rc);
}
return (ADL_rc);
}
*/
int hm_ADL_Overdrive_Caps (ADL_PTR *adl, int iAdapterIndex, int *od_supported, int *od_enabled, int *od_version)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive_Caps (iAdapterIndex, od_supported, od_enabled, od_version);
return (ADL_rc);
}
int hm_ADL_Overdrive6_PowerControl_Caps (ADL_PTR *adl, int iAdapterIndex, int *lpSupported)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive6_PowerControl_Caps (iAdapterIndex, lpSupported);
return (ADL_rc);
}
int hm_ADL_Overdrive_Capabilities_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6Capabilities *caps)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive6_Capabilities_Get (iAdapterIndex, caps);
return (ADL_rc);
}
int hm_ADL_Overdrive_StateInfo_Get (ADL_PTR *adl, int iAdapterIndex, int type, ADLOD6MemClockState *state)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive6_StateInfo_Get (iAdapterIndex, type, state);
if (ADL_rc == ADL_OK)
{
// check if clocks are okay with step sizes
// if not run a little hack: adjust the clocks to nearest clock size (clock down just a little bit)
ADLOD6Capabilities caps;
if ((hm_ADL_Overdrive_Capabilities_Get (adl, iAdapterIndex, &caps)) != ADL_OK)
{
log_info ("ERROR: failed to get ADL device capabilities");
exit (1);
}
if (state->state.aLevels[0].iEngineClock % caps.sEngineClockRange.iStep != 0)
{
log_info ("WARN: ADL engine step size invalid for performance level 1");
state->state.aLevels[0].iEngineClock -= state->state.aLevels[0].iEngineClock % caps.sEngineClockRange.iStep;
}
if (state->state.aLevels[1].iEngineClock % caps.sEngineClockRange.iStep != 0)
{
log_info ("WARN: ADL engine step size invalid for performance level 2");
state->state.aLevels[1].iEngineClock -= state->state.aLevels[1].iEngineClock % caps.sEngineClockRange.iStep;
}
if (state->state.aLevels[0].iMemoryClock % caps.sMemoryClockRange.iStep != 0)
{
log_info ("WARN: ADL memory step size invalid for performance level 1");
state->state.aLevels[0].iMemoryClock -= state->state.aLevels[0].iMemoryClock % caps.sMemoryClockRange.iStep;
}
if (state->state.aLevels[1].iMemoryClock % caps.sMemoryClockRange.iStep != 0)
{
log_info ("WARN: ADL memory step size invalid for performance level 2");
state->state.aLevels[1].iMemoryClock -= state->state.aLevels[1].iMemoryClock % caps.sMemoryClockRange.iStep;
}
}
return (ADL_rc);
}
int hm_ADL_Overdrive_CurrentStatus_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6CurrentStatus *status)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive6_CurrentStatus_Get (iAdapterIndex, status);
return (ADL_rc);
}
int hm_ADL_Overdrive_State_Set (ADL_PTR *adl, int iAdapterIndex, int type, ADLOD6StateInfo *state)
{
if (!adl) return -1;
// sanity checks
ADLOD6Capabilities caps;
if ((hm_ADL_Overdrive_Capabilities_Get (adl, iAdapterIndex, &caps)) != ADL_OK)
{
log_info ("ERROR: failed to get ADL device capabilities");
exit (1);
}
if (state->aLevels[0].iEngineClock < caps.sEngineClockRange.iMin || state->aLevels[1].iEngineClock > caps.sEngineClockRange.iMax)
{
log_info ("WARN: ADL engine clock outside valid range");
return ADL_ERR;
}
if (state->aLevels[1].iEngineClock % caps.sEngineClockRange.iStep != 0)
{
log_info ("WARN: ADL engine step size invalid");
return ADL_ERR;
}
if (state->aLevels[0].iMemoryClock < caps.sMemoryClockRange.iMin || state->aLevels[1].iMemoryClock > caps.sMemoryClockRange.iMax)
{
log_info ("WARN: ADL memory clock outside valid range");
return ADL_ERR;
}
if (state->aLevels[1].iMemoryClock % caps.sMemoryClockRange.iStep != 0)
{
log_info ("WARN: ADL memory step size invalid");
return ADL_ERR;
}
int ADL_rc = adl->ADL_Overdrive6_State_Set (iAdapterIndex, type, state);
return (ADL_rc);
}
int hm_ADL_Overdrive6_TargetTemperatureData_Get (ADL_PTR *adl, int iAdapterIndex, int *cur_temp, int *default_temp)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive6_TargetTemperatureData_Get (iAdapterIndex, cur_temp, default_temp);
return (ADL_rc);
}
int hm_ADL_Overdrive6_TargetTemperatureRangeInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6ParameterRange *lpTargetTemperatureInfo)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive6_TargetTemperatureRangeInfo_Get (iAdapterIndex, lpTargetTemperatureInfo);
return (ADL_rc);
}
int hm_ADL_Overdrive6_FanSpeed_Reset (ADL_PTR *adl, int iAdapterIndex)
{
if (!adl) return -1;
int ADL_rc = adl->ADL_Overdrive6_FanSpeed_Reset (iAdapterIndex);
return (ADL_rc);
}

@ -6,8 +6,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "dynloader.h"
#include "event.h"
#include "ext_OpenCL.h"
const char *val2cstr_cl (cl_int CL_err)
@ -58,279 +57,3 @@ const char *val2cstr_cl (cl_int CL_err)
return "CL_UNKNOWN_ERROR";
}
int ocl_init (OCL_PTR *ocl)
{
if (!ocl)
{
log_error ("ERROR: OpenCL library pointer is null");
exit (-1);
}
memset (ocl, 0, sizeof (hc_opencl_lib_t));
#if defined(_WIN)
ocl->lib = hc_dlopen ("OpenCL");
#elif defined(__APPLE__)
ocl->lib = hc_dlopen ("/System/Library/Frameworks/OpenCL.framework/OpenCL", RTLD_NOW);
#else
ocl->lib = hc_dlopen ("libOpenCL.so", RTLD_NOW);
if (ocl->lib == NULL) ocl->lib = hc_dlopen ("libOpenCL.so.1", RTLD_NOW);
#endif
if (ocl->lib == NULL)
{
log_info ("");
log_info ("ATTENTION! Can't find OpenCL ICD loader library");
log_info ("");
#if defined (__linux__)
log_info ("You're probably missing the \"ocl-icd-libopencl1\" package (Debian/Ubuntu)");
log_info (" sudo apt-get install ocl-icd-libopencl1");
log_info ("");
#elif defined (_WIN)
log_info ("You're probably missing the OpenCL runtime installation");
log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
log_info ("");
#endif
exit (-1);
}
HC_LOAD_FUNC(ocl, clBuildProgram, OCL_CLBUILDPROGRAM, OpenCL, 1)
HC_LOAD_FUNC(ocl, clCreateBuffer, OCL_CLCREATEBUFFER, OpenCL, 1)
HC_LOAD_FUNC(ocl, clCreateCommandQueue, OCL_CLCREATECOMMANDQUEUE, OpenCL, 1)
HC_LOAD_FUNC(ocl, clCreateContext, OCL_CLCREATECONTEXT, OpenCL, 1)
HC_LOAD_FUNC(ocl, clCreateKernel, OCL_CLCREATEKERNEL, OpenCL, 1)
HC_LOAD_FUNC(ocl, clCreateProgramWithBinary, OCL_CLCREATEPROGRAMWITHBINARY, OpenCL, 1)
HC_LOAD_FUNC(ocl, clCreateProgramWithSource, OCL_CLCREATEPROGRAMWITHSOURCE, OpenCL, 1)
HC_LOAD_FUNC(ocl, clEnqueueCopyBuffer, OCL_CLENQUEUECOPYBUFFER, OpenCL, 1)
HC_LOAD_FUNC(ocl, clEnqueueMapBuffer, OCL_CLENQUEUEMAPBUFFER, OpenCL, 1)
HC_LOAD_FUNC(ocl, clEnqueueNDRangeKernel, OCL_CLENQUEUENDRANGEKERNEL, OpenCL, 1)
HC_LOAD_FUNC(ocl, clEnqueueReadBuffer, OCL_CLENQUEUEREADBUFFER, OpenCL, 1)
HC_LOAD_FUNC(ocl, clEnqueueUnmapMemObject, OCL_CLENQUEUEUNMAPMEMOBJECT, OpenCL, 1)
HC_LOAD_FUNC(ocl, clEnqueueWriteBuffer, OCL_CLENQUEUEWRITEBUFFER, OpenCL, 1)
HC_LOAD_FUNC(ocl, clFinish, OCL_CLFINISH, OpenCL, 1)
HC_LOAD_FUNC(ocl, clFlush, OCL_CLFLUSH, OpenCL, 1)
HC_LOAD_FUNC(ocl, clGetDeviceIDs, OCL_CLGETDEVICEIDS, OpenCL, 1)
HC_LOAD_FUNC(ocl, clGetDeviceInfo, OCL_CLGETDEVICEINFO, OpenCL, 1)
HC_LOAD_FUNC(ocl, clGetEventInfo, OCL_CLGETEVENTINFO, OpenCL, 1)
HC_LOAD_FUNC(ocl, clGetKernelWorkGroupInfo, OCL_CLGETKERNELWORKGROUPINFO, OpenCL, 1)
HC_LOAD_FUNC(ocl, clGetPlatformIDs, OCL_CLGETPLATFORMIDS, OpenCL, 1)
HC_LOAD_FUNC(ocl, clGetPlatformInfo, OCL_CLGETPLATFORMINFO, OpenCL, 1)
HC_LOAD_FUNC(ocl, clGetProgramBuildInfo, OCL_CLGETPROGRAMBUILDINFO, OpenCL, 1)
HC_LOAD_FUNC(ocl, clGetProgramInfo, OCL_CLGETPROGRAMINFO, OpenCL, 1)
HC_LOAD_FUNC(ocl, clReleaseCommandQueue, OCL_CLRELEASECOMMANDQUEUE, OpenCL, 1)
HC_LOAD_FUNC(ocl, clReleaseContext, OCL_CLRELEASECONTEXT, OpenCL, 1)
HC_LOAD_FUNC(ocl, clReleaseKernel, OCL_CLRELEASEKERNEL, OpenCL, 1)
HC_LOAD_FUNC(ocl, clReleaseMemObject, OCL_CLRELEASEMEMOBJECT, OpenCL, 1)
HC_LOAD_FUNC(ocl, clReleaseProgram, OCL_CLRELEASEPROGRAM, OpenCL, 1)
HC_LOAD_FUNC(ocl, clSetKernelArg, OCL_CLSETKERNELARG, OpenCL, 1)
HC_LOAD_FUNC(ocl, clWaitForEvents, OCL_CLWAITFOREVENTS, OpenCL, 1)
HC_LOAD_FUNC(ocl, clGetEventProfilingInfo, OCL_CLGETEVENTPROFILINGINFO, OpenCL, 1)
HC_LOAD_FUNC(ocl, clReleaseEvent, OCL_CLRELEASEEVENT, OpenCL, 1)
return 0;
}
void ocl_close (OCL_PTR *ocl)
{
if (ocl)
{
if (ocl->lib)
{
hc_dlclose (ocl->lib);
}
}
}
cl_int hc_clEnqueueNDRangeKernel (OCL_PTR *ocl, cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, const size_t *global_work_offset, const size_t *global_work_size, const size_t *local_work_size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
{
return ocl->clEnqueueNDRangeKernel (command_queue, kernel, work_dim, global_work_offset, global_work_size, local_work_size, num_events_in_wait_list, event_wait_list, event);
}
cl_int hc_clGetEventInfo (OCL_PTR *ocl, cl_event event, cl_event_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
{
return ocl->clGetEventInfo (event, param_name, param_value_size, param_value, param_value_size_ret);
}
cl_int hc_clFlush (OCL_PTR *ocl, cl_command_queue command_queue)
{
return ocl->clFlush (command_queue);
}
cl_int hc_clFinish (OCL_PTR *ocl, cl_command_queue command_queue)
{
return ocl->clFinish (command_queue);
}
cl_int hc_clSetKernelArg (OCL_PTR *ocl, cl_kernel kernel, cl_uint arg_index, size_t arg_size, const void *arg_value)
{
return ocl->clSetKernelArg (kernel, arg_index, arg_size, arg_value);
}
cl_int hc_clEnqueueWriteBuffer (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, size_t offset, size_t cb, const void *ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
{
return ocl->clEnqueueWriteBuffer (command_queue, buffer, blocking_write, offset, cb, ptr, num_events_in_wait_list, event_wait_list, event);
}
cl_int hc_clEnqueueCopyBuffer (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, size_t src_offset, size_t dst_offset, size_t cb, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
{
return ocl->clEnqueueCopyBuffer (command_queue, src_buffer, dst_buffer, src_offset, dst_offset, cb, num_events_in_wait_list, event_wait_list, event);
}
cl_int hc_clEnqueueReadBuffer (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, size_t offset, size_t cb, void *ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
{
return ocl->clEnqueueReadBuffer (command_queue, buffer, blocking_read, offset, cb, ptr, num_events_in_wait_list, event_wait_list, event);
}
cl_int hc_clGetPlatformIDs (OCL_PTR *ocl, cl_uint num_entries, cl_platform_id *platforms, cl_uint *num_platforms)
{
return ocl->clGetPlatformIDs (num_entries, platforms, num_platforms);
}
cl_int hc_clGetPlatformInfo (OCL_PTR *ocl, cl_platform_id platform, cl_platform_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
{
return ocl->clGetPlatformInfo (platform, param_name, param_value_size, param_value, param_value_size_ret);
}
cl_int hc_clGetDeviceIDs (OCL_PTR *ocl, cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices)
{
return ocl->clGetDeviceIDs (platform, device_type, num_entries, devices, num_devices);
}
cl_int hc_clGetDeviceInfo (OCL_PTR *ocl, cl_device_id device, cl_device_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
{
return ocl->clGetDeviceInfo (device, param_name, param_value_size, param_value, param_value_size_ret);
}
cl_int hc_clCreateContext (OCL_PTR *ocl, cl_context_properties *properties, cl_uint num_devices, const cl_device_id *devices, void (CL_CALLBACK *pfn_notify) (const char *, const void *, size_t, void *), void *user_data, cl_context *context)
{
cl_int CL_err;
*context = ocl->clCreateContext (properties, num_devices, devices, pfn_notify, user_data, &CL_err);
return CL_err;
}
cl_int hc_clCreateCommandQueue (OCL_PTR *ocl, cl_context context, cl_device_id device, cl_command_queue_properties properties, cl_command_queue *command_queue)
{
cl_int CL_err;
*command_queue = ocl->clCreateCommandQueue (context, device, properties, &CL_err);
return CL_err;
}
cl_int hc_clCreateBuffer (OCL_PTR *ocl, cl_context context, cl_mem_flags flags, size_t size, void *host_ptr, cl_mem *mem)
{
cl_int CL_err;
*mem = ocl->clCreateBuffer (context, flags, size, host_ptr, &CL_err);
return CL_err;
}
cl_int hc_clCreateProgramWithSource (OCL_PTR *ocl, cl_context context, cl_uint count, const char **strings, const size_t *lengths, cl_program *program)
{
cl_int CL_err;
*program = ocl->clCreateProgramWithSource (context, count, strings, lengths, &CL_err);
return CL_err;
}
cl_int hc_clCreateProgramWithBinary (OCL_PTR *ocl, cl_context context, cl_uint num_devices, const cl_device_id *device_list, const size_t *lengths, const unsigned char **binaries, cl_int *binary_status, cl_program *program)
{
cl_int CL_err;
*program = ocl->clCreateProgramWithBinary (context, num_devices, device_list, lengths, binaries, binary_status, &CL_err);
return CL_err;
}
cl_int hc_clBuildProgram (OCL_PTR *ocl, cl_program program, cl_uint num_devices, const cl_device_id *device_list, const char *options, void (CL_CALLBACK *pfn_notify) (cl_program program, void *user_data), void *user_data)
{
return ocl->clBuildProgram (program, num_devices, device_list, options, pfn_notify, user_data);
}
cl_int hc_clCreateKernel (OCL_PTR *ocl, cl_program program, const char *kernel_name, cl_kernel *kernel)
{
cl_int CL_err;
*kernel = ocl->clCreateKernel (program, kernel_name, &CL_err);
return CL_err;
}
cl_int hc_clReleaseMemObject (OCL_PTR *ocl, cl_mem mem)
{
return ocl->clReleaseMemObject (mem);
}
cl_int hc_clReleaseKernel (OCL_PTR *ocl, cl_kernel kernel)
{
return ocl->clReleaseKernel (kernel);
}
cl_int hc_clReleaseProgram (OCL_PTR *ocl, cl_program program)
{
return ocl->clReleaseProgram (program);
}
cl_int hc_clReleaseCommandQueue (OCL_PTR *ocl, cl_command_queue command_queue)
{
return ocl->clReleaseCommandQueue (command_queue);
}
cl_int hc_clReleaseContext (OCL_PTR *ocl, cl_context context)
{
return ocl->clReleaseContext (context);
}
cl_int hc_clEnqueueMapBuffer (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, cl_map_flags map_flags, size_t offset, size_t cb, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event, void **buf)
{
cl_int CL_err;
*buf = ocl->clEnqueueMapBuffer (command_queue, buffer, blocking_read, map_flags, offset, cb, num_events_in_wait_list, event_wait_list, event, &CL_err);
return CL_err;
}
cl_int hc_clEnqueueUnmapMemObject (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem memobj, void *mapped_ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
{
return ocl->clEnqueueUnmapMemObject (command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event);
}
cl_int hc_clGetKernelWorkGroupInfo (OCL_PTR *ocl, cl_kernel kernel, cl_device_id device, cl_kernel_work_group_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
{
return ocl->clGetKernelWorkGroupInfo (kernel, device, param_name, param_value_size, param_value, param_value_size_ret);
}
cl_int hc_clGetProgramBuildInfo (OCL_PTR *ocl, cl_program program, cl_device_id device, cl_program_build_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
{
return ocl->clGetProgramBuildInfo (program, device, param_name, param_value_size, param_value, param_value_size_ret);
}
cl_int hc_clGetProgramInfo (OCL_PTR *ocl, cl_program program, cl_program_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
{
return ocl->clGetProgramInfo (program, param_name, param_value_size, param_value, param_value_size_ret);
}
cl_int hc_clWaitForEvents (OCL_PTR *ocl, cl_uint num_events, const cl_event *event_list)
{
return ocl->clWaitForEvents (num_events, event_list);
}
cl_int hc_clGetEventProfilingInfo (OCL_PTR *ocl, cl_event event, cl_profiling_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
{
return ocl->clGetEventProfilingInfo (event, param_name, param_value_size, param_value, param_value_size_ret);
}
cl_int hc_clReleaseEvent (OCL_PTR *ocl, cl_event event)
{
return ocl->clReleaseEvent (event);
}

@ -4,203 +4,7 @@
*/
#include "common.h"
#include "logging.h"
#include "types.h"
#include "event.h"
#include "memory.h"
#include "dynloader.h"
#include "ext_nvapi.h"
int nvapi_init (NVAPI_PTR *nvapi)
{
if (!nvapi) return -1;
memset (nvapi, 0, sizeof (NVAPI_PTR));
#if defined (_WIN)
#if defined (WIN64)
nvapi->lib = hc_dlopen ("nvapi64.dll");
#elif defined (WIN32)
nvapi->lib = hc_dlopen ("nvapi.dll");
#endif
#else
nvapi->lib = hc_dlopen ("nvapi.so", RTLD_NOW); // uhm yes, but .. yeah
#endif
if (!nvapi->lib)
{
//if (user_options->quiet == false)
// log_info ("WARNING: load NVAPI library failed, proceed without NVAPI HWMon enabled.");
return -1;
}
HC_LOAD_FUNC(nvapi, nvapi_QueryInterface, NVAPI_QUERYINTERFACE, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_Initialize, NVAPI_INITIALIZE, nvapi_QueryInterface, 0x0150E828, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_Unload, NVAPI_UNLOAD, nvapi_QueryInterface, 0xD22BDD7E, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_GetErrorMessage, NVAPI_GETERRORMESSAGE, nvapi_QueryInterface, 0x6C2D048C, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_EnumPhysicalGPUs, NVAPI_ENUMPHYSICALGPUS, nvapi_QueryInterface, 0xE5AC921F, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetPerfPoliciesInfo, NVAPI_GPU_GETPERFPOLICIESINFO, nvapi_QueryInterface, 0x409D9841, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetPerfPoliciesStatus, NVAPI_GPU_GETPERFPOLICIESSTATUS, nvapi_QueryInterface, 0x3D358A0C, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_GPU_SetCoolerLevels, NVAPI_GPU_SETCOOLERLEVELS, nvapi_QueryInterface, 0x891FA0AE, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_GPU_RestoreCoolerSettings, NVAPI_GPU_RESTORECOOLERSETTINGS, nvapi_QueryInterface, 0x8F6ED0FB, NVAPI, 0)
return 0;
}
void nvapi_close (NVAPI_PTR *nvapi)
{
if (nvapi)
{
if (nvapi->lib)
hc_dlclose (nvapi->lib);
myfree (nvapi);
}
}
int hm_NvAPI_GetErrorMessage (NVAPI_PTR *nvapi, NvAPI_Status NvAPI_rc, NvAPI_ShortString string)
{
if (!nvapi) return -1;
return nvapi->NvAPI_GetErrorMessage (NvAPI_rc, string);
}
NvAPI_Status hm_NvAPI_Initialize (NVAPI_PTR *nvapi)
{
if (!nvapi) return (NvAPI_Status) -1;
NvAPI_Status NvAPI_rc = nvapi->NvAPI_Initialize ();
if (NvAPI_rc == NVAPI_LIBRARY_NOT_FOUND) NvAPI_rc = NVAPI_OK; // not a bug
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
log_info ("WARN: %s %d %s\n", "NvAPI_Initialize()", NvAPI_rc, string);
}
return NvAPI_rc;
}
NvAPI_Status hm_NvAPI_Unload (NVAPI_PTR *nvapi)
{
if (!nvapi) return (NvAPI_Status) -1;
NvAPI_Status NvAPI_rc = nvapi->NvAPI_Unload ();
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
log_info ("WARN: %s %d %s\n", "NvAPI_Unload()", NvAPI_rc, string);
}
return NvAPI_rc;
}
NvAPI_Status hm_NvAPI_EnumPhysicalGPUs (NVAPI_PTR *nvapi, NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount)
{
if (!nvapi) return (NvAPI_Status) -1;
NvAPI_Status NvAPI_rc = nvapi->NvAPI_EnumPhysicalGPUs (nvGPUHandle, pGpuCount);
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
log_info ("WARN: %s %d %s\n", "NvAPI_EnumPhysicalGPUs()", NvAPI_rc, string);
}
return NvAPI_rc;
}
NvAPI_Status hm_NvAPI_GPU_GetPerfPoliciesInfo (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 *perfPolicies_info)
{
if (!nvapi) return (NvAPI_Status) -1;
NvAPI_Status NvAPI_rc = nvapi->NvAPI_GPU_GetPerfPoliciesInfo (hPhysicalGpu, perfPolicies_info);
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
log_info ("WARN: %s %d %s\n", "NvAPI_GPU_GetPerfPoliciesInfo()", NvAPI_rc, string);
}
return NvAPI_rc;
}
NvAPI_Status hm_NvAPI_GPU_GetPerfPoliciesStatus (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 *perfPolicies_status)
{
if (!nvapi) return (NvAPI_Status) -1;
NvAPI_Status NvAPI_rc = nvapi->NvAPI_GPU_GetPerfPoliciesStatus (hPhysicalGpu, perfPolicies_status);
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
log_info ("WARN: %s %d %s\n", "NvAPI_GPU_GetPerfPoliciesStatus()", NvAPI_rc, string);
}
return NvAPI_rc;
}
NvAPI_Status hm_NvAPI_GPU_SetCoolerLevels (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex, NV_GPU_COOLER_LEVELS *pCoolerLevels)
{
if (!nvapi) return (NvAPI_Status) -1;
NvAPI_Status NvAPI_rc = nvapi->NvAPI_GPU_SetCoolerLevels (hPhysicalGpu, coolerIndex, pCoolerLevels);
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
log_info ("WARN: %s %d %s\n", "NvAPI_GPU_SetCoolerLevels()", NvAPI_rc, string);
}
return NvAPI_rc;
}
NvAPI_Status hm_NvAPI_GPU_RestoreCoolerSettings (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex)
{
if (!nvapi) return (NvAPI_Status) -1;
NvAPI_Status NvAPI_rc = nvapi->NvAPI_GPU_RestoreCoolerSettings (hPhysicalGpu, coolerIndex);
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
log_info ("WARN: %s %d %s\n", "NvAPI_GPU_RestoreCoolerSettings()", NvAPI_rc, string);
}
return NvAPI_rc;
}
#if defined (__MINGW64__)
void __security_check_cookie (uintptr_t _StackCookie)
{
(void) _StackCookie;
}
void __GSHandlerCheck ()
{
}
#endif

@ -4,466 +4,8 @@
*/
#include "common.h"
#include "logging.h"
#include "types.h"
#include "event.h"
#include "memory.h"
#include "dynloader.h"
#include "ext_nvml.h"
int nvml_init (NVML_PTR *nvml)
{
if (!nvml) return -1;
memset (nvml, 0, sizeof (NVML_PTR));
#if defined (_WIN)
nvml->lib = hc_dlopen ("nvml.dll");
if (!nvml->lib)
{
DWORD BufferSize = 1024;
DWORD Type = REG_SZ;
char *Buffer = (char *) mymalloc (BufferSize + 1);
HKEY hKey = 0;
if (RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\NVSMI", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
if (RegQueryValueExA (hKey, "NVSMIPATH", NULL, &Type, (LPBYTE)Buffer, &BufferSize) == ERROR_SUCCESS)
{
Buffer[BufferSize] = 0;
}
else
{
//if (user_options->quiet == false)
// log_info ("WARNING: NVML library load failed, proceed without NVML HWMon enabled.");
return -1;
}
RegCloseKey (hKey);
}
else
{
//if (user_options->quiet == false)
// log_info ("WARNING: NVML library load failed, proceed without NVML HWMon enabled.");
return -1;
}
strcat (Buffer, "\\nvml.dll");
nvml->lib = hc_dlopen (Buffer);
myfree (Buffer);
}
#elif defined (_POSIX)
nvml->lib = hc_dlopen ("libnvidia-ml.so", RTLD_NOW);
#endif
if (!nvml->lib)
{
//if (user_options->quiet == false)
// log_info ("WARNING: NVML library load failed, proceed without NVML HWMon enabled.");
return -1;
}
HC_LOAD_FUNC(nvml, nvmlErrorString, NVML_ERROR_STRING, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlInit, NVML_INIT, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlShutdown, NVML_SHUTDOWN, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetName, NVML_DEVICE_GET_NAME, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetHandleByIndex, NVML_DEVICE_GET_HANDLE_BY_INDEX, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetTemperature, NVML_DEVICE_GET_TEMPERATURE, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetFanSpeed, NVML_DEVICE_GET_FAN_SPEED, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetPowerUsage, NVML_DEVICE_GET_POWER_USAGE, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetUtilizationRates, NVML_DEVICE_GET_UTILIZATION_RATES, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetClockInfo, NVML_DEVICE_GET_CLOCKINFO, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetTemperatureThreshold, NVML_DEVICE_GET_THRESHOLD, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetCurrPcieLinkGeneration, NVML_DEVICE_GET_CURRPCIELINKGENERATION, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetCurrPcieLinkWidth, NVML_DEVICE_GET_CURRPCIELINKWIDTH, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetCurrentClocksThrottleReasons, NVML_DEVICE_GET_CURRENTCLOCKSTHROTTLEREASONS, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetSupportedClocksThrottleReasons, NVML_DEVICE_GET_SUPPORTEDCLOCKSTHROTTLEREASONS, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceSetComputeMode, NVML_DEVICE_SET_COMPUTEMODE, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceSetGpuOperationMode, NVML_DEVICE_SET_OPERATIONMODE, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetPowerManagementLimitConstraints, NVML_DEVICE_GET_POWERMANAGEMENTLIMITCONSTRAINTS, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceSetPowerManagementLimit, NVML_DEVICE_SET_POWERMANAGEMENTLIMIT, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetPowerManagementLimit, NVML_DEVICE_GET_POWERMANAGEMENTLIMIT, NVML, 0)
return 0;
}
void nvml_close (NVML_PTR *nvml)
{
if (nvml)
{
if (nvml->lib)
hc_dlclose (nvml->lib);
myfree (nvml);
}
}
const char *hm_NVML_nvmlErrorString (NVML_PTR *nvml, nvmlReturn_t nvml_rc)
{
if (!nvml) return NULL;
return nvml->nvmlErrorString (nvml_rc);
}
nvmlReturn_t hm_NVML_nvmlInit (NVML_PTR *nvml)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = (nvmlReturn_t)nvml->nvmlInit ();
if (nvml_rc != NVML_SUCCESS)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlInit()", nvml_rc, string);
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlShutdown (NVML_PTR *nvml)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = (nvmlReturn_t)nvml->nvmlShutdown ();
if (nvml_rc != NVML_SUCCESS)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlShutdown()", nvml_rc, string);
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetName (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, char *name, unsigned int length)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetName (device, name, length);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetName()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetHandleByIndex (NVML_PTR *nvml, int skip_warnings, unsigned int index, nvmlDevice_t *device)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetHandleByIndex (index, device);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetHandleByIndex()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetTemperature (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, nvmlTemperatureSensors_t sensorType, unsigned int *temp)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetTemperature (device, sensorType, temp);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetTemperature()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetFanSpeed (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned int *speed)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetFanSpeed (device, speed);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetFanSpeed()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetPowerUsage (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned int *power)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetPowerUsage (device, power);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetPowerUsage()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetUtilizationRates (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, nvmlUtilization_t *utilization)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetUtilizationRates (device, utilization);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetUtilizationRates()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetClockInfo (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, nvmlClockType_t type, unsigned int *clock)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetClockInfo (device, type, clock);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetClockInfo()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetTemperatureThreshold (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int *temp)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetTemperatureThreshold (device, thresholdType, temp);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetTemperatureThreshold()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetCurrPcieLinkGeneration (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned int *currLinkGen)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetCurrPcieLinkGeneration (device, currLinkGen);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetCurrPcieLinkGeneration()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetCurrPcieLinkWidth (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned int *currLinkWidth)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetCurrPcieLinkWidth (device, currLinkWidth);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetCurrPcieLinkWidth()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetCurrentClocksThrottleReasons (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned long long *clocksThrottleReasons)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetCurrentClocksThrottleReasons (device, clocksThrottleReasons);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetCurrentClocksThrottleReasons()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetSupportedClocksThrottleReasons (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned long long *supportedClocksThrottleReasons)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetSupportedClocksThrottleReasons (device, supportedClocksThrottleReasons);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetSupportedClocksThrottleReasons()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceSetComputeMode (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, nvmlComputeMode_t mode)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceSetComputeMode (device, mode);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceSetComputeMode()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceSetGpuOperationMode (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, nvmlGpuOperationMode_t mode)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceSetGpuOperationMode (device, mode);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceSetGpuOperationMode()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned int *minLimit, unsigned int *maxLimit)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetPowerManagementLimitConstraints (device, minLimit, maxLimit);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetPowerManagementLimitConstraints()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceSetPowerManagementLimit (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned int limit)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceSetPowerManagementLimit (device, limit);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceSetPowerManagementLimit()", nvml_rc, string);
}
}
return nvml_rc;
}
nvmlReturn_t hm_NVML_nvmlDeviceGetPowerManagementLimit (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned int *limit)
{
if (!nvml) return (nvmlReturn_t) -1;
nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetPowerManagementLimit (device, limit);
if (nvml_rc != NVML_SUCCESS)
{
if (skip_warnings == 0)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
log_info ("WARN: %s %d %s\n", "nvmlDeviceGetPowerManagementLimit()", nvml_rc, string);
}
}
return nvml_rc;
}

@ -4,216 +4,7 @@
*/
#include "common.h"
#include "logging.h"
#include "types.h"
#include "event.h"
#include "memory.h"
#include "dynloader.h"
#include "ext_xnvctrl.h"
int xnvctrl_init (XNVCTRL_PTR *xnvctrl)
{
if (!xnvctrl) return -1;
memset (xnvctrl, 0, sizeof (XNVCTRL_PTR));
#if defined (_WIN)
// unsupport platform?
return -1;
#elif defined (_POSIX)
xnvctrl->lib_x11 = dlopen ("libX11.so", RTLD_LAZY);
if (xnvctrl->lib_x11 == NULL)
{
//if (user_options->quiet == false) log_info ("WARNING: Failed loading the X11 library: %s", dlerror());
//if (user_options->quiet == false) log_info (" Please install libx11-dev package.");
//if (user_options->quiet == false) log_info ("");
return -1;
}
xnvctrl->lib_xnvctrl = dlopen ("libXNVCtrl.so", RTLD_LAZY);
if (xnvctrl->lib_xnvctrl == NULL)
{
//if (user_options->quiet == false) log_info ("WARNING: Failed loading the XNVCTRL library: %s", dlerror());
//if (user_options->quiet == false) log_info (" Please install libxnvctrl-dev package.");
//if (user_options->quiet == false) log_info ("");
return -1;
}
HC_LOAD_FUNC2 (xnvctrl, XOpenDisplay, XOPENDISPLAY, lib_x11, X11, 0);
HC_LOAD_FUNC2 (xnvctrl, XCloseDisplay, XCLOSEDISPLAY, lib_x11, X11, 0);
HC_LOAD_FUNC2 (xnvctrl, XNVCTRLQueryTargetAttribute, XNVCTRLQUERYTARGETATTRIBUTE, lib_xnvctrl, XNVCTRL, 0);
HC_LOAD_FUNC2 (xnvctrl, XNVCTRLSetTargetAttribute, XNVCTRLSETTARGETATTRIBUTE, lib_xnvctrl, XNVCTRL, 0);
#endif
return 0;
}
void xnvctrl_close (XNVCTRL_PTR *xnvctrl)
{
if (xnvctrl)
{
#if defined (_POSIX)
if (xnvctrl->lib_x11)
{
dlclose (xnvctrl->lib_x11);
}
if (xnvctrl->lib_xnvctrl)
{
dlclose (xnvctrl->lib_xnvctrl);
}
#endif
myfree (xnvctrl);
}
}
int hm_XNVCTRL_XOpenDisplay (XNVCTRL_PTR *xnvctrl)
{
if (xnvctrl == NULL) return -1;
if (xnvctrl->XOpenDisplay == NULL) return -1;
void *dpy = xnvctrl->XOpenDisplay (NULL);
if (dpy == NULL)
{
xnvctrl->dpy = NULL;
return -1;
}
xnvctrl->dpy = dpy;
return 0;
}
void hm_XNVCTRL_XCloseDisplay (XNVCTRL_PTR *xnvctrl)
{
if (xnvctrl == NULL) return;
if (xnvctrl->XCloseDisplay == NULL) return;
if (xnvctrl->dpy == NULL) return;
xnvctrl->XCloseDisplay (xnvctrl->dpy);
}
int get_fan_control (XNVCTRL_PTR *xnvctrl, int gpu, int *val)
{
if (xnvctrl == NULL) return -1;
if (xnvctrl->XNVCTRLQueryTargetAttribute == NULL) return -1;
if (xnvctrl->dpy == NULL) return -1;
int rc = xnvctrl->XNVCTRLQueryTargetAttribute (xnvctrl->dpy, NV_CTRL_TARGET_TYPE_GPU, gpu, 0, NV_CTRL_GPU_COOLER_MANUAL_CONTROL, val);
if (!rc) return -1;
return 0;
}
int set_fan_control (XNVCTRL_PTR *xnvctrl, int gpu, int val)
{
if (xnvctrl == NULL) return -1;
if (xnvctrl->XNVCTRLSetTargetAttribute == NULL) return -1;
if (xnvctrl->dpy == NULL) return -1;
int cur;
int rc = get_fan_control (xnvctrl, gpu, &cur);
if (rc == -1) return -1;
xnvctrl->XNVCTRLSetTargetAttribute (xnvctrl->dpy, NV_CTRL_TARGET_TYPE_GPU, gpu, 0, NV_CTRL_GPU_COOLER_MANUAL_CONTROL, val);
rc = get_fan_control (xnvctrl, gpu, &cur);
if (rc == -1) return -1;
if (cur != val) return -1;
return 0;
}
int get_core_threshold (XNVCTRL_PTR *xnvctrl, int gpu, int *val)
{
if (xnvctrl == NULL) return -1;
if (xnvctrl->XNVCTRLQueryTargetAttribute == NULL) return -1;
if (xnvctrl->dpy == NULL) return -1;
int rc = xnvctrl->XNVCTRLQueryTargetAttribute (xnvctrl->dpy, NV_CTRL_TARGET_TYPE_GPU, gpu, 0, NV_CTRL_GPU_CORE_THRESHOLD, val);
if (!rc) return -1;
return 0;
}
int get_fan_speed_current (XNVCTRL_PTR *xnvctrl, int gpu, int *val)
{
if (xnvctrl == NULL) return -1;
if (xnvctrl->XNVCTRLQueryTargetAttribute == NULL) return -1;
if (xnvctrl->dpy == NULL) return -1;
int rc = xnvctrl->XNVCTRLQueryTargetAttribute (xnvctrl->dpy, NV_CTRL_TARGET_TYPE_COOLER, gpu, 0, NV_CTRL_THERMAL_COOLER_CURRENT_LEVEL, val);
if (!rc) return -1;
return 0;
}
int get_fan_speed_target (XNVCTRL_PTR *xnvctrl, int gpu, int *val)
{
if (xnvctrl == NULL) return -1;
if (xnvctrl->XNVCTRLQueryTargetAttribute == NULL) return -1;
if (xnvctrl->dpy == NULL) return -1;
int rc = xnvctrl->XNVCTRLQueryTargetAttribute (xnvctrl->dpy, NV_CTRL_TARGET_TYPE_COOLER, gpu, 0, NV_CTRL_THERMAL_COOLER_LEVEL, val);
if (!rc) return -1;
return 0;
}
int set_fan_speed_target (XNVCTRL_PTR *xnvctrl, int gpu, int val)
{
if (xnvctrl == NULL) return -1;
if (xnvctrl->XNVCTRLSetTargetAttribute == NULL) return -1;
if (xnvctrl->dpy == NULL) return -1;
int cur;
int rc = get_fan_speed_target (xnvctrl, gpu, &cur);
if (rc == -1) return -1;
xnvctrl->XNVCTRLSetTargetAttribute (xnvctrl->dpy, NV_CTRL_TARGET_TYPE_COOLER, gpu, 0, NV_CTRL_THERMAL_COOLER_LEVEL, val);
rc = get_fan_speed_target (xnvctrl, gpu, &cur);
if (rc == -1) return -1;
if (cur != val) return -1;
return 0;
}

@ -10,12 +10,12 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "shared.h"
#include "folder.h"
#if defined (__APPLE__)
#include "logging.h"
#include "event.h"
#endif
int sort_by_stringptr (const void *p1, const void *p2)
@ -26,7 +26,7 @@ int sort_by_stringptr (const void *p1, const void *p2)
return strcmp (*s1, *s2);
}
char *get_exec_path ()
static char *get_exec_path ()
{
size_t exec_path_len = 1024;
@ -48,12 +48,7 @@ char *get_exec_path ()
u32 size = (u32) exec_path_len;
if (_NSGetExecutablePath (exec_path, &size) != 0)
{
log_error("! executable path buffer too small\n");
exit (-1);
}
if (_NSGetExecutablePath (exec_path, &size) != 0) return NULL;
const size_t len = strlen (exec_path);
@ -170,7 +165,7 @@ char **scan_directory (const char *path)
if (readdir_r (d, &e, &de) != 0)
{
log_error ("ERROR: readdir_r() failed");
event_log_error (hashcat_ctx, "ERROR: readdir_r() failed");
break;
}
@ -251,7 +246,7 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder,
if (getcwd (cwd, HCBUFSIZ_TINY - 1) == NULL)
{
log_error ("ERROR: getcwd(): %s", strerror (errno));
event_log_error (hashcat_ctx, "ERROR: getcwd(): %s", strerror (errno));
return -1;
}
@ -262,6 +257,13 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder,
char *exec_path = get_exec_path ();
if (exec_path == NULL)
{
event_log_error (hashcat_ctx, "ERROR: get_exec_path() failed");
return -1;
}
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
if (install_folder == NULL) install_folder = "/"; // makes library use easier
@ -271,14 +273,14 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder,
if (resolved_install_folder == NULL)
{
log_error ("ERROR: %s: %s", resolved_install_folder, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", resolved_install_folder, strerror (errno));
return -1;
}
if (resolved_exec_path == NULL)
{
log_error ("ERROR: %s: %s", resolved_exec_path, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", resolved_exec_path, strerror (errno));
return -1;
}
@ -342,7 +344,7 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder,
if (GetFullPathName (cpath, HCBUFSIZ_TINY - 1, cpath_real, NULL) == 0)
{
log_error ("ERROR: %s: %s", cpath, "GetFullPathName()");
event_log_error (hashcat_ctx, "ERROR: %s: %s", cpath, "GetFullPathName()");
return -1;
}
@ -355,7 +357,7 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder,
if (realpath (cpath, cpath_real) == NULL)
{
log_error ("ERROR: %s: %s", cpath, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", cpath, strerror (errno));
return -1;
}

@ -1023,8 +1023,19 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
dictstat_write (hashcat_ctx);
// final logfile entry
time (&status_ctx->proc_stop);
logfile_top_uint (status_ctx->proc_start);
logfile_top_uint (status_ctx->proc_stop);
EVENT (EVENT_LOGFILE_TOP_FINALIZE);
// free memory
EVENT (EVENT_GOODBYE_SCREEN);
debugfile_destroy (hashcat_ctx);
tuning_db_destroy (hashcat_ctx);
@ -1051,13 +1062,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
restore_ctx_destroy (hashcat_ctx);
time (&status_ctx->proc_stop);
logfile_top_uint (status_ctx->proc_start);
logfile_top_uint (status_ctx->proc_stop);
EVENT (EVENT_LOGFILE_TOP_FINALIZE);
user_options_extra_destroy (hashcat_ctx);
user_options_destroy (hashcat_ctx);
@ -1069,8 +1073,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
if (status_ctx->devices_status == STATUS_EXHAUSTED) rc_final = 1;
if (status_ctx->devices_status == STATUS_CRACKED) rc_final = 0;
EVENT (EVENT_GOODBYE_SCREEN);
event_ctx_destroy (hashcat_ctx);
status_ctx_destroy (hashcat_ctx);

@ -6,7 +6,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "hashes.h"
#include "debugfile.h"
@ -117,7 +117,7 @@ int sort_by_hash_no_salt (const void *v1, const void *v2, void *v3)
return sort_by_digest_p0p1 (d1, d2, v3);
}
void save_hash (hashcat_ctx_t *hashcat_ctx)
int save_hash (hashcat_ctx_t *hashcat_ctx)
{
hashes_t *hashes = hashcat_ctx->hashes;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
@ -139,9 +139,9 @@ void save_hash (hashcat_ctx_t *hashcat_ctx)
if (fp == NULL)
{
log_error ("ERROR: %s: %s", new_hashfile, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", new_hashfile, strerror (errno));
exit (-1);
return -1;
}
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
@ -198,21 +198,23 @@ void save_hash (hashcat_ctx_t *hashcat_ctx)
if (rename (hashfile, old_hashfile) != 0)
{
log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile, old_hashfile, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: Rename file '%s' to '%s': %s", hashfile, old_hashfile, strerror (errno));
exit (-1);
return -1;
}
unlink (hashfile);
if (rename (new_hashfile, hashfile) != 0)
{
log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile, hashfile, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: Rename file '%s' to '%s': %s", new_hashfile, hashfile, strerror (errno));
exit (-1);
return -1;
}
unlink (old_hashfile);
return 0;
}
void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain)
@ -309,11 +311,10 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 salt_pos)
{
cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
salt_t *salt_buf = &hashes->salts_buf[salt_pos];
@ -321,11 +322,11 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
cl_int CL_err;
CL_err = hc_clEnqueueReadBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_result, CL_TRUE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL);
CL_err = hc_clEnqueueReadBuffer (hashcat_ctx, device_param->command_queue, device_param->d_result, CL_TRUE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL);
if (CL_err != CL_SUCCESS)
{
log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err));
event_log_error (hashcat_ctx, "ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err));
return -1;
}
@ -334,15 +335,15 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
{
// display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
log_info_nn ("");
event_log_info_nn (hashcat_ctx, "");
plain_t *cracked = (plain_t *) mycalloc (num_cracked, sizeof (plain_t));
CL_err = hc_clEnqueueReadBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_plain_bufs, CL_TRUE, 0, num_cracked * sizeof (plain_t), cracked, 0, NULL, NULL);
CL_err = hc_clEnqueueReadBuffer (hashcat_ctx, device_param->command_queue, device_param->d_plain_bufs, CL_TRUE, 0, num_cracked * sizeof (plain_t), cracked, 0, NULL, NULL);
if (CL_err != CL_SUCCESS)
{
log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err));
event_log_error (hashcat_ctx, "ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err));
return -1;
}
@ -375,7 +376,7 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
}
}
if (hashes->salts_done == hashes->salts_cnt) mycracked (status_ctx);
if (hashes->salts_done == hashes->salts_cnt) mycracked (hashcat_ctx);
check_hash (hashcat_ctx, device_param, &cracked[i]);
}
@ -408,11 +409,11 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
memset (hashes->digests_shown_tmp, 0, salt_buf->digests_cnt * sizeof (u32));
CL_err = hc_clEnqueueWriteBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_digests_shown, CL_TRUE, salt_buf->digests_offset * sizeof (u32), salt_buf->digests_cnt * sizeof (u32), &hashes->digests_shown_tmp[salt_buf->digests_offset], 0, NULL, NULL);
CL_err = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_digests_shown, CL_TRUE, salt_buf->digests_offset * sizeof (u32), salt_buf->digests_cnt * sizeof (u32), &hashes->digests_shown_tmp[salt_buf->digests_offset], 0, NULL, NULL);
if (CL_err != CL_SUCCESS)
{
log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err));
event_log_error (hashcat_ctx, "ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err));
return -1;
}
@ -420,11 +421,11 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
num_cracked = 0;
CL_err = hc_clEnqueueWriteBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_result, CL_TRUE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL);
CL_err = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_result, CL_TRUE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL);
if (CL_err != CL_SUCCESS)
{
log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err));
event_log_error (hashcat_ctx, "ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err));
return -1;
}
@ -478,7 +479,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (stat (hashes->hashfile, &st) == -1)
{
log_error ("ERROR: %s: %s", hashes->hashfile, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", hashes->hashfile, strerror (errno));
return -1;
}
@ -500,12 +501,12 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if ((fp = fopen (hashfile, "rb")) == NULL)
{
log_error ("ERROR: %s: %s", hashfile, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", hashfile, strerror (errno));
return -1;
}
if (user_options->quiet == false) log_info_nn ("Counting lines in %s", hashfile);
if (user_options->quiet == false) event_log_info_nn (hashcat_ctx, "Counting lines in %s", hashfile);
hashes_avail = count_lines (fp);
@ -513,7 +514,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (hashes_avail == 0)
{
log_error ("ERROR: hashfile is empty or corrupt");
event_log_error (hashcat_ctx, "ERROR: hashfile is empty or corrupt");
fclose (fp);
@ -524,7 +525,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if ((user_options->remove == 1) && (hashlist_format != HLFMT_HASHCAT))
{
log_error ("ERROR: remove not supported in native hashfile-format mode");
event_log_error (hashcat_ctx, "ERROR: remove not supported in native hashfile-format mode");
fclose (fp);
@ -666,7 +667,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (hash_fmt_error)
{
log_info ("WARNING: Failed to parse hashes using the '%s' format", strhlfmt (hashlist_format));
event_log_warning (hashcat_ctx, "Failed to parse hashes using the '%s' format", strhlfmt (hashlist_format));
}
else
{
@ -688,7 +689,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
{
if (hash_len == 0)
{
log_error ("ERROR: hccap file not specified");
event_log_error (hashcat_ctx, "ERROR: hccap file not specified");
return -1;
}
@ -701,14 +702,14 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (fp == NULL)
{
log_error ("ERROR: %s: %s", hash_buf, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", hash_buf, strerror (errno));
return -1;
}
if (hashes_avail < 1)
{
log_error ("ERROR: hccap file is empty or corrupt");
event_log_error (hashcat_ctx, "ERROR: hccap file is empty or corrupt");
fclose (fp);
@ -734,7 +735,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (parser_status != PARSER_OK)
{
log_info ("WARNING: Hash '%s': %s", hash_buf, strparser (parser_status));
event_log_warning (hashcat_ctx, "Hash '%s': %s", hash_buf, strparser (parser_status));
continue;
}
@ -806,7 +807,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
}
else
{
log_info ("WARNING: Hash '%s': %s", input_buf, strparser (parser_status));
event_log_warning (hashcat_ctx, "Hash '%s': %s", input_buf, strparser (parser_status));
}
parser_status = hashconfig->parse_func (hash_buf + 16, 16, &hashes_buf[hashes_cnt], hashconfig);
@ -821,7 +822,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
}
else
{
log_info ("WARNING: Hash '%s': %s", input_buf, strparser (parser_status));
event_log_warning (hashcat_ctx, "Hash '%s': %s", input_buf, strparser (parser_status));
}
// show / left
@ -848,7 +849,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
}
else
{
log_info ("WARNING: Hash '%s': %s", input_buf, strparser (parser_status));
event_log_warning (hashcat_ctx, "Hash '%s': %s", input_buf, strparser (parser_status));
}
}
}
@ -868,7 +869,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
}
else
{
log_info ("WARNING: Hash '%s': %s", input_buf, strparser (parser_status));
event_log_warning (hashcat_ctx, "Hash '%s': %s", input_buf, strparser (parser_status));
}
}
}
@ -881,7 +882,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if ((fp = fopen (hashfile, "rb")) == NULL)
{
log_error ("ERROR: %s: %s", hashfile, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", hashfile, strerror (errno));
return -1;
}
@ -910,7 +911,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (hash_fmt_error)
{
log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format));
event_log_warning (hashcat_ctx, "failed to parse hashes using the '%s' format", strhlfmt (hashlist_format));
continue;
}
@ -963,7 +964,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (parser_status < PARSER_GLOBAL_ZERO)
{
log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", hashes->hashfile, line_num, line_buf, strparser (parser_status));
event_log_warning (hashcat_ctx, "Hashfile '%s' on line %u (%s): %s", hashes->hashfile, line_num, line_buf, strparser (parser_status));
continue;
}
@ -976,14 +977,14 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (parser_status < PARSER_GLOBAL_ZERO)
{
log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", hashes->hashfile, line_num, line_buf, strparser (parser_status));
event_log_warning (hashcat_ctx, "Hashfile '%s' on line %u (%s): %s", hashes->hashfile, line_num, line_buf, strparser (parser_status));
continue;
}
hash_t *lm_hash_right = &hashes_buf[hashes_cnt];
if (user_options->quiet == false) if ((hashes_cnt % 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt, hashes_avail, ((double) hashes_cnt / hashes_avail) * 100);
if (user_options->quiet == false) if ((hashes_cnt % 0x20000) == 0) event_log_info_nn (hashcat_ctx, "Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt, hashes_avail, ((double) hashes_cnt / hashes_avail) * 100);
hashes_cnt++;
@ -998,12 +999,12 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (parser_status < PARSER_GLOBAL_ZERO)
{
log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", hashes->hashfile, line_num, line_buf, strparser (parser_status));
event_log_warning (hashcat_ctx, "Hashfile '%s' on line %u (%s): %s", hashes->hashfile, line_num, line_buf, strparser (parser_status));
continue;
}
if (user_options->quiet == false) if ((hashes_cnt % 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt, hashes_avail, ((double) hashes_cnt / hashes_avail) * 100);
if (user_options->quiet == false) if ((hashes_cnt % 0x20000) == 0) event_log_info_nn (hashcat_ctx, "Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt, hashes_avail, ((double) hashes_cnt / hashes_avail) * 100);
if (user_options->show == true) potfile_show_request (hashcat_ctx, line_buf, line_len, &hashes_buf[hashes_cnt], sort_by_pot);
if (user_options->left == true) potfile_left_request (hashcat_ctx, line_buf, line_len, &hashes_buf[hashes_cnt], sort_by_pot);
@ -1017,12 +1018,12 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (parser_status < PARSER_GLOBAL_ZERO)
{
log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", hashes->hashfile, line_num, line_buf, strparser (parser_status));
event_log_warning (hashcat_ctx, "Hashfile '%s' on line %u (%s): %s", hashes->hashfile, line_num, line_buf, strparser (parser_status));
continue;
}
if (user_options->quiet == false) if ((hashes_cnt % 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt, hashes_avail, ((double) hashes_cnt / hashes_avail) * 100);
if (user_options->quiet == false) if ((hashes_cnt % 0x20000) == 0) event_log_info_nn (hashcat_ctx, "Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt, hashes_avail, ((double) hashes_cnt / hashes_avail) * 100);
if (user_options->show == true) potfile_show_request (hashcat_ctx, line_buf, line_len, &hashes_buf[hashes_cnt], sort_by_pot);
if (user_options->left == true) potfile_left_request (hashcat_ctx, line_buf, line_len, &hashes_buf[hashes_cnt], sort_by_pot);
@ -1035,7 +1036,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
fclose (fp);
if (user_options->quiet == false) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail, hashes_avail, 100.00);
if (user_options->quiet == false) event_log_info_nn (hashcat_ctx, "Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail, hashes_avail, 100.00);
}
}
@ -1043,7 +1044,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (hashes_cnt)
{
if (user_options->quiet == false) log_info_nn ("Sorting Hashes...");
if (user_options->quiet == false) event_log_info_nn (hashcat_ctx, "Sorting Hashes...");
if (hashconfig->is_salted)
{
@ -1062,7 +1063,6 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
hash_t *hashes_buf = hashes->hashes_buf;
@ -1072,7 +1072,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
* Remove duplicates
*/
if (user_options->quiet == false) log_info_nn ("Removing duplicate hashes...");
if (user_options->quiet == false) event_log_info_nn (hashcat_ctx, "Removing duplicate hashes...");
hashes_cnt = 1;
@ -1122,7 +1122,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
salts_buf_new = (salt_t *) mycalloc (1, sizeof (salt_t));
}
if (user_options->quiet == false) log_info_nn ("Structuring salts for cracking task...");
if (user_options->quiet == false) event_log_info_nn (hashcat_ctx, "Structuring salts for cracking task...");
u32 digests_cnt = hashes_cnt;
u32 digests_done = 0;
@ -1248,7 +1248,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
salts_done++;
}
if (salts_done == salts_cnt) mycracked (status_ctx);
if (salts_done == salts_cnt) mycracked (hashcat_ctx);
}
myfree (hashes->digests_buf);

File diff suppressed because it is too large Load Diff

@ -6,7 +6,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "folder.h"
#include "induct.h"
@ -64,14 +64,14 @@ int induct_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (rename (root_directory, root_directory_mv) != 0)
{
log_error ("ERROR: Rename directory %s to %s: %s", root_directory, root_directory_mv, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: Rename directory %s to %s: %s", root_directory, root_directory_mv, strerror (errno));
return -1;
}
}
else
{
log_error ("ERROR: %s: %s", root_directory, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", root_directory, strerror (errno));
return -1;
}
@ -79,7 +79,7 @@ int induct_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (hc_mkdir (root_directory, 0700) == -1)
{
log_error ("ERROR: %s: %s", root_directory, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", root_directory, strerror (errno));
return -1;
}
@ -142,7 +142,7 @@ void induct_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
}
else
{
log_error ("ERROR: %s: %s", induct_ctx->root_directory, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", induct_ctx->root_directory, strerror (errno));
//return -1;
}

@ -12,7 +12,7 @@
#include "bitops.h"
#include "memory.h"
#include "convert.h"
#include "logging.h"
#include "event.h"
#include "inc_hash_constants.h"
#include "cpu_aes.h"
#include "cpu_crc32.h"
@ -59,7 +59,8 @@ static const char PA_013[] = "Invalid psafe2 filesize";
static const char PA_014[] = "Invalid psafe3 filesize";
static const char PA_015[] = "Invalid truecrypt filesize";
static const char PA_016[] = "Invalid veracrypt filesize";
//static const char PA_017[] = "Invalid SIP directive, only MD5 is supported";
static const char PA_017[] = "Invalid SIP directive, only MD5 is supported";
static const char PA_018[] = "Hash-file exception";
static const char PA_255[] = "Unknown error";
static const char HT_00000[] = "MD5";
@ -2638,12 +2639,7 @@ int wpa_parse_hash (char *input_buf, u32 input_len, hash_t *hash_buf, const hash
u32 salt_len = strlen (in.essid);
if (salt_len > 36)
{
log_info ("WARNING: The ESSID length is too long, the hccap file may be invalid or corrupted");
return (PARSER_SALT_LENGTH);
}
if (salt_len > 36) return (PARSER_SALT_LENGTH);
memcpy (salt->salt_buf, in.essid, salt_len);
@ -2691,11 +2687,12 @@ int wpa_parse_hash (char *input_buf, u32 input_len, hash_t *hash_buf, const hash
if (wpa->keyver > 255)
{
log_info ("ATTENTION!");
log_info (" The WPA/WPA2 key version in your .hccap file is invalid!");
log_info (" This could be due to a recent aircrack-ng bug.");
log_info (" The key version was automatically reset to a reasonable value.");
log_info ("");
// not sure yet how to transport this message
//event_log_warning (hashcat_ctx, "ATTENTION!");
//event_log_warning (hashcat_ctx, " The WPA/WPA2 key version in your .hccap file is invalid!");
//event_log_warning (hashcat_ctx, " This could be due to a recent aircrack-ng bug.");
//event_log_warning (hashcat_ctx, " The key version was automatically reset to a reasonable value.");
//event_log_warning (hashcat_ctx, "");
wpa->keyver &= 0xff;
}
@ -2746,21 +2743,11 @@ int psafe2_parse_hash (char *input_buf, u32 input_len, hash_t *hash_buf, const h
salt_t *salt = hash_buf->salt;
if (input_len == 0)
{
log_error ("Password Safe v2 container not specified");
exit (-1);
}
if (input_len == 0) return (PARSER_HASH_LENGTH);
FILE *fp = fopen (input_buf, "rb");
if (fp == NULL)
{
log_error ("%s: %s", input_buf, strerror (errno));
exit (-1);
}
if (fp == NULL) return (PARSER_HASH_FILE);
psafe2_hdr buf;
@ -2793,21 +2780,11 @@ int psafe3_parse_hash (char *input_buf, u32 input_len, hash_t *hash_buf, const h
salt_t *salt = hash_buf->salt;
if (input_len == 0)
{
log_error (".psafe3 not specified");
exit (-1);
}
if (input_len == 0) return (PARSER_HASH_LENGTH);
FILE *fp = fopen (input_buf, "rb");
if (fp == NULL)
{
log_error ("%s: %s", input_buf, strerror (errno));
exit (-1);
}
if (fp == NULL) return (PARSER_HASH_FILE);
psafe3_t in;
@ -5122,21 +5099,11 @@ int truecrypt_parse_hash_1k (char *input_buf, u32 input_len, hash_t *hash_buf, c
tc_t *tc = (tc_t *) hash_buf->esalt;
if (input_len == 0)
{
log_error ("TrueCrypt container not specified");
exit (-1);
}
if (input_len == 0) return (PARSER_HASH_LENGTH);
FILE *fp = fopen (input_buf, "rb");
if (fp == NULL)
{
log_error ("%s: %s", input_buf, strerror (errno));
exit (-1);
}
if (fp == NULL) return (PARSER_HASH_FILE);
char buf[512] = { 0 };
@ -5171,21 +5138,11 @@ int truecrypt_parse_hash_2k (char *input_buf, u32 input_len, hash_t *hash_buf, c
tc_t *tc = (tc_t *) hash_buf->esalt;
if (input_len == 0)
{
log_error ("TrueCrypt container not specified");
exit (-1);
}
if (input_len == 0) return (PARSER_HASH_LENGTH);
FILE *fp = fopen (input_buf, "rb");
if (fp == NULL)
{
log_error ("%s: %s", input_buf, strerror (errno));
exit (-1);
}
if (fp == NULL) return (PARSER_HASH_FILE);
char buf[512] = { 0 };
@ -5220,21 +5177,11 @@ int veracrypt_parse_hash_200000 (char *input_buf, u32 input_len, hash_t *hash_bu
tc_t *tc = (tc_t *) hash_buf->esalt;
if (input_len == 0)
{
log_error ("VeraCrypt container not specified");
exit (-1);
}
if (input_len == 0) return (PARSER_HASH_LENGTH);
FILE *fp = fopen (input_buf, "rb");
if (fp == NULL)
{
log_error ("%s: %s", input_buf, strerror (errno));
exit (-1);
}
if (fp == NULL) return (PARSER_HASH_FILE);
char buf[512] = { 0 };
@ -5269,21 +5216,11 @@ int veracrypt_parse_hash_500000 (char *input_buf, u32 input_len, hash_t *hash_bu
tc_t *tc = (tc_t *) hash_buf->esalt;
if (input_len == 0)
{
log_error ("VeraCrypt container not specified");
exit (-1);
}
if (input_len == 0) return (PARSER_HASH_LENGTH);
FILE *fp = fopen (input_buf, "rb");
if (fp == NULL)
{
log_error ("%s: %s", input_buf, strerror (errno));
exit (-1);
}
if (fp == NULL) return (PARSER_HASH_FILE);
char buf[512] = { 0 };
@ -5318,21 +5255,11 @@ int veracrypt_parse_hash_327661 (char *input_buf, u32 input_len, hash_t *hash_bu
tc_t *tc = (tc_t *) hash_buf->esalt;
if (input_len == 0)
{
log_error ("VeraCrypt container not specified");
exit (-1);
}
if (input_len == 0) return (PARSER_HASH_LENGTH);
FILE *fp = fopen (input_buf, "rb");
if (fp == NULL)
{
log_error ("%s: %s", input_buf, strerror (errno));
exit (-1);
}
if (fp == NULL) return (PARSER_HASH_FILE);
char buf[512] = { 0 };
@ -5367,21 +5294,11 @@ int veracrypt_parse_hash_655331 (char *input_buf, u32 input_len, hash_t *hash_bu
tc_t *tc = (tc_t *) hash_buf->esalt;
if (input_len == 0)
{
log_error ("VeraCrypt container not specified");
exit (-1);
}
if (input_len == 0) return (PARSER_HASH_LENGTH);
FILE *fp = fopen (input_buf, "rb");
if (fp == NULL)
{
log_error ("%s: %s", input_buf, strerror (errno));
exit (-1);
}
if (fp == NULL) return (PARSER_HASH_FILE);
char buf[512] = { 0 };
@ -10810,8 +10727,6 @@ int sip_auth_parse_hash (char *input_buf, u32 input_len, hash_t *hash_buf, const
if (memcmp (directive_pos, "MD5", 3))
{
log_info ("ERROR: Only the MD5 directive is currently supported\n");
myfree (temp_input_buf);
return (PARSER_SIP_AUTH_DIRECTIVE);
@ -13103,7 +13018,9 @@ char *strparser (const u32 parser_status)
case PARSER_PSAFE2_FILE_SIZE: return ((char *) PA_013);
case PARSER_PSAFE3_FILE_SIZE: return ((char *) PA_014);
case PARSER_TC_FILE_SIZE: return ((char *) PA_015);
case PARSER_SIP_AUTH_DIRECTIVE: return ((char *) PA_016);
case PARSER_VC_FILE_SIZE: return ((char *) PA_016);
case PARSER_SIP_AUTH_DIRECTIVE: return ((char *) PA_017);
case PARSER_HASH_FILE: return ((char *) PA_018);
}
return ((char *) PA_255);
@ -19814,7 +19731,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->dgst_pos3 = 3;
break;
default: log_error ("ERROR: Unknown hash-type '%u' selected", hashconfig->hash_mode);
default: event_log_error (hashcat_ctx, "ERROR: Unknown hash-type '%u' selected", hashconfig->hash_mode);
return -1;
}
@ -19826,7 +19743,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
}
else
{
log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hashconfig->hash_mode);
event_log_error (hashcat_ctx, "ERROR: Parameter hex-salt not valid for hash-type %u", hashconfig->hash_mode);
return -1;
}

@ -4,12 +4,13 @@
*/
#include "common.h"
#include "logging.h"
#include "types.h"
#include "event.h"
#include "locking.h"
#if defined (F_SETLKW)
void lock_file (FILE *fp)
int lock_file (FILE *fp)
{
struct flock lock;
@ -17,15 +18,9 @@ void lock_file (FILE *fp)
lock.l_type = F_WRLCK;
while (fcntl (fileno (fp), F_SETLKW, &lock))
{
if (errno != EINTR)
{
log_error ("ERROR: Failed acquiring write lock: %s", strerror (errno));
if (fcntl (fileno (fp), F_SETLKW, &lock)) return -1;
exit (-1);
}
}
return 0;
}
void unlock_file (FILE *fp)

@ -10,7 +10,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "logfile.h"
static int logfile_generate_id ()
@ -90,7 +90,7 @@ int logfile_init (hashcat_ctx_t *hashcat_ctx)
if (fp == NULL)
{
log_error ("ERROR: %s: %s", logfile_ctx->logfile, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", logfile_ctx->logfile, strerror (errno));
return -1;
}

@ -1,138 +0,0 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#if defined (__APPLE__)
#include <stdio.h>
#endif
#include "common.h"
#include "logging.h"
static int last_len = 0;
static int log_final (FILE *fp, const char *fmt, va_list ap)
{
if (last_len)
{
fputc ('\r', fp);
for (int i = 0; i < last_len; i++)
{
fputc (' ', fp);
}
fputc ('\r', fp);
}
char s[4096] = { 0 };
const size_t max_len = sizeof (s);
const int len = vsnprintf (s, max_len, fmt, ap);
//if (len > max_len) len = max_len;
fwrite (s, (size_t) len, 1, fp);
fflush (fp);
last_len = len;
return last_len;
}
int log_out_nn (FILE *fp, const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
const int len = log_final (fp, fmt, ap);
va_end (ap);
return len;
}
int log_info_nn (const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
const int len = log_final (stdout, fmt, ap);
va_end (ap);
return len;
}
int log_error_nn (const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
const int len = log_final (stderr, fmt, ap);
va_end (ap);
return len;
}
int log_out (FILE *fp, const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
const int len = log_final (fp, fmt, ap);
va_end (ap);
fputc ('\n', fp);
last_len = 0;
return len;
}
int log_info (const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
const int len = log_final (stdout, fmt, ap);
va_end (ap);
fputc ('\n', stdout);
last_len = 0;
return len;
}
int log_error (const char *fmt, ...)
{
fputc ('\n', stderr);
fputc ('\n', stderr);
va_list ap;
va_start (ap, fmt);
const int len = log_final (stderr, fmt, ap);
va_end (ap);
fputc ('\n', stderr);
fputc ('\n', stderr);
last_len = 0;
return len;
}

@ -6,7 +6,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "shared.h"
#include "loopback.h"
@ -105,7 +105,7 @@ int loopback_write_open (hashcat_ctx_t *hashcat_ctx)
if (loopback_ctx->fp == NULL)
{
log_error ("ERROR: %s: %s", loopback_ctx->filename, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", loopback_ctx->filename, strerror (errno));
return -1;
}

@ -89,7 +89,7 @@ static int main_welcome_screen (hashcat_ctx_t *hashcat_ctx, const void *buf, con
{
// sets dos window size (windows only)
setup_console ();
setup_console (hashcat_ctx);
// Inform user things getting started
@ -324,7 +324,7 @@ static int main_potfile_remove_parse (hashcat_ctx_t *hashcat_ctx, const void *bu
if (user_options->quiet == true) return 0;
event_log_info (hashcat_ctx, "Comparing hashes with potfile entries...");
event_log_info_nn (hashcat_ctx, "Comparing hashes with potfile entries...");
return 0;
}

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "logging.h"
#include "memory.h"
void *mycalloc (size_t nmemb, size_t size)
@ -13,7 +12,7 @@ void *mycalloc (size_t nmemb, size_t size)
if (p == NULL)
{
log_error ("ERROR: %s", MSG_ENOMEM);
fprintf (stderr, "ERROR: %s", MSG_ENOMEM);
exit (-1);
}
@ -27,7 +26,7 @@ void *mymalloc (size_t size)
if (p == NULL)
{
log_error ("ERROR: %s", MSG_ENOMEM);
fprintf (stderr, "ERROR: %s", MSG_ENOMEM);
exit (-1);
}
@ -50,7 +49,7 @@ void *myrealloc (void *ptr, size_t oldsz, size_t add)
if (p == NULL)
{
log_error ("ERROR: %s", MSG_ENOMEM);
fprintf (stderr, "ERROR: %s", MSG_ENOMEM);
exit (-1);
}

@ -5,7 +5,7 @@
#include "common.h"
#include "types.h"
#include "logging.h"
#include "event.h"
#include "memory.h"
#include "hwmon.h"
#include "timer.h"
@ -17,7 +17,7 @@
#include "shared.h"
#include "monitor.h"
static void monitor (hashcat_ctx_t *hashcat_ctx)
static int monitor (hashcat_ctx_t *hashcat_ctx)
{
hashes_t *hashes = hashcat_ctx->hashes;
hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx;
@ -64,7 +64,7 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
if ((runtime_check == false) && (remove_check == false) && (status_check == false) && (restore_check == false) && (hwmon_check == false))
{
return;
return 0;
}
// these variables are mainly used for fan control
@ -115,11 +115,11 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
perfPolicies_info.version = MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1, 1);
perfPolicies_status.version = MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1, 1);
hm_NvAPI_GPU_GetPerfPoliciesInfo (hwmon_ctx->hm_nvapi, hwmon_ctx->hm_device[device_id].nvapi, &perfPolicies_info);
hm_NvAPI_GPU_GetPerfPoliciesInfo (hashcat_ctx, hwmon_ctx->hm_device[device_id].nvapi, &perfPolicies_info);
perfPolicies_status.info_value = perfPolicies_info.info_value;
hm_NvAPI_GPU_GetPerfPoliciesStatus (hwmon_ctx->hm_nvapi, hwmon_ctx->hm_device[device_id].nvapi, &perfPolicies_status);
hm_NvAPI_GPU_GetPerfPoliciesStatus (hashcat_ctx, hwmon_ctx->hm_device[device_id].nvapi, &perfPolicies_status);
if (perfPolicies_status.throttle & 2)
{
@ -127,11 +127,11 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->quiet == false) clear_prompt ();
log_info ("WARNING: Drivers temperature threshold hit on GPU #%d, expect performance to drop...", device_id + 1);
event_log_warning (hashcat_ctx, "Drivers temperature threshold hit on GPU #%d, expect performance to drop...", device_id + 1);
if (slowdown_warnings == 2)
{
log_info ("");
event_log_info (hashcat_ctx, "");
}
if (user_options->quiet == false) send_prompt ();
@ -174,9 +174,9 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
if (temperature > (int) user_options->gpu_temp_abort)
{
log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id + 1);
event_log_error (hashcat_ctx, "ERROR: Temperature limit on GPU %d reached, aborting...", device_id + 1);
myabort (status_ctx);
myabort (hashcat_ctx);
break;
}
@ -259,7 +259,9 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
if (restore_left == 0)
{
cycle_restore (hashcat_ctx);
const int rc = cycle_restore (hashcat_ctx);
if (rc == -1) return -1;
restore_left = user_options->restore_timer;
}
@ -286,10 +288,10 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->benchmark == false)
{
if (user_options->quiet == false) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
if (user_options->quiet == false) event_log_info (hashcat_ctx, "\nNOTE: Runtime limit reached, aborting...\n");
}
myabort (status_ctx);
myabort (hashcat_ctx);
}
}
@ -303,7 +305,9 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
{
hashes->digests_saved = hashes->digests_done;
save_hash (hashcat_ctx);
const int rc = save_hash (hashcat_ctx);
if (rc == -1) return -1;
}
remove_left = user_options->remove_timer;
@ -320,11 +324,11 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
if (user_options->quiet == false) clear_prompt ();
if (user_options->quiet == false) log_info ("");
if (user_options->quiet == false) event_log_info (hashcat_ctx, "");
status_display (hashcat_ctx);
if (user_options->quiet == false) log_info ("");
if (user_options->quiet == false) event_log_info (hashcat_ctx, "");
hc_thread_mutex_unlock (status_ctx->mux_display);
@ -339,7 +343,9 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
{
if (hashes->digests_saved != hashes->digests_done)
{
save_hash (hashcat_ctx);
const int rc = save_hash (hashcat_ctx);
if (rc == -1) return -1;
}
}
@ -347,20 +353,24 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
if (restore_check == true)
{
cycle_restore (hashcat_ctx);
const int rc = cycle_restore (hashcat_ctx);
if (rc == -1) return -1;
}
myfree (fan_speed_chgd);
myfree (temp_diff_old);
myfree (temp_diff_sum);
return 0;
}
void *thread_monitor (void *p)
{
hashcat_ctx_t *hashcat_ctx = (hashcat_ctx_t *) p;
monitor (hashcat_ctx);
monitor (hashcat_ctx); // we should give back some useful returncode
return NULL;
}

@ -10,7 +10,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "logfile.h"
#include "convert.h"
#include "filehandling.h"
@ -130,15 +130,15 @@ void mp_css_unicode_expand (mask_ctx_t *mask_ctx)
mask_ctx->css_cnt = css_cnt_unicode;
}
void mp_css_to_uniq_tbl (u32 css_cnt, cs_t *css, u32 uniq_tbls[SP_PW_MAX][CHARSIZ])
int mp_css_to_uniq_tbl (hashcat_ctx_t *hashcat_ctx, u32 css_cnt, cs_t *css, u32 uniq_tbls[SP_PW_MAX][CHARSIZ])
{
/* generates a lookup table where key is the char itself for fastest possible lookup performance */
if (css_cnt > SP_PW_MAX)
{
log_error ("ERROR: Mask length is too long");
event_log_error (hashcat_ctx, "ERROR: Mask length is too long");
exit (-1);
return -1;
}
for (u32 css_pos = 0; css_pos < css_cnt; css_pos++)
@ -155,10 +155,14 @@ void mp_css_to_uniq_tbl (u32 css_cnt, cs_t *css, u32 uniq_tbls[SP_PW_MAX][CHARSI
uniq_tbl[c] = 1;
}
}
return 0;
}
static void mp_add_cs_buf (u32 *in_buf, size_t in_len, cs_t *css, u32 css_cnt, const hashconfig_t *hashconfig)
static void mp_add_cs_buf (hashcat_ctx_t *hashcat_ctx, u32 *in_buf, size_t in_len, cs_t *css, u32 css_cnt)
{
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
cs_t *cs = &css[css_cnt];
size_t css_uniq_sz = CHARSIZ * sizeof (u32);
@ -192,8 +196,10 @@ static void mp_add_cs_buf (u32 *in_buf, size_t in_len, cs_t *css, u32 css_cnt, c
myfree (css_uniq);
}
static void mp_expand (char *in_buf, size_t in_len, cs_t *mp_sys, cs_t *mp_usr, u32 mp_usr_offset, int interpret, const hashconfig_t *hashconfig, const user_options_t *user_options)
static int mp_expand (hashcat_ctx_t *hashcat_ctx, char *in_buf, size_t in_len, cs_t *mp_sys, cs_t *mp_usr, u32 mp_usr_offset, int interpret)
{
const user_options_t *user_options = hashcat_ctx->user_options;
size_t in_pos;
for (in_pos = 0; in_pos < in_len; in_pos++)
@ -210,34 +216,34 @@ static void mp_expand (char *in_buf, size_t in_len, cs_t *mp_sys, cs_t *mp_usr,
switch (p1)
{
case 'l': mp_add_cs_buf (mp_sys[0].cs_buf, mp_sys[0].cs_len, mp_usr, mp_usr_offset, hashconfig);
case 'l': mp_add_cs_buf (hashcat_ctx, mp_sys[0].cs_buf, mp_sys[0].cs_len, mp_usr, mp_usr_offset);
break;
case 'u': mp_add_cs_buf (mp_sys[1].cs_buf, mp_sys[1].cs_len, mp_usr, mp_usr_offset, hashconfig);
case 'u': mp_add_cs_buf (hashcat_ctx, mp_sys[1].cs_buf, mp_sys[1].cs_len, mp_usr, mp_usr_offset);
break;
case 'd': mp_add_cs_buf (mp_sys[2].cs_buf, mp_sys[2].cs_len, mp_usr, mp_usr_offset, hashconfig);
case 'd': mp_add_cs_buf (hashcat_ctx, mp_sys[2].cs_buf, mp_sys[2].cs_len, mp_usr, mp_usr_offset);
break;
case 's': mp_add_cs_buf (mp_sys[3].cs_buf, mp_sys[3].cs_len, mp_usr, mp_usr_offset, hashconfig);
case 's': mp_add_cs_buf (hashcat_ctx, mp_sys[3].cs_buf, mp_sys[3].cs_len, mp_usr, mp_usr_offset);
break;
case 'a': mp_add_cs_buf (mp_sys[4].cs_buf, mp_sys[4].cs_len, mp_usr, mp_usr_offset, hashconfig);
case 'a': mp_add_cs_buf (hashcat_ctx, mp_sys[4].cs_buf, mp_sys[4].cs_len, mp_usr, mp_usr_offset);
break;
case 'b': mp_add_cs_buf (mp_sys[5].cs_buf, mp_sys[5].cs_len, mp_usr, mp_usr_offset, hashconfig);
case 'b': mp_add_cs_buf (hashcat_ctx, mp_sys[5].cs_buf, mp_sys[5].cs_len, mp_usr, mp_usr_offset);
break;
case '1': if (mp_usr[0].cs_len == 0) { log_error ("ERROR: Custom-charset 1 is undefined\n"); exit (-1); }
mp_add_cs_buf (mp_usr[0].cs_buf, mp_usr[0].cs_len, mp_usr, mp_usr_offset, hashconfig);
case '1': if (mp_usr[0].cs_len == 0) { event_log_error (hashcat_ctx, "ERROR: Custom-charset 1 is undefined"); return -1; }
mp_add_cs_buf (hashcat_ctx, mp_usr[0].cs_buf, mp_usr[0].cs_len, mp_usr, mp_usr_offset);
break;
case '2': if (mp_usr[1].cs_len == 0) { log_error ("ERROR: Custom-charset 2 is undefined\n"); exit (-1); }
mp_add_cs_buf (mp_usr[1].cs_buf, mp_usr[1].cs_len, mp_usr, mp_usr_offset, hashconfig);
case '2': if (mp_usr[1].cs_len == 0) { event_log_error (hashcat_ctx, "ERROR: Custom-charset 2 is undefined"); return -1; }
mp_add_cs_buf (hashcat_ctx, mp_usr[1].cs_buf, mp_usr[1].cs_len, mp_usr, mp_usr_offset);
break;
case '3': if (mp_usr[2].cs_len == 0) { log_error ("ERROR: Custom-charset 3 is undefined\n"); exit (-1); }
mp_add_cs_buf (mp_usr[2].cs_buf, mp_usr[2].cs_len, mp_usr, mp_usr_offset, hashconfig);
case '3': if (mp_usr[2].cs_len == 0) { event_log_error (hashcat_ctx, "ERROR: Custom-charset 3 is undefined"); return -1; }
mp_add_cs_buf (hashcat_ctx, mp_usr[2].cs_buf, mp_usr[2].cs_len, mp_usr, mp_usr_offset);
break;
case '4': if (mp_usr[3].cs_len == 0) { log_error ("ERROR: Custom-charset 4 is undefined\n"); exit (-1); }
mp_add_cs_buf (mp_usr[3].cs_buf, mp_usr[3].cs_len, mp_usr, mp_usr_offset, hashconfig);
case '4': if (mp_usr[3].cs_len == 0) { event_log_error (hashcat_ctx, "ERROR: Custom-charset 4 is undefined"); return -1; }
mp_add_cs_buf (hashcat_ctx, mp_usr[3].cs_buf, mp_usr[3].cs_len, mp_usr, mp_usr_offset);
break;
case '?': mp_add_cs_buf (&p0, 1, mp_usr, mp_usr_offset, hashconfig);
case '?': mp_add_cs_buf (hashcat_ctx, &p0, 1, mp_usr, mp_usr_offset);
break;
default: log_error ("Syntax error: %s", in_buf);
exit (-1);
default: event_log_error (hashcat_ctx, "Syntax error: %s", in_buf);
return -1;
}
}
else
@ -248,18 +254,18 @@ static void mp_expand (char *in_buf, size_t in_len, cs_t *mp_sys, cs_t *mp_usr,
if (in_pos == in_len)
{
log_error ("ERROR: The hex-charset option always expects couples of exactly 2 hexadecimal chars, failed mask: %s", in_buf);
event_log_error (hashcat_ctx, "ERROR: The hex-charset option always expects couples of exactly 2 hexadecimal chars, failed mask: %s", in_buf);
exit (-1);
return -1;
}
u32 p1 = in_buf[in_pos] & 0xff;
if ((is_valid_hex_char ((u8) p0) == false) || (is_valid_hex_char ((u8) p1) == false))
{
log_error ("ERROR: Invalid hex character detected in mask %s", in_buf);
event_log_error (hashcat_ctx, "ERROR: Invalid hex character detected in mask %s", in_buf);
exit (-1);
return -1;
}
u32 chr = 0;
@ -267,32 +273,24 @@ static void mp_expand (char *in_buf, size_t in_len, cs_t *mp_sys, cs_t *mp_usr,
chr = (u32) hex_convert ((u8) p1) << 0;
chr |= (u32) hex_convert ((u8) p0) << 4;
mp_add_cs_buf (&chr, 1, mp_usr, mp_usr_offset, hashconfig);
mp_add_cs_buf (hashcat_ctx, &chr, 1, mp_usr, mp_usr_offset);
}
else
{
u32 chr = p0;
mp_add_cs_buf (&chr, 1, mp_usr, mp_usr_offset, hashconfig);
mp_add_cs_buf (hashcat_ctx, &chr, 1, mp_usr, mp_usr_offset);
}
}
}
}
u64 mp_get_sum (u32 css_cnt, cs_t *css)
{
u64 sum = 1;
for (u32 css_pos = 0; css_pos < css_cnt; css_pos++)
{
sum *= css[css_pos].cs_len;
}
return (sum);
return 0;
}
cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, u32 *css_cnt, const hashconfig_t *hashconfig, const user_options_t *user_options)
static cs_t *mp_gen_css (hashcat_ctx_t *hashcat_ctx, char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, u32 *css_cnt)
{
const user_options_t *user_options = hashcat_ctx->user_options;
cs_t *css = (cs_t *) mycalloc (256, sizeof (cs_t));
u32 mask_pos;
@ -314,34 +312,34 @@ cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, u
switch (p1)
{
case 'l': mp_add_cs_buf (mp_sys[0].cs_buf, mp_sys[0].cs_len, css, css_pos, hashconfig);
case 'l': mp_add_cs_buf (hashcat_ctx, mp_sys[0].cs_buf, mp_sys[0].cs_len, css, css_pos);
break;
case 'u': mp_add_cs_buf (mp_sys[1].cs_buf, mp_sys[1].cs_len, css, css_pos, hashconfig);
case 'u': mp_add_cs_buf (hashcat_ctx, mp_sys[1].cs_buf, mp_sys[1].cs_len, css, css_pos);
break;
case 'd': mp_add_cs_buf (mp_sys[2].cs_buf, mp_sys[2].cs_len, css, css_pos, hashconfig);
case 'd': mp_add_cs_buf (hashcat_ctx, mp_sys[2].cs_buf, mp_sys[2].cs_len, css, css_pos);
break;
case 's': mp_add_cs_buf (mp_sys[3].cs_buf, mp_sys[3].cs_len, css, css_pos, hashconfig);
case 's': mp_add_cs_buf (hashcat_ctx, mp_sys[3].cs_buf, mp_sys[3].cs_len, css, css_pos);
break;
case 'a': mp_add_cs_buf (mp_sys[4].cs_buf, mp_sys[4].cs_len, css, css_pos, hashconfig);
case 'a': mp_add_cs_buf (hashcat_ctx, mp_sys[4].cs_buf, mp_sys[4].cs_len, css, css_pos);
break;
case 'b': mp_add_cs_buf (mp_sys[5].cs_buf, mp_sys[5].cs_len, css, css_pos, hashconfig);
case 'b': mp_add_cs_buf (hashcat_ctx, mp_sys[5].cs_buf, mp_sys[5].cs_len, css, css_pos);
break;
case '1': if (mp_usr[0].cs_len == 0) { log_error ("ERROR: Custom-charset 1 is undefined\n"); exit (-1); }
mp_add_cs_buf (mp_usr[0].cs_buf, mp_usr[0].cs_len, css, css_pos, hashconfig);
case '1': if (mp_usr[0].cs_len == 0) { event_log_error (hashcat_ctx, "ERROR: Custom-charset 1 is undefined\n"); return NULL; }
mp_add_cs_buf (hashcat_ctx, mp_usr[0].cs_buf, mp_usr[0].cs_len, css, css_pos);
break;
case '2': if (mp_usr[1].cs_len == 0) { log_error ("ERROR: Custom-charset 2 is undefined\n"); exit (-1); }
mp_add_cs_buf (mp_usr[1].cs_buf, mp_usr[1].cs_len, css, css_pos, hashconfig);
case '2': if (mp_usr[1].cs_len == 0) { event_log_error (hashcat_ctx, "ERROR: Custom-charset 2 is undefined\n"); return NULL; }
mp_add_cs_buf (hashcat_ctx, mp_usr[1].cs_buf, mp_usr[1].cs_len, css, css_pos);
break;
case '3': if (mp_usr[2].cs_len == 0) { log_error ("ERROR: Custom-charset 3 is undefined\n"); exit (-1); }
mp_add_cs_buf (mp_usr[2].cs_buf, mp_usr[2].cs_len, css, css_pos, hashconfig);
case '3': if (mp_usr[2].cs_len == 0) { event_log_error (hashcat_ctx, "ERROR: Custom-charset 3 is undefined\n"); return NULL; }
mp_add_cs_buf (hashcat_ctx, mp_usr[2].cs_buf, mp_usr[2].cs_len, css, css_pos);
break;
case '4': if (mp_usr[3].cs_len == 0) { log_error ("ERROR: Custom-charset 4 is undefined\n"); exit (-1); }
mp_add_cs_buf (mp_usr[3].cs_buf, mp_usr[3].cs_len, css, css_pos, hashconfig);
case '4': if (mp_usr[3].cs_len == 0) { event_log_error (hashcat_ctx, "ERROR: Custom-charset 4 is undefined\n"); return NULL; }
mp_add_cs_buf (hashcat_ctx, mp_usr[3].cs_buf, mp_usr[3].cs_len, css, css_pos);
break;
case '?': mp_add_cs_buf (&chr, 1, css, css_pos, hashconfig);
case '?': mp_add_cs_buf (hashcat_ctx, &chr, 1, css, css_pos);
break;
default: log_error ("ERROR: Syntax error: %s", mask_buf);
exit (-1);
default: event_log_error (hashcat_ctx, "ERROR: Syntax error: %s", mask_buf);
return NULL;
}
}
else
@ -354,9 +352,9 @@ cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, u
if (mask_pos == mask_len)
{
log_error ("ERROR: The hex-charset option always expects couples of exactly 2 hexadecimal chars, failed mask: %s", mask_buf);
event_log_error (hashcat_ctx, "ERROR: The hex-charset option always expects couples of exactly 2 hexadecimal chars, failed mask: %s", mask_buf);
exit (-1);
return NULL;
}
char p1 = mask_buf[mask_pos];
@ -365,9 +363,9 @@ cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, u
if ((is_valid_hex_char ((u8) p0) == false) || (is_valid_hex_char ((u8) p1) == false))
{
log_error ("ERROR: Invalid hex character detected in mask %s", mask_buf);
event_log_error (hashcat_ctx, "ERROR: Invalid hex character detected in mask %s", mask_buf);
exit (-1);
return NULL;
}
u32 chr = 0;
@ -375,22 +373,22 @@ cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, u
chr |= (u32) hex_convert ((u8) p1) << 0;
chr |= (u32) hex_convert ((u8) p0) << 4;
mp_add_cs_buf (&chr, 1, css, css_pos, hashconfig);
mp_add_cs_buf (hashcat_ctx, &chr, 1, css, css_pos);
}
else
{
u32 chr = (u32) p0;
mp_add_cs_buf (&chr, 1, css, css_pos, hashconfig);
mp_add_cs_buf (hashcat_ctx, &chr, 1, css, css_pos);
}
}
}
if (css_pos == 0)
{
log_error ("ERROR: Invalid mask length (0)");
event_log_error (hashcat_ctx, "ERROR: Invalid mask length (0)");
exit (-1);
return NULL;
}
*css_cnt = css_pos;
@ -398,6 +396,80 @@ cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, u
return (css);
}
static char *mp_get_truncated_mask (hashcat_ctx_t *hashcat_ctx, const char *mask_buf, const size_t mask_len, const u32 len)
{
const user_options_t *user_options = hashcat_ctx->user_options;
char *new_mask_buf = (char *) mymalloc (256);
u32 mask_pos;
u32 css_pos;
for (mask_pos = 0, css_pos = 0; mask_pos < mask_len; mask_pos++, css_pos++)
{
if (css_pos == len) break;
char p0 = mask_buf[mask_pos];
new_mask_buf[mask_pos] = p0;
if (p0 == '?')
{
mask_pos++;
if (mask_pos == mask_len) break;
new_mask_buf[mask_pos] = mask_buf[mask_pos];
}
else
{
if (user_options->hex_charset == true)
{
mask_pos++;
if (mask_pos == mask_len)
{
event_log_error (hashcat_ctx, "ERROR: The hex-charset option always expects couples of exactly 2 hexadecimal chars, failed mask: %s", mask_buf);
return NULL;
}
char p1 = mask_buf[mask_pos];
// if they are not valid hex character, show an error:
if ((is_valid_hex_char ((u8) p0) == false) || (is_valid_hex_char ((u8) p1) == false))
{
event_log_error (hashcat_ctx, "ERROR: Invalid hex character detected in mask: %s", mask_buf);
return NULL;
}
new_mask_buf[mask_pos] = p1;
}
}
}
if (css_pos == len) return (new_mask_buf);
myfree (new_mask_buf);
return (NULL);
}
u64 mp_get_sum (u32 css_cnt, cs_t *css)
{
u64 sum = 1;
for (u32 css_pos = 0; css_pos < css_cnt; css_pos++)
{
sum *= css[css_pos].cs_len;
}
return (sum);
}
void mp_exec (u64 val, char *buf, cs_t *css, int css_cnt)
{
for (int i = 0; i < css_cnt; i++)
@ -469,13 +541,15 @@ void mp_setup_sys (cs_t *mp_sys)
mp_sys[5].cs_len = pos; }
}
void mp_setup_usr (cs_t *mp_sys, cs_t *mp_usr, char *buf, u32 index, const hashconfig_t *hashconfig, const user_options_t *user_options)
int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr, char *buf, u32 index)
{
FILE *fp = fopen (buf, "rb");
if (fp == NULL || feof (fp)) // feof() in case if file is empty
{
mp_expand (buf, strlen (buf), mp_sys, mp_usr, index, 1, hashconfig, user_options);
const int rc = mp_expand (hashcat_ctx, buf, strlen (buf), mp_sys, mp_usr, index, 1);
if (rc == -1) return -1;
}
else
{
@ -489,131 +563,45 @@ void mp_setup_usr (cs_t *mp_sys, cs_t *mp_usr, char *buf, u32 index, const hashc
if (len == 0)
{
log_info ("WARNING: Charset file corrupted");
mp_expand (buf, strlen (buf), mp_sys, mp_usr, index, 1, hashconfig, user_options);
}
else
{
mp_expand (mp_file, (size_t) len, mp_sys, mp_usr, index, 0, hashconfig, user_options);
}
}
}
void mp_reset_usr (cs_t *mp_usr, u32 index)
{
mp_usr[index].cs_len = 0;
memset (mp_usr[index].cs_buf, 0, sizeof (mp_usr[index].cs_buf));
}
static char *mp_get_truncated_mask (const char *mask_buf, const size_t mask_len, const u32 len, const user_options_t *user_options)
{
char *new_mask_buf = (char *) mymalloc (256);
u32 mask_pos;
u32 css_pos;
for (mask_pos = 0, css_pos = 0; mask_pos < mask_len; mask_pos++, css_pos++)
{
if (css_pos == len) break;
char p0 = mask_buf[mask_pos];
new_mask_buf[mask_pos] = p0;
if (p0 == '?')
{
mask_pos++;
event_log_warning (hashcat_ctx, "Charset file corrupted");
if (mask_pos == mask_len) break;
const int rc = mp_expand (hashcat_ctx, buf, strlen (buf), mp_sys, mp_usr, index, 1);
new_mask_buf[mask_pos] = mask_buf[mask_pos];
if (rc == -1) return -1;
}
else
{
if (user_options->hex_charset == true)
{
mask_pos++;
if (mask_pos == mask_len)
{
log_error ("ERROR: The hex-charset option always expects couples of exactly 2 hexadecimal chars, failed mask: %s", mask_buf);
const int rc = mp_expand (hashcat_ctx, mp_file, (size_t) len, mp_sys, mp_usr, index, 0);
exit (-1);
}
char p1 = mask_buf[mask_pos];
// if they are not valid hex character, show an error:
if ((is_valid_hex_char ((u8) p0) == false) || (is_valid_hex_char ((u8) p1) == false))
{
log_error ("ERROR: Invalid hex character detected in mask: %s", mask_buf);
exit (-1);
}
new_mask_buf[mask_pos] = p1;
}
if (rc == -1) return -1;
}
}
if (css_pos == len) return (new_mask_buf);
myfree (new_mask_buf);
return (NULL);
return 0;
}
u64 sp_get_sum (u32 start, u32 stop, cs_t *root_css_buf)
void mp_reset_usr (cs_t *mp_usr, u32 index)
{
u64 sum = 1;
u32 i;
for (i = start; i < stop; i++)
{
sum *= root_css_buf[i].cs_len;
}
mp_usr[index].cs_len = 0;
return (sum);
memset (mp_usr[index].cs_buf, 0, sizeof (mp_usr[index].cs_buf));
}
void sp_exec (u64 ctx, char *pw_buf, cs_t *root_css_buf, cs_t *markov_css_buf, u32 start, u32 stop)
static int sp_setup_tbl (hashcat_ctx_t *hashcat_ctx)
{
u64 v = ctx;
cs_t *cs = &root_css_buf[start];
u32 i;
folder_config_t *folder_config = hashcat_ctx->folder_config;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
for (i = start; i < stop; i++)
{
const u64 m = v % cs->cs_len;
const u64 d = v / cs->cs_len;
v = d;
const u32 k = cs->cs_buf[m];
char *shared_dir = folder_config->shared_dir;
pw_buf[i - start] = (char) k;
cs = &markov_css_buf[(i * CHARSIZ) + k];
}
}
int sp_comp_val (const void *p1, const void *p2)
{
hcstat_table_t *b1 = (hcstat_table_t *) p1;
hcstat_table_t *b2 = (hcstat_table_t *) p2;
char *hcstat = user_options->markov_hcstat;
u32 disable = user_options->markov_disable;
u32 classic = user_options->markov_classic;
return b2->val - b1->val;
}
hcstat_table_t *root_table_buf = mask_ctx->root_table_buf;
hcstat_table_t *markov_table_buf = mask_ctx->markov_table_buf;
void sp_setup_tbl (const char *shared_dir, char *hcstat, u32 disable, u32 classic, hcstat_table_t *root_table_buf, hcstat_table_t *markov_table_buf)
{
u32 i;
u32 j;
u32 k;
@ -668,27 +656,27 @@ void sp_setup_tbl (const char *shared_dir, char *hcstat, u32 disable, u32 classi
if (fd == NULL)
{
log_error ("%s: %s", hcstat, strerror (errno));
event_log_error (hashcat_ctx, "%s: %s", hcstat, strerror (errno));
exit (-1);
return -1;
}
if (fread (root_stats_buf, sizeof (u64), SP_ROOT_CNT, fd) != SP_ROOT_CNT)
{
log_error ("%s: Could not load data", hcstat);
event_log_error (hashcat_ctx, "%s: Could not load data", hcstat);
fclose (fd);
exit (-1);
return -1;
}
if (fread (markov_stats_buf, sizeof (u64), SP_MARKOV_CNT, fd) != SP_MARKOV_CNT)
{
log_error ("%s: Could not load data", hcstat);
event_log_error (hashcat_ctx, "%s: Could not load data", hcstat);
fclose (fd);
exit (-1);
return -1;
}
fclose (fd);
@ -813,6 +801,53 @@ void sp_setup_tbl (const char *shared_dir, char *hcstat, u32 disable, u32 classi
qsort (markov_table_buf_by_key[i][j], CHARSIZ, sizeof (hcstat_table_t), sp_comp_val);
}
}
return 0;
}
u64 sp_get_sum (u32 start, u32 stop, cs_t *root_css_buf)
{
u64 sum = 1;
u32 i;
for (i = start; i < stop; i++)
{
sum *= root_css_buf[i].cs_len;
}
return (sum);
}
void sp_exec (u64 ctx, char *pw_buf, cs_t *root_css_buf, cs_t *markov_css_buf, u32 start, u32 stop)
{
u64 v = ctx;
cs_t *cs = &root_css_buf[start];
u32 i;
for (i = start; i < stop; i++)
{
const u64 m = v % cs->cs_len;
const u64 d = v / cs->cs_len;
v = d;
const u32 k = cs->cs_buf[m];
pw_buf[i - start] = (char) k;
cs = &markov_css_buf[(i * CHARSIZ) + k];
}
}
int sp_comp_val (const void *p1, const void *p2)
{
hcstat_table_t *b1 = (hcstat_table_t *) p1;
hcstat_table_t *b2 = (hcstat_table_t *) p2;
return b2->val - b1->val;
}
void sp_tbl_to_css (hcstat_table_t *root_table_buf, hcstat_table_t *markov_table_buf, cs_t *root_css_buf, cs_t *markov_css_buf, u32 threshold, u32 uniq_tbls[SP_PW_MAX][CHARSIZ])
@ -947,13 +982,16 @@ static void mask_append_final (mask_ctx_t *mask_ctx, const char *mask)
mask_ctx->masks_cnt++;
}
static void mask_append (mask_ctx_t *mask_ctx, const user_options_t *user_options, const char *mask)
static void mask_append (hashcat_ctx_t *hashcat_ctx, const char *mask)
{
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
if (user_options->increment == true)
{
for (u32 mask_len = user_options->increment_min; mask_len <= user_options->increment_max; mask_len++)
for (u32 increment_len = user_options->increment_min; increment_len <= user_options->increment_max; increment_len++)
{
char *mask_truncated = mp_get_truncated_mask (mask, strlen (mask), mask_len, user_options);
char *mask_truncated = mp_get_truncated_mask (hashcat_ctx, mask, strlen (mask), increment_len);
if (mask_truncated == NULL) break;
@ -991,11 +1029,13 @@ int mask_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
if (rc_mask_file == -1) return -1;
mask_ctx->css_buf = mp_gen_css (mask_ctx->mask, strlen (mask_ctx->mask), mask_ctx->mp_sys, mask_ctx->mp_usr, &mask_ctx->css_cnt, hashconfig, user_options);
mask_ctx->css_buf = mp_gen_css (hashcat_ctx, mask_ctx->mask, strlen (mask_ctx->mask), mask_ctx->mp_sys, mask_ctx->mp_usr, &mask_ctx->css_cnt);
if (mask_ctx->css_buf == NULL) return -1;
u32 uniq_tbls[SP_PW_MAX][CHARSIZ] = { { 0 } };
mp_css_to_uniq_tbl (mask_ctx->css_cnt, mask_ctx->css_buf, uniq_tbls);
mp_css_to_uniq_tbl (hashcat_ctx, mask_ctx->css_cnt, mask_ctx->css_buf, uniq_tbls);
sp_tbl_to_css (mask_ctx->root_table_buf, mask_ctx->markov_table_buf, mask_ctx->root_css_buf, mask_ctx->markov_css_buf, user_options->markov_threshold, uniq_tbls);
@ -1020,7 +1060,9 @@ int mask_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
if (user_options->attack_mode == ATTACK_MODE_BF) // always true
{
mask_ctx->css_buf = mp_gen_css (mask_ctx->mask, strlen (mask_ctx->mask), mask_ctx->mp_sys, mask_ctx->mp_usr, &mask_ctx->css_cnt, hashconfig, user_options);
mask_ctx->css_buf = mp_gen_css (hashcat_ctx, mask_ctx->mask, strlen (mask_ctx->mask), mask_ctx->mp_sys, mask_ctx->mp_usr, &mask_ctx->css_cnt);
if (mask_ctx->css_buf == NULL) return -1;
// special case for benchmark
@ -1045,12 +1087,12 @@ int mask_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
{
if (mask_ctx->css_cnt < mask_min)
{
log_info ("WARNING: Skipping mask '%s' because it is smaller than the minimum password length", mask_ctx->mask);
event_log_warning (hashcat_ctx, "Skipping mask '%s' because it is smaller than the minimum password length", mask_ctx->mask);
}
if (mask_ctx->css_cnt > mask_max)
{
log_info ("WARNING: Skipping mask '%s' because it is larger than the maximum password length", mask_ctx->mask);
event_log_warning (hashcat_ctx, "Skipping mask '%s' because it is larger than the maximum password length", mask_ctx->mask);
}
// skip to next mask
@ -1083,7 +1125,7 @@ int mask_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
u32 uniq_tbls[SP_PW_MAX][CHARSIZ] = { { 0 } };
mp_css_to_uniq_tbl (mask_ctx->css_cnt, mask_ctx->css_buf, uniq_tbls);
mp_css_to_uniq_tbl (hashcat_ctx, mask_ctx->css_cnt, mask_ctx->css_buf, uniq_tbls);
sp_tbl_to_css (mask_ctx->root_table_buf, mask_ctx->markov_table_buf, mask_ctx->root_css_buf, mask_ctx->markov_css_buf, user_options->markov_threshold, uniq_tbls);
@ -1108,8 +1150,6 @@ int mask_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
{
folder_config_t *folder_config = hashcat_ctx->folder_config;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
user_options_t *user_options = hashcat_ctx->user_options;
@ -1130,7 +1170,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
mask_ctx->root_table_buf = (hcstat_table_t *) mycalloc (SP_ROOT_CNT, sizeof (hcstat_table_t));
mask_ctx->markov_table_buf = (hcstat_table_t *) mycalloc (SP_MARKOV_CNT, sizeof (hcstat_table_t));
sp_setup_tbl (folder_config->shared_dir, user_options->markov_hcstat, user_options->markov_disable, user_options->markov_classic, mask_ctx->root_table_buf, mask_ctx->markov_table_buf);
sp_setup_tbl (hashcat_ctx);
mask_ctx->root_css_buf = (cs_t *) mycalloc (SP_PW_MAX, sizeof (cs_t));
mask_ctx->markov_css_buf = (cs_t *) mycalloc (SP_PW_MAX * CHARSIZ, sizeof (cs_t));
@ -1148,10 +1188,10 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
mp_setup_sys (mask_ctx->mp_sys);
if (user_options->custom_charset_1) mp_setup_usr (mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_1, 0, hashconfig, user_options);
if (user_options->custom_charset_2) mp_setup_usr (mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_2, 1, hashconfig, user_options);
if (user_options->custom_charset_3) mp_setup_usr (mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_3, 2, hashconfig, user_options);
if (user_options->custom_charset_4) mp_setup_usr (mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_4, 3, hashconfig, user_options);
if (user_options->custom_charset_1) mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_1, 0);
if (user_options->custom_charset_2) mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_2, 1);
if (user_options->custom_charset_3) mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_3, 2);
if (user_options->custom_charset_4) mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_4, 3);
if (user_options->attack_mode == ATTACK_MODE_BF)
{
@ -1165,7 +1205,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (stat (arg, &file_stat) == -1)
{
mask_append (mask_ctx, user_options, arg);
mask_append (hashcat_ctx, arg);
}
else
{
@ -1177,7 +1217,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (stat (arg, &file_stat) == -1)
{
log_error ("ERROR: %s: %s", arg, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", arg, strerror (errno));
return -1;
}
@ -1188,7 +1228,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (mask_fp == NULL)
{
log_error ("ERROR: %s: %s", arg, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", arg, strerror (errno));
return -1;
}
@ -1203,7 +1243,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (line_buf[0] == '#') continue;
mask_append (mask_ctx, user_options, line_buf);
mask_append (hashcat_ctx, line_buf);
}
myfree (line_buf);
@ -1212,7 +1252,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
}
else
{
log_error ("ERROR: %s: unsupported file-type", arg);
event_log_error (hashcat_ctx, "ERROR: %s: unsupported file-type", arg);
return -1;
}
@ -1223,14 +1263,14 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
{
const char *mask = DEF_MASK;
mask_append (mask_ctx, user_options, mask);
mask_append (hashcat_ctx, mask);
}
}
else
{
const char *mask = hashconfig_benchmark_mask (hashcat_ctx);
mask_append (mask_ctx, user_options, mask);
mask_append (hashcat_ctx, mask);
}
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
@ -1245,7 +1285,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (stat (arg, &file_stat) == -1)
{
mask_append (mask_ctx, user_options, arg);
mask_append (hashcat_ctx, arg);
}
else
{
@ -1257,7 +1297,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (mask_fp == NULL)
{
log_error ("ERROR: %s: %s", arg, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", arg, strerror (errno));
return -1;
}
@ -1272,7 +1312,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (line_buf[0] == '#') continue;
mask_append (mask_ctx, user_options, line_buf);
mask_append (hashcat_ctx, line_buf);
}
myfree (line_buf);
@ -1281,7 +1321,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
}
else
{
log_error ("ERROR: %s: unsupported file-type", arg);
event_log_error (hashcat_ctx, "ERROR: %s: unsupported file-type", arg);
return -1;
}
@ -1299,7 +1339,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (stat (arg, &file_stat) == -1)
{
mask_append (mask_ctx, user_options, arg);
mask_append (hashcat_ctx, arg);
}
else
{
@ -1311,7 +1351,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (mask_fp == NULL)
{
log_error ("ERROR: %s: %s", arg, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", arg, strerror (errno));
return -1;
}
@ -1326,7 +1366,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (line_buf[0] == '#') continue;
mask_append (mask_ctx, user_options, line_buf);
mask_append (hashcat_ctx, line_buf);
}
myfree (line_buf);
@ -1335,7 +1375,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
}
else
{
log_error ("ERROR: %s: unsupported file-type", arg);
event_log_error (hashcat_ctx, "ERROR: %s: unsupported file-type", arg);
return -1;
}
@ -1344,7 +1384,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (mask_ctx->masks_cnt == 0)
{
log_error ("ERROR: Invalid mask");
event_log_error (hashcat_ctx, "ERROR: Invalid mask");
return -1;
}
@ -1382,7 +1422,6 @@ void mask_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
int mask_ctx_parse_maskfile (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
@ -1432,7 +1471,7 @@ int mask_ctx_parse_maskfile (hashcat_ctx_t *hashcat_ctx)
if (mf_cnt >= MAX_MFS)
{
log_error ("ERROR: Invalid line '%s' in maskfile", mask_buf);
event_log_error (hashcat_ctx, "ERROR: Invalid line '%s' in maskfile", mask_buf);
return -1;
}
@ -1457,25 +1496,25 @@ int mask_ctx_parse_maskfile (hashcat_ctx_t *hashcat_ctx)
case 0:
user_options->custom_charset_1 = mfs[0].mf_buf;
mp_reset_usr (mask_ctx->mp_usr, 0);
mp_setup_usr (mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_1, 0, hashconfig, user_options);
mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_1, 0);
break;
case 1:
user_options->custom_charset_2 = mfs[1].mf_buf;
mp_reset_usr (mask_ctx->mp_usr, 1);
mp_setup_usr (mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_2, 1, hashconfig, user_options);
mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_2, 1);
break;
case 2:
user_options->custom_charset_3 = mfs[2].mf_buf;
mp_reset_usr (mask_ctx->mp_usr, 2);
mp_setup_usr (mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_3, 2, hashconfig, user_options);
mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_3, 2);
break;
case 3:
user_options->custom_charset_4 = mfs[3].mf_buf;
mp_reset_usr (mask_ctx->mp_usr, 3);
mp_setup_usr (mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_4, 3, hashconfig, user_options);
mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_4, 3);
break;
}
}

File diff suppressed because it is too large Load Diff

@ -6,7 +6,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "interface.h"
#include "hashes.h"
#include "mpsp.h"
@ -342,7 +342,7 @@ int outfile_write_open (hashcat_ctx_t *hashcat_ctx)
if (outfile_ctx->fp == NULL)
{
log_error ("ERROR: %s: %s", outfile_ctx->filename, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", outfile_ctx->filename, strerror (errno));
return -1;
}
@ -492,7 +492,7 @@ int outfile_and_hashfile (hashcat_ctx_t *hashcat_ctx)
if (memcmp (&tmpstat_outfile, &tmpstat_hashfile, sizeof (hc_stat)) == 0)
{
log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
event_log_error (hashcat_ctx, "ERROR: Hashfile and Outfile are not allowed to point to the same file");
return -1;
}

@ -6,7 +6,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "outfile_check.h"
#include "convert.h"
@ -263,7 +263,7 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx)
hashes->salts_done++;
if (hashes->salts_done == hashes->salts_cnt) mycracked (status_ctx);
if (hashes->salts_done == hashes->salts_cnt) mycracked (hashcat_ctx);
}
}
}
@ -356,7 +356,7 @@ int outcheck_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (is_dir == 0)
{
log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outcheck_ctx->root_directory);
event_log_error (hashcat_ctx, "ERROR: Directory specified in outfile-check '%s' is not a valid directory", outcheck_ctx->root_directory);
return -1;
}
@ -365,7 +365,7 @@ int outcheck_ctx_init (hashcat_ctx_t *hashcat_ctx)
{
if (hc_mkdir (outcheck_ctx->root_directory, 0700) == -1)
{
log_error ("ERROR: %s: %s", outcheck_ctx->root_directory, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", outcheck_ctx->root_directory, strerror (errno));
return -1;
}
@ -394,7 +394,7 @@ void outcheck_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
}
else
{
log_error ("ERROR: %s: %s", outcheck_ctx->root_directory, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", outcheck_ctx->root_directory, strerror (errno));
//return -1;
}

@ -7,7 +7,7 @@
#include "types.h"
#include "convert.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "interface.h"
#include "filehandling.h"
#include "outfile.h"
@ -351,7 +351,7 @@ void potfile_read_parse (hashcat_ctx_t *hashcat_ctx)
if (parser_status < PARSER_GLOBAL_ZERO)
{
// log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
// event_log_warning (hashcat_ctx, "Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
continue;
}
@ -391,7 +391,7 @@ int potfile_write_open (hashcat_ctx_t *hashcat_ctx)
if (potfile_ctx->fp == NULL)
{
log_error ("ERROR: %s: %s", potfile_ctx->filename, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", potfile_ctx->filename, strerror (errno));
return -1;
}
@ -503,7 +503,7 @@ void potfile_show_request (hashcat_ctx_t *hashcat_ctx, char *input_buf, int inpu
if (pot_ptr)
{
log_info_nn ("");
event_log_info_nn (hashcat_ctx, "");
input_buf[input_len] = 0;
@ -544,7 +544,7 @@ void potfile_left_request (hashcat_ctx_t *hashcat_ctx, char *input_buf, int inpu
if (pot_ptr == NULL)
{
log_info_nn ("");
event_log_info_nn (hashcat_ctx, "");
input_buf[input_len] = 0;
@ -605,7 +605,7 @@ void potfile_show_request_lm (hashcat_ctx_t *hashcat_ctx, char *input_buf, int i
// at least one half was found:
log_info_nn ("");
event_log_info_nn (hashcat_ctx, "");
input_buf[input_len] = 0;
@ -725,7 +725,7 @@ void potfile_left_request_lm (hashcat_ctx_t *hashcat_ctx, char *input_buf, int i
// ... at least one part was not cracked
log_info_nn ("");
event_log_info_nn (hashcat_ctx, "");
input_buf[input_len] = 0;

@ -6,7 +6,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "user_options.h"
#include "restore.h"
@ -52,7 +52,7 @@ u64 get_lowest_words_done (hashcat_ctx_t *hashcat_ctx)
return words_cur;
}
static void check_running_process (hashcat_ctx_t *hashcat_ctx)
static int check_running_process (hashcat_ctx_t *hashcat_ctx)
{
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
@ -60,7 +60,7 @@ static void check_running_process (hashcat_ctx_t *hashcat_ctx)
FILE *fp = fopen (eff_restore_file, "rb");
if (fp == NULL) return;
if (fp == NULL) return 0;
restore_data_t *rd = (restore_data_t *) mymalloc (sizeof (restore_data_t));
@ -68,9 +68,9 @@ static void check_running_process (hashcat_ctx_t *hashcat_ctx)
if (nread != 1)
{
log_error ("ERROR: Cannot read %s", eff_restore_file);
event_log_error (hashcat_ctx, "ERROR: Cannot read %s", eff_restore_file);
exit (-1);
return -1;
}
fclose (fp);
@ -104,9 +104,9 @@ static void check_running_process (hashcat_ctx_t *hashcat_ctx)
if (strcmp (argv0_r, pidbin_r) == 0)
{
log_error ("ERROR: Already an instance %s running on pid %d", pidbin, rd->pid);
event_log_error (hashcat_ctx, "ERROR: Already an instance %s running on pid %d", pidbin, rd->pid);
exit (-1);
return -1;
}
}
@ -127,9 +127,9 @@ static void check_running_process (hashcat_ctx_t *hashcat_ctx)
{
if (strcmp (pidbin, pidbin2) == 0)
{
log_error ("ERROR: Already an instance %s running on pid %d", pidbin2, rd->pid);
event_log_error (hashcat_ctx, "ERROR: Already an instance %s running on pid %d", pidbin2, rd->pid);
exit (-1);
return -1;
}
}
@ -142,15 +142,17 @@ static void check_running_process (hashcat_ctx_t *hashcat_ctx)
if (rd->version < RESTORE_VERSION_MIN)
{
log_error ("ERROR: Cannot use outdated %s. Please remove it.", eff_restore_file);
event_log_error (hashcat_ctx, "ERROR: Cannot use outdated %s. Please remove it.", eff_restore_file);
exit (-1);
return -1;
}
myfree (rd);
return 0;
}
void init_restore (hashcat_ctx_t *hashcat_ctx)
static int init_restore (hashcat_ctx_t *hashcat_ctx)
{
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
@ -158,7 +160,9 @@ void init_restore (hashcat_ctx_t *hashcat_ctx)
restore_ctx->rd = rd;
check_running_process (hashcat_ctx);
const int rc = check_running_process (hashcat_ctx);
if (rc == -1) return -1;
rd->version = RESTORE_VERSION_CUR;
@ -173,17 +177,19 @@ void init_restore (hashcat_ctx_t *hashcat_ctx)
if (getcwd (rd->cwd, 255) == NULL)
{
log_error ("ERROR: getcwd(): %s", strerror (errno));
event_log_error (hashcat_ctx, "ERROR: getcwd(): %s", strerror (errno));
exit (-1);
return -1;
}
return 0;
}
void read_restore (hashcat_ctx_t *hashcat_ctx)
static int read_restore (hashcat_ctx_t *hashcat_ctx)
{
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
if (restore_ctx->enabled == false) return;
if (restore_ctx->enabled == false) return 0;
char *eff_restore_file = restore_ctx->eff_restore_file;
@ -191,18 +197,18 @@ void read_restore (hashcat_ctx_t *hashcat_ctx)
if (fp == NULL)
{
log_error ("ERROR: Restore file '%s': %s", eff_restore_file, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: Restore file '%s': %s", eff_restore_file, strerror (errno));
exit (-1);
return -1;
}
restore_data_t *rd = restore_ctx->rd;
if (fread (rd, sizeof (restore_data_t), 1, fp) != 1)
{
log_error ("ERROR: Can't read %s", eff_restore_file);
event_log_error (hashcat_ctx, "ERROR: Can't read %s", eff_restore_file);
exit (-1);
return -1;
}
rd->argv = (char **) mycalloc (rd->argc, sizeof (char *));
@ -213,9 +219,9 @@ void read_restore (hashcat_ctx_t *hashcat_ctx)
{
if (fgets (buf, HCBUFSIZ_LARGE - 1, fp) == NULL)
{
log_error ("ERROR: Can't read %s", eff_restore_file);
event_log_error (hashcat_ctx, "ERROR: Can't read %s", eff_restore_file);
exit (-1);
return -1;
}
size_t len = strlen (buf);
@ -229,24 +235,26 @@ void read_restore (hashcat_ctx_t *hashcat_ctx)
fclose (fp);
log_info ("INFO: Changing current working directory to the path found within the .restore file: '%s'", rd->cwd);
event_log_info (hashcat_ctx, "INFO: Changing current working directory to the path found within the .restore file: '%s'", rd->cwd);
if (chdir (rd->cwd))
{
log_error ("ERROR: The directory '%s' does not exist. It is needed to restore (--restore) the session.\n"
event_log_error (hashcat_ctx, "ERROR: The directory '%s' does not exist. It is needed to restore (--restore) the session.\n"
" You could either create this directory (or link it) or update the .restore file using e.g. the analyze_hc_restore.pl tool:\n"
" https://github.com/philsmd/analyze_hc_restore\n"
" The directory must be relative to (or contain) all files/folders mentioned within the command line.", rd->cwd);
exit (-1);
return -1;
}
return 0;
}
void write_restore (hashcat_ctx_t *hashcat_ctx)
static int write_restore (hashcat_ctx_t *hashcat_ctx)
{
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
if (restore_ctx->enabled == false) return;
if (restore_ctx->enabled == false) return 0;
const u64 words_cur = get_lowest_words_done (hashcat_ctx);
@ -260,16 +268,16 @@ void write_restore (hashcat_ctx_t *hashcat_ctx)
if (fp == NULL)
{
log_error ("ERROR: %s: %s", new_restore_file, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", new_restore_file, strerror (errno));
exit (-1);
return -1;
}
if (setvbuf (fp, NULL, _IONBF, 0))
{
log_error ("ERROR: setvbuf file '%s': %s", new_restore_file, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: setvbuf file '%s': %s", new_restore_file, strerror (errno));
exit (-1);
return -1;
}
fwrite (rd, sizeof (restore_data_t), 1, fp);
@ -286,18 +294,22 @@ void write_restore (hashcat_ctx_t *hashcat_ctx)
fsync (fileno (fp));
fclose (fp);
return 0;
}
void cycle_restore (hashcat_ctx_t *hashcat_ctx)
int cycle_restore (hashcat_ctx_t *hashcat_ctx)
{
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
if (restore_ctx->enabled == false) return;
if (restore_ctx->enabled == false) return 0;
const char *eff_restore_file = restore_ctx->eff_restore_file;
const char *new_restore_file = restore_ctx->new_restore_file;
write_restore (hashcat_ctx);
const int rc_write_restore = write_restore (hashcat_ctx);
if (rc_write_restore == -1) return -1;
struct stat st;
@ -305,14 +317,16 @@ void cycle_restore (hashcat_ctx_t *hashcat_ctx)
{
if (unlink (eff_restore_file))
{
log_info ("WARN: Unlink file '%s': %s", eff_restore_file, strerror (errno));
event_log_warning (hashcat_ctx, "Unlink file '%s': %s", eff_restore_file, strerror (errno));
}
}
if (rename (new_restore_file, eff_restore_file))
{
log_info ("WARN: Rename file '%s' to '%s': %s", new_restore_file, eff_restore_file, strerror (errno));
event_log_warning (hashcat_ctx, "Rename file '%s' to '%s': %s", new_restore_file, eff_restore_file, strerror (errno));
}
return 0;
}
void unlink_restore (hashcat_ctx_t *hashcat_ctx)
@ -342,7 +356,7 @@ void stop_at_checkpoint (hashcat_ctx_t *hashcat_ctx)
if (restore_ctx->enabled == false)
{
log_info ("WARNING: This feature is disabled when --restore-disable is specified");
event_log_warning (hashcat_ctx, "This feature is disabled when --restore-disable is specified");
return;
}
@ -357,7 +371,7 @@ void stop_at_checkpoint (hashcat_ctx_t *hashcat_ctx)
status_ctx->run_thread_level1 = false;
status_ctx->run_thread_level2 = true;
log_info ("Checkpoint enabled: Will quit at next Restore Point update");
event_log_info (hashcat_ctx, "Checkpoint enabled: Will quit at next Restore Point update");
}
else
{
@ -367,7 +381,7 @@ void stop_at_checkpoint (hashcat_ctx_t *hashcat_ctx)
status_ctx->run_thread_level1 = true;
status_ctx->run_thread_level2 = true;
log_info ("Checkpoint disabled: Restore Point updates will no longer be monitored");
event_log_info (hashcat_ctx, "Checkpoint disabled: Restore Point updates will no longer be monitored");
}
}
@ -391,7 +405,9 @@ int restore_ctx_init (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
restore_ctx->eff_restore_file = eff_restore_file;
restore_ctx->new_restore_file = new_restore_file;
init_restore (hashcat_ctx);
const int rc_init_restore = init_restore (hashcat_ctx);
if (rc_init_restore == -1) return -1;
if (argc == 0) return 0;
if (argv == NULL) return 0;
@ -410,13 +426,15 @@ int restore_ctx_init (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
if (user_options->restore == true)
{
read_restore (hashcat_ctx);
const int rc_read_restore = read_restore (hashcat_ctx);
if (rc_read_restore == -1) return -1;
restore_data_t *rd = restore_ctx->rd;
if (rd->version < RESTORE_VERSION_MIN)
{
log_error ("ERROR: Incompatible restore-file version");
event_log_error (hashcat_ctx, "ERROR: Incompatible restore-file version");
return -1;
}

@ -10,7 +10,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "shared.h"
#include "filehandling.h"
#include "rp.h"
@ -756,7 +756,7 @@ int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32
if ((fp = fopen (rp_file, "rb")) == NULL)
{
log_error ("ERROR: %s: %s", rp_file, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", rp_file, strerror (errno));
return -1;
}
@ -785,14 +785,14 @@ int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32
if (result == -1)
{
log_info ("WARNING: Skipping invalid or unsupported rule in file %s on line %u: %s", rp_file, rule_line, rule_buf);
event_log_warning (hashcat_ctx, "Skipping invalid or unsupported rule in file %s on line %u: %s", rp_file, rule_line, rule_buf);
continue;
}
if (cpu_rule_to_kernel_rule (rule_buf, rule_len, &kernel_rules_buf[kernel_rules_cnt]) == -1)
{
log_info ("WARNING: Cannot convert rule for use on OpenCL device in file %s on line %u: %s", rp_file, rule_line, rule_buf);
event_log_warning (hashcat_ctx, "Cannot convert rule for use on OpenCL device in file %s on line %u: %s", rp_file, rule_line, rule_buf);
memset (&kernel_rules_buf[kernel_rules_cnt], 0, sizeof (kernel_rule_t)); // needs to be cleared otherwise we could have some remaining data
@ -846,7 +846,7 @@ int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32
{
if (out_pos == RULES_MAX - 1)
{
// log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
// event_log_warning (hashcat_ctx, "Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
break;
}
@ -860,7 +860,7 @@ int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32
if (kernel_rules_cnt == 0)
{
log_error ("ERROR: No valid rules left");
event_log_error (hashcat_ctx, "ERROR: No valid rules left");
return -1;
}

@ -6,7 +6,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "convert.h"
#include "restore.h"
#include "thread.h"
@ -159,14 +159,14 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
if (status_ctx->devices_status == STATUS_INIT)
{
log_error ("ERROR: status view is not available during initialization phase");
event_log_error (hashcat_ctx, "ERROR: status view is not available during initialization phase");
return;
}
if (status_ctx->devices_status == STATUS_AUTOTUNE)
{
log_error ("ERROR: status view is not available during autotune phase");
event_log_error (hashcat_ctx, "ERROR: status view is not available during autotune phase");
return;
}
@ -326,14 +326,14 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (status_ctx->devices_status == STATUS_INIT)
{
log_error ("ERROR: status view is not available during initialization phase");
event_log_error (hashcat_ctx, "ERROR: status view is not available during initialization phase");
return;
}
if (status_ctx->devices_status == STATUS_AUTOTUNE)
{
log_error ("ERROR: status view is not available during autotune phase");
event_log_error (hashcat_ctx, "ERROR: status view is not available during autotune phase");
return;
}
@ -352,7 +352,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
u32 tmp_len = 0;
log_info ("Session.Name...: %s", user_options->session);
event_log_info (hashcat_ctx, "Session.Name...: %s", user_options->session);
char *status_type = strstatus (status_ctx->devices_status);
@ -360,7 +360,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
char *hash_type = strhashtype (hash_mode); // not a bug
log_info ("Status.........: %s", status_type);
event_log_info (hashcat_ctx, "Status.........: %s", status_type);
/**
* show rules
@ -377,18 +377,18 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
snprintf (tmp_buf + tmp_len, sizeof (tmp_buf) - tmp_len, "File (%s)", user_options->rp_files[i]);
log_info ("Rules.Type.....: %s", tmp_buf);
event_log_info (hashcat_ctx, "Rules.Type.....: %s", tmp_buf);
tmp_len = 0;
}
if (user_options->rp_gen)
{
log_info ("Rules.Type.....: Generated (%u)", user_options->rp_gen);
event_log_info (hashcat_ctx, "Rules.Type.....: Generated (%u)", user_options->rp_gen);
if (user_options->rp_gen_seed)
{
log_info ("Rules.Seed.....: %u", user_options->rp_gen_seed);
event_log_info (hashcat_ctx, "Rules.Seed.....: %u", user_options->rp_gen_seed);
}
}
@ -405,17 +405,17 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
{
if (user_options_extra->wordlist_mode == WL_MODE_FILE)
{
log_info ("Input.Mode.....: File (%s)", straight_ctx->dict);
event_log_info (hashcat_ctx, "Input.Mode.....: File (%s)", straight_ctx->dict);
}
else if (user_options_extra->wordlist_mode == WL_MODE_STDIN)
{
log_info ("Input.Mode.....: Pipe");
event_log_info (hashcat_ctx, "Input.Mode.....: Pipe");
}
}
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
{
log_info ("Input.Left.....: File (%s)", combinator_ctx->dict1);
log_info ("Input.Right....: File (%s)", combinator_ctx->dict2);
event_log_info (hashcat_ctx, "Input.Left.....: File (%s)", combinator_ctx->dict1);
event_log_info (hashcat_ctx, "Input.Right....: File (%s)", combinator_ctx->dict2);
}
else if (user_options->attack_mode == ATTACK_MODE_BF)
{
@ -451,7 +451,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
tmp_len += snprintf (tmp_buf + tmp_len, sizeof (tmp_buf) - tmp_len, " (%.02f%%)", mask_percentage * 100);
}
log_info ("Input.Mode.....: %s", tmp_buf);
event_log_info (hashcat_ctx, "Input.Mode.....: %s", tmp_buf);
if ((custom_charset_1 != NULL) || (custom_charset_2 != NULL) || (custom_charset_3 != NULL) || (custom_charset_4 != NULL))
{
@ -460,7 +460,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (custom_charset_3 == NULL) custom_charset_3 = "Undefined";
if (custom_charset_4 == NULL) custom_charset_4 = "Undefined";
log_info ("Custom.Charset.: -1 %s, -2 %s, -3 %s, -4 %s", custom_charset_1, custom_charset_2, custom_charset_3, custom_charset_4);
event_log_info (hashcat_ctx, "Custom.Charset.: -1 %s, -2 %s, -3 %s, -4 %s", custom_charset_1, custom_charset_2, custom_charset_3, custom_charset_4);
}
}
@ -468,8 +468,8 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
{
log_info ("Input.Left.....: File (%s)", straight_ctx->dict);
log_info ("Input.Right....: Mask (%s) [%i]", mask_ctx->mask, mask_ctx->css_cnt);
event_log_info (hashcat_ctx, "Input.Left.....: File (%s)", straight_ctx->dict);
event_log_info (hashcat_ctx, "Input.Right....: Mask (%s) [%i]", mask_ctx->mask, mask_ctx->css_cnt);
if ((custom_charset_1 != NULL) || (custom_charset_2 != NULL) || (custom_charset_3 != NULL) || (custom_charset_4 != NULL))
{
@ -478,13 +478,13 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (custom_charset_3 == NULL) custom_charset_3 = "Undefined";
if (custom_charset_4 == NULL) custom_charset_4 = "Undefined";
log_info ("Custom.Charset.: -1 %s, -2 %s, -3 %s, -4 %s", custom_charset_1, custom_charset_2, custom_charset_3, custom_charset_4);
event_log_info (hashcat_ctx, "Custom.Charset.: -1 %s, -2 %s, -3 %s, -4 %s", custom_charset_1, custom_charset_2, custom_charset_3, custom_charset_4);
}
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
{
log_info ("Input.Left.....: Mask (%s) [%i]", mask_ctx->mask, mask_ctx->css_cnt);
log_info ("Input.Right....: File (%s)", straight_ctx->dict);
event_log_info (hashcat_ctx, "Input.Left.....: Mask (%s) [%i]", mask_ctx->mask, mask_ctx->css_cnt);
event_log_info (hashcat_ctx, "Input.Right....: File (%s)", straight_ctx->dict);
if ((custom_charset_1 != NULL) || (custom_charset_2 != NULL) || (custom_charset_3 != NULL) || (custom_charset_4 != NULL))
{
@ -493,7 +493,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (custom_charset_3 == NULL) custom_charset_3 = "Undefined";
if (custom_charset_4 == NULL) custom_charset_4 = "Undefined";
log_info ("Custom.Charset.: -1 %s, -2 %s, -3 %s, -4 %s", custom_charset_1, custom_charset_2, custom_charset_3, custom_charset_4);
event_log_info (hashcat_ctx, "Custom.Charset.: -1 %s, -2 %s, -3 %s, -4 %s", custom_charset_1, custom_charset_2, custom_charset_3, custom_charset_4);
}
}
@ -503,7 +503,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
{
wpa_t *wpa = (wpa_t *) hashes->esalts_buf;
log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
event_log_info (hashcat_ctx, "Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
(char *) hashes->salts_buf[0].salt_buf,
wpa->orig_mac1[0],
wpa->orig_mac1[1],
@ -520,19 +520,19 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
}
else if (hashconfig->hash_mode == 5200)
{
log_info ("Hash.Target....: File (%s)", hashes->hashfile);
event_log_info (hashcat_ctx, "Hash.Target....: File (%s)", hashes->hashfile);
}
else if (hashconfig->hash_mode == 9000)
{
log_info ("Hash.Target....: File (%s)", hashes->hashfile);
event_log_info (hashcat_ctx, "Hash.Target....: File (%s)", hashes->hashfile);
}
else if ((hashconfig->hash_mode >= 6200) && (hashconfig->hash_mode <= 6299))
{
log_info ("Hash.Target....: File (%s)", hashes->hashfile);
event_log_info (hashcat_ctx, "Hash.Target....: File (%s)", hashes->hashfile);
}
else if ((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode <= 13799))
{
log_info ("Hash.Target....: File (%s)", hashes->hashfile);
event_log_info (hashcat_ctx, "Hash.Target....: File (%s)", hashes->hashfile);
}
else
{
@ -549,7 +549,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
out_buf[44] = 0;
}
log_info ("Hash.Target....: %s", out_buf);
event_log_info (hashcat_ctx, "Hash.Target....: %s", out_buf);
}
}
else
@ -562,15 +562,15 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
ascii_digest (out_buf1, 0, 0, hashconfig, hashes);
ascii_digest (out_buf2, 0, 1, hashconfig, hashes);
log_info ("Hash.Target....: %s, %s", out_buf1, out_buf2);
event_log_info (hashcat_ctx, "Hash.Target....: %s, %s", out_buf1, out_buf2);
}
else
{
log_info ("Hash.Target....: File (%s)", hashes->hashfile);
event_log_info (hashcat_ctx, "Hash.Target....: File (%s)", hashes->hashfile);
}
}
log_info ("Hash.Type......: %s", hash_type);
event_log_info (hashcat_ctx, "Hash.Type......: %s", hash_type);
/**
* speed new
@ -693,12 +693,12 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (start[start_len - 1] == '\n') start[start_len - 1] = 0;
if (start[start_len - 2] == '\r') start[start_len - 2] = 0;
log_info ("Time.Started...: %s (%s)", start, display_run);
event_log_info (hashcat_ctx, "Time.Started...: %s (%s)", start, display_run);
}
}
else
{
log_info ("Time.Started...: 0 secs");
event_log_info (hashcat_ctx, "Time.Started...: 0 secs");
}
/**
@ -786,7 +786,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
}
else if ((u64) sec_etc > SEC10YEARS)
{
log_info ("Time.Estimated.: > 10 Years");
event_log_info (hashcat_ctx, "Time.Estimated.: > 10 Years");
}
else
{
@ -849,16 +849,16 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
format_timer_display (&tm_runtime, display_runtime, sizeof (display_runtime));
log_info ("Time.Estimated.: %s (%s), but limited (%s)", etc, display_etc, display_runtime);
event_log_info (hashcat_ctx, "Time.Estimated.: %s (%s), but limited (%s)", etc, display_etc, display_runtime);
}
else
{
log_info ("Time.Estimated.: %s (%s), but limit exceeded", etc, display_etc);
event_log_info (hashcat_ctx, "Time.Estimated.: %s (%s), but limit exceeded", etc, display_etc);
}
}
else
{
log_info ("Time.Estimated.: %s (%s)", etc, display_etc);
event_log_info (hashcat_ctx, "Time.Estimated.: %s (%s)", etc, display_etc);
}
}
}
@ -877,11 +877,11 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
{
if (user_options_extra->attack_kern == ATTACK_KERN_BF)
{
log_info ("Candidates.#%d..: [Generating]", device_id + 1);
event_log_info (hashcat_ctx, "Candidates.#%d..: [Generating]", device_id + 1);
}
else
{
log_info ("Candidates.#%d..: [Copying]", device_id + 1);
event_log_info (hashcat_ctx, "Candidates.#%d..: [Copying]", device_id + 1);
}
continue;
@ -919,11 +919,11 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
plain_ptr1[plain_len1 * 2] = 0;
plain_ptr2[plain_len2 * 2] = 0;
log_info ("Candidates.#%d..: $HEX[%s] -> $HEX[%s]", device_id + 1, plain_ptr1, plain_ptr2);
event_log_info (hashcat_ctx, "Candidates.#%d..: $HEX[%s] -> $HEX[%s]", device_id + 1, plain_ptr1, plain_ptr2);
}
else
{
log_info ("Candidates.#%d..: %s -> %s", device_id + 1, plain_ptr1, plain_ptr2);
event_log_info (hashcat_ctx, "Candidates.#%d..: %s -> %s", device_id + 1, plain_ptr1, plain_ptr2);
}
}
}
@ -940,7 +940,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
format_speed_display ((double) hashes_dev_ms[device_id] * 1000, display_dev_cur, sizeof (display_dev_cur));
log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id + 1, display_dev_cur, exec_all_ms[device_id]);
event_log_info (hashcat_ctx, "Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id + 1, display_dev_cur, exec_all_ms[device_id]);
}
char display_all_cur[16] = { 0 };
@ -949,12 +949,12 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
format_speed_display ((double) hashes_all_ms * 1000, display_all_cur, sizeof (display_all_cur));
if (opencl_ctx->devices_active > 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur);
if (opencl_ctx->devices_active > 1) event_log_info (hashcat_ctx, "Speed.Dev.#*...: %9sH/s", display_all_cur);
const double digests_percent = (double) hashes->digests_done / hashes->digests_cnt;
const double salts_percent = (double) hashes->salts_done / hashes->salts_cnt;
log_info ("Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", hashes->digests_done, hashes->digests_cnt, digests_percent * 100, hashes->salts_done, hashes->salts_cnt, salts_percent * 100);
event_log_info (hashcat_ctx, "Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", hashes->digests_done, hashes->digests_cnt, digests_percent * 100, hashes->salts_done, hashes->salts_cnt, salts_percent * 100);
// crack-per-time
@ -995,7 +995,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if ((cpt_ctx->cpt_start + 86400) < now)
{
log_info ("Recovered/Time.: CUR:%" PRIu64 ",%" PRIu64 ",%" PRIu64 " AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
event_log_info (hashcat_ctx, "Recovered/Time.: CUR:%" PRIu64 ",%" PRIu64 ",%" PRIu64 " AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
cpt_cur_min,
cpt_cur_hour,
cpt_cur_day,
@ -1005,7 +1005,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
}
else if ((cpt_ctx->cpt_start + 3600) < now)
{
log_info ("Recovered/Time.: CUR:%" PRIu64 ",%" PRIu64 ",N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
event_log_info (hashcat_ctx, "Recovered/Time.: CUR:%" PRIu64 ",%" PRIu64 ",N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
cpt_cur_min,
cpt_cur_hour,
cpt_avg_min,
@ -1014,7 +1014,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
}
else if ((cpt_ctx->cpt_start + 60) < now)
{
log_info ("Recovered/Time.: CUR:%" PRIu64 ",N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
event_log_info (hashcat_ctx, "Recovered/Time.: CUR:%" PRIu64 ",N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
cpt_cur_min,
cpt_avg_min,
cpt_avg_hour,
@ -1022,7 +1022,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
}
else
{
log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
event_log_info (hashcat_ctx, "Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
cpt_avg_min,
cpt_avg_hour,
cpt_avg_day);
@ -1051,14 +1051,14 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
percent_rejected = (double) (all_rejected) / (double) progress_cur;
}
log_info ("Progress.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", progress_cur_relative_skip, progress_end_relative_skip, percent_finished * 100);
log_info ("Rejected.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", all_rejected, progress_cur_relative_skip, percent_rejected * 100);
event_log_info (hashcat_ctx, "Progress.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", progress_cur_relative_skip, progress_end_relative_skip, percent_finished * 100);
event_log_info (hashcat_ctx, "Rejected.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", all_rejected, progress_cur_relative_skip, percent_rejected * 100);
if (user_options->restore_disable == false)
{
if (percent_finished != 1)
{
log_info ("Restore.Point..: %" PRIu64 "/%" PRIu64 " (%.02f%%)", restore_point, restore_total, percent_restore * 100);
event_log_info (hashcat_ctx, "Restore.Point..: %" PRIu64 "/%" PRIu64 " (%.02f%%)", restore_point, restore_total, percent_restore * 100);
}
}
}
@ -1067,24 +1067,24 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
{
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
{
log_info ("Progress.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", 0ull, 0ull, 100);
log_info ("Rejected.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", 0ull, 0ull, 100);
event_log_info (hashcat_ctx, "Progress.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", 0ull, 0ull, 100);
event_log_info (hashcat_ctx, "Rejected.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", 0ull, 0ull, 100);
if (user_options->restore_disable == false)
{
log_info ("Restore.Point..: %" PRIu64 "/%" PRIu64 " (%.02f%%)", 0ull, 0ull, 100);
event_log_info (hashcat_ctx, "Restore.Point..: %" PRIu64 "/%" PRIu64 " (%.02f%%)", 0ull, 0ull, 100);
}
}
else
{
log_info ("Progress.......: %" PRIu64 "", progress_cur_relative_skip);
log_info ("Rejected.......: %" PRIu64 "", all_rejected);
event_log_info (hashcat_ctx, "Progress.......: %" PRIu64 "", progress_cur_relative_skip);
event_log_info (hashcat_ctx, "Rejected.......: %" PRIu64 "", all_rejected);
// --restore not allowed if stdin is used -- really? why?
//if (user_options->restore_disable == false)
//{
// log_info ("Restore.Point..: %" PRIu64 "", restore_point);
// event_log_info (hashcat_ctx, "Restore.Point..: %" PRIu64 "", restore_point);
//}
}
}
@ -1169,7 +1169,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
output_len = strlen (output_buf);
}
log_info ("HWMon.Dev.#%d...:%s", device_id + 1, output_buf);
event_log_info (hashcat_ctx, "HWMon.Dev.#%d...:%s", device_id + 1, output_buf);
}
hc_thread_mutex_unlock (status_ctx->mux_hwmon);
@ -1184,14 +1184,14 @@ void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx)
if (status_ctx->devices_status == STATUS_INIT)
{
log_error ("ERROR: status view is not available during initialization phase");
event_log_error (hashcat_ctx, "ERROR: status view is not available during initialization phase");
return;
}
if (status_ctx->devices_status == STATUS_AUTOTUNE)
{
log_error ("ERROR: status view is not available during autotune phase");
event_log_error (hashcat_ctx, "ERROR: status view is not available during autotune phase");
return;
}
@ -1231,7 +1231,7 @@ void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx)
if (device_param->skipped) continue;
log_info ("%u:%u:%" PRIu64 "", device_id + 1, hashconfig->hash_mode, (hashes_dev_ms[device_id] * 1000));
event_log_info (hashcat_ctx, "%u:%u:%" PRIu64 "", device_id + 1, hashconfig->hash_mode, (hashes_dev_ms[device_id] * 1000));
}
}
@ -1243,14 +1243,14 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
if (status_ctx->devices_status == STATUS_INIT)
{
log_error ("ERROR: status view is not available during initialization phase");
event_log_error (hashcat_ctx, "ERROR: status view is not available during initialization phase");
return;
}
if (status_ctx->devices_status == STATUS_AUTOTUNE)
{
log_error ("ERROR: status view is not available during autotune phase");
event_log_error (hashcat_ctx, "ERROR: status view is not available during autotune phase");
return;
}
@ -1328,11 +1328,11 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
if (opencl_ctx->devices_active >= 10)
{
log_info ("Speed.Dev.#%d: %9sH/s (%0.2fms)", device_id + 1, display_dev_cur, exec_all_ms[device_id]);
event_log_info (hashcat_ctx, "Speed.Dev.#%d: %9sH/s (%0.2fms)", device_id + 1, display_dev_cur, exec_all_ms[device_id]);
}
else
{
log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id + 1, display_dev_cur, exec_all_ms[device_id]);
event_log_info (hashcat_ctx, "Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id + 1, display_dev_cur, exec_all_ms[device_id]);
}
}
@ -1342,7 +1342,7 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
format_speed_display ((double) hashes_all_ms * 1000, display_all_cur, sizeof (display_all_cur));
if (opencl_ctx->devices_active > 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur);
if (opencl_ctx->devices_active > 1) event_log_info (hashcat_ctx, "Speed.Dev.#*.: %9sH/s", display_all_cur);
}
int status_progress_init (hashcat_ctx_t *hashcat_ctx)

@ -5,7 +5,7 @@
#include "common.h"
#include "types.h"
#include "logging.h"
#include "event.h"
#include "locking.h"
#include "rp_kernel_on_cpu.h"
#include "mpsp.h"
@ -35,7 +35,7 @@ static void out_push (out_t *out, const u8 *pw_buf, const int pw_len)
}
}
void process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt)
int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt)
{
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
@ -56,11 +56,13 @@ void process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
{
if ((out.fp = fopen (filename, "ab")) != NULL)
{
lock_file (out.fp);
const int rc = lock_file (out.fp);
if (rc == -1) return -1;
}
else
{
log_error ("ERROR: %s: %s", filename, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", filename, strerror (errno));
out.fp = stdout;
}
@ -240,4 +242,6 @@ void process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
fclose (out.fp);
}
return 0;
}

@ -10,7 +10,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "logfile.h"
#include "shared.h"
#include "filehandling.h"
@ -69,7 +69,7 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
if (fd2 == NULL)
{
log_error ("ERROR: %s: %s", straight_ctx->dict, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", straight_ctx->dict, strerror (errno));
return -1;
}
@ -97,7 +97,7 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
if (fd2 == NULL)
{
log_error ("ERROR: %s: %s", combinator_ctx->dict1, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", combinator_ctx->dict1, strerror (errno));
return -1;
}
@ -112,7 +112,7 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
if (fd2 == NULL)
{
log_error ("ERROR: %s: %s", combinator_ctx->dict2, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", combinator_ctx->dict2, strerror (errno));
return -1;
}
@ -151,7 +151,7 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
if (fd2 == NULL)
{
log_error ("ERROR: %s: %s", straight_ctx->dict, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", straight_ctx->dict, strerror (errno));
return -1;
}
@ -272,7 +272,7 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (stat (l0_filename, &l0_stat) == -1)
{
log_error ("ERROR: %s: %s", l0_filename, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", l0_filename, strerror (errno));
return -1;
}
@ -295,7 +295,7 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (stat (l1_filename, &l1_stat) == -1)
{
log_error ("ERROR: %s: %s", l1_filename, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", l1_filename, strerror (errno));
return -1;
}
@ -317,7 +317,7 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (straight_ctx->dicts_cnt == 0)
{
log_error ("ERROR: No usable dictionary file found.");
event_log_error (hashcat_ctx, "ERROR: No usable dictionary file found.");
return -1;
}
@ -341,7 +341,7 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (stat (l0_filename, &l0_stat) == -1)
{
log_error ("ERROR: %s: %s", l0_filename, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", l0_filename, strerror (errno));
return -1;
}
@ -364,7 +364,7 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (stat (l1_filename, &l1_stat) == -1)
{
log_error ("ERROR: %s: %s", l1_filename, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", l1_filename, strerror (errno));
return -1;
}
@ -386,7 +386,7 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (straight_ctx->dicts_cnt == 0)
{
log_error ("ERROR: No usable dictionary file found.");
event_log_error (hashcat_ctx, "ERROR: No usable dictionary file found.");
return -1;
}
@ -401,7 +401,7 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (stat (l0_filename, &l0_stat) == -1)
{
log_error ("ERROR: %s: %s", l0_filename, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", l0_filename, strerror (errno));
return -1;
}
@ -424,7 +424,7 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (stat (l1_filename, &l1_stat) == -1)
{
log_error ("ERROR: %s: %s", l1_filename, strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", l1_filename, strerror (errno));
return -1;
}
@ -446,7 +446,7 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (straight_ctx->dicts_cnt == 0)
{
log_error ("ERROR: No usable dictionary file found.");
event_log_error (hashcat_ctx, "ERROR: No usable dictionary file found.");
return -1;
}

@ -5,7 +5,7 @@
#include "common.h"
#include "types.h"
#include "logging.h"
#include "event.h"
#include "thread.h"
#include "timer.h"
#include "status.h"
@ -29,23 +29,23 @@ void welcome_screen (hashcat_ctx_t *hashcat_ctx, const time_t proc_start, const
{
if (user_options->machine_readable == false)
{
log_info ("%s (%s) starting in benchmark-mode...", PROGNAME, version_tag);
log_info ("");
event_log_info (hashcat_ctx, "%s (%s) starting in benchmark-mode...", PROGNAME, version_tag);
event_log_info (hashcat_ctx, "");
}
else
{
log_info ("# %s (%s) %s", PROGNAME, version_tag, ctime (&proc_start));
event_log_info (hashcat_ctx, "# %s (%s) %s", PROGNAME, version_tag, ctime (&proc_start));
}
}
else if (user_options->restore == true)
{
log_info ("%s (%s) starting in restore-mode...", PROGNAME, version_tag);
log_info ("");
event_log_info (hashcat_ctx, "%s (%s) starting in restore-mode...", PROGNAME, version_tag);
event_log_info (hashcat_ctx, "");
}
else
{
log_info ("%s (%s) starting...", PROGNAME, version_tag);
log_info ("");
event_log_info (hashcat_ctx, "%s (%s) starting...", PROGNAME, version_tag);
event_log_info (hashcat_ctx, "");
}
}
@ -59,32 +59,32 @@ void goodbye_screen (hashcat_ctx_t *hashcat_ctx, const time_t proc_start, const
if (user_options->show == true) return;
if (user_options->left == true) return;
log_info_nn ("Started: %s", ctime (&proc_start));
log_info_nn ("Stopped: %s", ctime (&proc_stop));
event_log_info_nn (hashcat_ctx, "Started: %s", ctime (&proc_start));
event_log_info_nn (hashcat_ctx, "Stopped: %s", ctime (&proc_stop));
}
int setup_console ()
int setup_console (hashcat_ctx_t *hashcat_ctx)
{
#if defined (_WIN)
SetConsoleWindowSize (132);
if (_setmode (_fileno (stdin), _O_BINARY) == -1)
{
log_error ("ERROR: %s: %s", "stdin", strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", "stdin", strerror (errno));
return -1;
}
if (_setmode (_fileno (stdout), _O_BINARY) == -1)
{
log_error ("ERROR: %s: %s", "stdout", strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", "stdout", strerror (errno));
return -1;
}
if (_setmode (_fileno (stderr), _O_BINARY) == -1)
{
log_error ("ERROR: %s: %s", "stderr", strerror (errno));
event_log_error (hashcat_ctx, "ERROR: %s: %s", "stderr", strerror (errno));
return -1;
}
@ -141,7 +141,7 @@ static void keypress (hashcat_ctx_t *hashcat_ctx)
hc_thread_mutex_lock (status_ctx->mux_display);
log_info ("");
event_log_info (hashcat_ctx, "");
switch (ch)
{
@ -149,11 +149,11 @@ static void keypress (hashcat_ctx_t *hashcat_ctx)
case '\r':
case '\n':
log_info ("");
event_log_info (hashcat_ctx, "");
status_display (hashcat_ctx);
log_info ("");
event_log_info (hashcat_ctx, "");
if (quiet == false) send_prompt ();
@ -161,11 +161,13 @@ static void keypress (hashcat_ctx_t *hashcat_ctx)
case 'b':
log_info ("");
event_log_info (hashcat_ctx, "");
bypass (status_ctx);
bypass (hashcat_ctx);
log_info ("");
event_log_info (hashcat_ctx, "Next dictionary / mask in queue selected, bypassing current one");
event_log_info (hashcat_ctx, "");
if (quiet == false) send_prompt ();
@ -173,11 +175,16 @@ static void keypress (hashcat_ctx_t *hashcat_ctx)
case 'p':
log_info ("");
event_log_info (hashcat_ctx, "");
SuspendThreads (hashcat_ctx);
SuspendThreads (status_ctx);
if (status_ctx->devices_status == STATUS_PAUSED)
{
event_log_info (hashcat_ctx, "Paused");
}
log_info ("");
event_log_info (hashcat_ctx, "");
if (quiet == false) send_prompt ();
@ -185,11 +192,16 @@ static void keypress (hashcat_ctx_t *hashcat_ctx)
case 'r':
log_info ("");
event_log_info (hashcat_ctx, "");
ResumeThreads (hashcat_ctx);
ResumeThreads (status_ctx);
if (status_ctx->devices_status == STATUS_RUNNING)
{
event_log_info (hashcat_ctx, "Resumed");
}
log_info ("");
event_log_info (hashcat_ctx, "");
if (quiet == false) send_prompt ();
@ -197,11 +209,11 @@ static void keypress (hashcat_ctx_t *hashcat_ctx)
case 'c':
log_info ("");
event_log_info (hashcat_ctx, "");
stop_at_checkpoint (hashcat_ctx);
log_info ("");
event_log_info (hashcat_ctx, "");
if (quiet == false) send_prompt ();
@ -209,9 +221,9 @@ static void keypress (hashcat_ctx_t *hashcat_ctx)
case 'q':
log_info ("");
event_log_info (hashcat_ctx, "");
myabort (status_ctx);
myabort (hashcat_ctx);
break;
}

@ -6,7 +6,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "timer.h"
#include "shared.h"
#include "thread.h"
@ -116,8 +116,10 @@ void hc_signal (void (callback) (int))
#endif
*/
void mycracked (status_ctx_t *status_ctx)
void mycracked (hashcat_ctx_t *hashcat_ctx)
{
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
//if (status_ctx->devices_status != STATUS_RUNNING) return;
status_ctx->devices_status = STATUS_CRACKED;
@ -129,8 +131,10 @@ void mycracked (status_ctx_t *status_ctx)
status_ctx->run_thread_level2 = false;
}
void myabort (status_ctx_t *status_ctx)
void myabort (hashcat_ctx_t *hashcat_ctx)
{
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
//those checks create problems in benchmark mode, it's simply too short of a timeframe where it's running as STATUS_RUNNING
//if (status_ctx->devices_status != STATUS_RUNNING) return;
@ -143,8 +147,10 @@ void myabort (status_ctx_t *status_ctx)
status_ctx->run_thread_level2 = false;
}
void myquit (status_ctx_t *status_ctx)
void myquit (hashcat_ctx_t *hashcat_ctx)
{
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
//if (status_ctx->devices_status != STATUS_RUNNING) return;
status_ctx->devices_status = STATUS_QUIT;
@ -156,8 +162,10 @@ void myquit (status_ctx_t *status_ctx)
status_ctx->run_thread_level2 = false;
}
void bypass (status_ctx_t *status_ctx)
void bypass (hashcat_ctx_t *hashcat_ctx)
{
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
//if (status_ctx->devices_status != STATUS_RUNNING) return;
status_ctx->devices_status = STATUS_BYPASS;
@ -167,23 +175,23 @@ void bypass (status_ctx_t *status_ctx)
status_ctx->run_main_level3 = true;
status_ctx->run_thread_level1 = false;
status_ctx->run_thread_level2 = false;
log_info ("Next dictionary / mask in queue selected, bypassing current one");
}
void SuspendThreads (status_ctx_t *status_ctx)
void SuspendThreads (hashcat_ctx_t *hashcat_ctx)
{
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
if (status_ctx->devices_status != STATUS_RUNNING) return;
hc_timer_set (&status_ctx->timer_paused);
status_ctx->devices_status = STATUS_PAUSED;
log_info ("Paused");
}
void ResumeThreads (status_ctx_t *status_ctx)
void ResumeThreads (hashcat_ctx_t *hashcat_ctx)
{
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
if (status_ctx->devices_status != STATUS_PAUSED) return;
double ms_paused = hc_timer_get (status_ctx->timer_paused);
@ -191,6 +199,4 @@ void ResumeThreads (status_ctx_t *status_ctx)
status_ctx->ms_paused += ms_paused;
status_ctx->devices_status = STATUS_RUNNING;
log_info ("Resumed");
}

@ -7,7 +7,7 @@
#include "types.h"
#include "interface.h"
#include "timer.h"
#include "logging.h"
#include "event.h"
#include "memory.h"
#include "filehandling.h"
#include "ext_OpenCL.h"
@ -75,7 +75,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
if (fp == NULL)
{
log_error ("%s: %s", tuning_db_file, strerror (errno));
event_log_error (hashcat_ctx, "%s: %s", tuning_db_file, strerror (errno));
return -1;
}
@ -150,7 +150,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
(token_ptr[1][0] != '3') &&
(token_ptr[1][0] != '*'))
{
log_info ("WARNING: Tuning-db: Invalid attack_mode '%c' in Line '%u'", token_ptr[1][0], line_num);
event_log_warning (hashcat_ctx, "Tuning-db: Invalid attack_mode '%c' in Line '%u'", token_ptr[1][0], line_num);
continue;
}
@ -161,7 +161,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
(token_ptr[3][0] != '8') &&
(token_ptr[3][0] != 'N'))
{
log_info ("WARNING: Tuning-db: Invalid vector_width '%c' in Line '%u'", token_ptr[3][0], line_num);
event_log_warning (hashcat_ctx, "Tuning-db: Invalid vector_width '%c' in Line '%u'", token_ptr[3][0], line_num);
continue;
}
@ -184,7 +184,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
if ((kernel_accel < 1) || (kernel_accel > 1024))
{
log_info ("WARNING: Tuning-db: Invalid kernel_accel '%d' in Line '%u'", kernel_accel, line_num);
event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_accel '%d' in Line '%u'", kernel_accel, line_num);
continue;
}
@ -200,7 +200,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
if ((kernel_loops < 1) || (kernel_loops > 1024))
{
log_info ("WARNING: Tuning-db: Invalid kernel_loops '%d' in Line '%u'", kernel_loops, line_num);
event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%u'", kernel_loops, line_num);
continue;
}
@ -223,7 +223,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
}
else
{
log_info ("WARNING: Tuning-db: Invalid number of token in Line '%u'", line_num);
event_log_warning (hashcat_ctx, "Tuning-db: Invalid number of token in Line '%u'", line_num);
continue;
}

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "logging.h"
#include "usage.h"
static const char *USAGE_MINI[] =
@ -411,10 +410,10 @@ static const char *USAGE_BIG[] =
void usage_mini_print (const char *progname)
{
for (int i = 0; USAGE_MINI[i] != NULL; i++) log_info (USAGE_MINI[i], progname);
for (int i = 0; USAGE_MINI[i] != NULL; i++) printf (USAGE_MINI[i], progname);
}
void usage_big_print (const char *progname)
{
for (int i = 0; USAGE_BIG[i] != NULL; i++) log_info (USAGE_BIG[i], progname);
for (int i = 0; USAGE_BIG[i] != NULL; i++) printf (USAGE_BIG[i], progname);
}

@ -6,7 +6,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "logfile.h"
#include "interface.h"
#include "shared.h"
@ -320,7 +320,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
default:
{
log_error ("ERROR: Invalid argument specified");
event_log_error (hashcat_ctx, "ERROR: Invalid argument specified");
return -1;
}
@ -329,7 +329,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
if (optopt != 0)
{
log_error ("ERROR: Invalid argument specified");
event_log_error (hashcat_ctx, "ERROR: Invalid argument specified");
return -1;
}
@ -348,14 +348,14 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
if (user_options->hc_argc < 0)
{
log_error ("ERROR: hc_argc %d is invalid", user_options->hc_argc);
event_log_error (hashcat_ctx, "ERROR: hc_argc %d is invalid", user_options->hc_argc);
return -1;
}
if (user_options->hc_argv == NULL)
{
log_error ("ERROR: hc_argv is NULL");
event_log_error (hashcat_ctx, "ERROR: hc_argv is NULL");
return -1;
}
@ -367,21 +367,21 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
&& (user_options->attack_mode != ATTACK_MODE_HYBRID2)
&& (user_options->attack_mode != ATTACK_MODE_NONE))
{
log_error ("ERROR: Invalid attack-mode specified");
event_log_error (hashcat_ctx, "ERROR: Invalid attack-mode specified");
return -1;
}
if (user_options->runtime_chgd == true && user_options->runtime == 0)
{
log_error ("ERROR: Invalid runtime specified");
event_log_error (hashcat_ctx, "ERROR: Invalid runtime specified");
return -1;
}
if (user_options->hash_mode > 14100)
{
log_error ("ERROR: Invalid hash-type specified");
event_log_error (hashcat_ctx, "ERROR: Invalid hash-type specified");
return -1;
}
@ -393,7 +393,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
|| ((user_options->hash_mode >= 6200) && (user_options->hash_mode <= 6299))
|| ((user_options->hash_mode >= 13700) && (user_options->hash_mode <= 13799)))
{
log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (user_options->hash_mode));
event_log_error (hashcat_ctx, "ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (user_options->hash_mode));
return -1;
}
@ -401,7 +401,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
if (user_options->outfile_format > 16)
{
log_error ("ERROR: Invalid outfile-format specified");
event_log_error (hashcat_ctx, "ERROR: Invalid outfile-format specified");
return -1;
}
@ -410,7 +410,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->outfile_format_chgd == true)
{
log_error ("ERROR: Mixing outfile-format > 1 with left parameter is not allowed");
event_log_error (hashcat_ctx, "ERROR: Mixing outfile-format > 1 with left parameter is not allowed");
return -1;
}
@ -420,7 +420,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->outfile_format_chgd == true)
{
log_error ("ERROR: Mixing outfile-format > 7 with show parameter is not allowed");
event_log_error (hashcat_ctx, "ERROR: Mixing outfile-format > 7 with show parameter is not allowed");
return -1;
}
@ -428,49 +428,49 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
if (user_options->increment_min < INCREMENT_MIN)
{
log_error ("ERROR: Invalid increment-min specified");
event_log_error (hashcat_ctx, "ERROR: Invalid increment-min specified");
return -1;
}
if (user_options->increment_max > INCREMENT_MAX)
{
log_error ("ERROR: Invalid increment-max specified");
event_log_error (hashcat_ctx, "ERROR: Invalid increment-max specified");
return -1;
}
if (user_options->increment_min > user_options->increment_max)
{
log_error ("ERROR: Invalid increment-min specified");
event_log_error (hashcat_ctx, "ERROR: Invalid increment-min specified");
return -1;
}
if ((user_options->increment == true) && (user_options->attack_mode == ATTACK_MODE_STRAIGHT))
{
log_error ("ERROR: Increment is not allowed in attack-mode 0");
event_log_error (hashcat_ctx, "ERROR: Increment is not allowed in attack-mode 0");
return -1;
}
if ((user_options->increment == false) && (user_options->increment_min_chgd == true))
{
log_error ("ERROR: Increment-min is only supported combined with increment switch");
event_log_error (hashcat_ctx, "ERROR: Increment-min is only supported combined with increment switch");
return -1;
}
if ((user_options->increment == false) && (user_options->increment_max_chgd == true))
{
log_error ("ERROR: Increment-max is only supported combined with increment switch");
event_log_error (hashcat_ctx, "ERROR: Increment-max is only supported combined with increment switch");
return -1;
}
if (user_options->rp_files_cnt > 0 && user_options->rp_gen == true)
{
log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
event_log_error (hashcat_ctx, "ERROR: Use of both rules-file and rules-generate is not supported");
return -1;
}
@ -479,7 +479,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->attack_mode != ATTACK_MODE_STRAIGHT)
{
log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
event_log_error (hashcat_ctx, "ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
return -1;
}
@ -487,14 +487,14 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
if (user_options->bitmap_min > user_options->bitmap_max)
{
log_error ("ERROR: Invalid bitmap-min specified");
event_log_error (hashcat_ctx, "ERROR: Invalid bitmap-min specified");
return -1;
}
if (user_options->rp_gen_func_min > user_options->rp_gen_func_max)
{
log_error ("ERROR: Invalid rp-gen-func-min specified");
event_log_error (hashcat_ctx, "ERROR: Invalid rp-gen-func-min specified");
return -1;
}
@ -503,24 +503,24 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->force == false)
{
log_info ("The manual use of the -n option (or --kernel-accel) is outdated");
log_info ("Please consider using the -w option instead");
log_info ("You can use --force to override this but do not post error reports if you do so");
log_info ("");
event_log_info (hashcat_ctx, "The manual use of the -n option (or --kernel-accel) is outdated");
event_log_info (hashcat_ctx, "Please consider using the -w option instead");
event_log_info (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so");
event_log_info (hashcat_ctx, "");
return -1;
}
if (user_options->kernel_accel < 1)
{
log_error ("ERROR: Invalid kernel-accel specified");
event_log_error (hashcat_ctx, "ERROR: Invalid kernel-accel specified");
return -1;
}
if (user_options->kernel_accel > 1024)
{
log_error ("ERROR: Invalid kernel-accel specified");
event_log_error (hashcat_ctx, "ERROR: Invalid kernel-accel specified");
return -1;
}
@ -530,24 +530,24 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->force == false)
{
log_info ("The manual use of the -u option (or --kernel-loops) is outdated");
log_info ("Please consider using the -w option instead");
log_info ("You can use --force to override this but do not post error reports if you do so");
log_info ("");
event_log_info (hashcat_ctx, "The manual use of the -u option (or --kernel-loops) is outdated");
event_log_info (hashcat_ctx, "Please consider using the -w option instead");
event_log_info (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so");
event_log_info (hashcat_ctx, "");
return -1;
}
if (user_options->kernel_loops < 1)
{
log_error ("ERROR: Invalid kernel-loops specified");
event_log_error (hashcat_ctx, "ERROR: Invalid kernel-loops specified");
return -1;
}
if (user_options->kernel_loops > 1024)
{
log_error ("ERROR: Invalid kernel-loops specified");
event_log_error (hashcat_ctx, "ERROR: Invalid kernel-loops specified");
return -1;
}
@ -555,7 +555,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
if ((user_options->workload_profile < 1) || (user_options->workload_profile > 4))
{
log_error ("ERROR: workload-profile %i not available", user_options->workload_profile);
event_log_error (hashcat_ctx, "ERROR: workload-profile %i not available", user_options->workload_profile);
return -1;
}
@ -564,7 +564,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (is_power_of_2 (user_options->opencl_vector_width) == false || user_options->opencl_vector_width > 16)
{
log_error ("ERROR: opencl-vector-width %i not allowed", user_options->opencl_vector_width);
event_log_error (hashcat_ctx, "ERROR: opencl-vector-width %i not allowed", user_options->opencl_vector_width);
return -1;
}
@ -574,14 +574,14 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->remove == true)
{
log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
event_log_error (hashcat_ctx, "ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
return -1;
}
if (user_options->potfile_disable == true)
{
log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
event_log_error (hashcat_ctx, "ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
return -1;
}
@ -591,7 +591,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->outfile_autohex == false)
{
log_error ("ERROR: Mixing outfile-autohex-disable parameter not allowed with show parameter");
event_log_error (hashcat_ctx, "ERROR: Mixing outfile-autohex-disable parameter not allowed with show parameter");
return -1;
}
@ -601,13 +601,13 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->show == true)
{
log_error ("ERROR: Combining show parameter with keyspace parameter is not allowed");
event_log_error (hashcat_ctx, "ERROR: Combining show parameter with keyspace parameter is not allowed");
return -1;
}
else if (user_options->left == true)
{
log_error ("ERROR: Combining left parameter with keyspace parameter is not allowed");
event_log_error (hashcat_ctx, "ERROR: Combining left parameter with keyspace parameter is not allowed");
return -1;
}
@ -617,14 +617,14 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->remove == false)
{
log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
event_log_error (hashcat_ctx, "ERROR: Parameter remove-timer require parameter remove enabled");
return -1;
}
if (user_options->remove_timer < 1)
{
log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
event_log_error (hashcat_ctx, "ERROR: Parameter remove-timer must have a value greater than or equal to 1");
return -1;
}
@ -636,14 +636,14 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if ((user_options->rp_files_cnt == 0) && (user_options->rp_gen == 0))
{
log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
event_log_error (hashcat_ctx, "ERROR: Parameter loopback not allowed without rules-file or rules-generate");
return -1;
}
}
else
{
log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
event_log_error (hashcat_ctx, "ERROR: Parameter loopback allowed in attack-mode 0 only");
return -1;
}
@ -654,14 +654,14 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->attack_mode != ATTACK_MODE_STRAIGHT)
{
log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
event_log_error (hashcat_ctx, "ERROR: Parameter debug-mode option is only available with attack-mode 0");
return -1;
}
if ((user_options->rp_files_cnt == 0) && (user_options->rp_gen == 0))
{
log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
event_log_error (hashcat_ctx, "ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
return -1;
}
@ -669,7 +669,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
if (user_options->debug_mode > 4)
{
log_error ("ERROR: Invalid debug-mode specified");
event_log_error (hashcat_ctx, "ERROR: Invalid debug-mode specified");
return -1;
}
@ -678,7 +678,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->debug_mode < 1)
{
log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
event_log_error (hashcat_ctx, "ERROR: Parameter debug-file requires parameter debug-mode to be set");
return -1;
}
@ -688,7 +688,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->attack_mode == ATTACK_MODE_BF)
{
log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
event_log_error (hashcat_ctx, "ERROR: Parameter induction-dir not allowed with brute-force attacks");
return -1;
}
@ -698,7 +698,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if ((user_options->weak_hash_threshold != WEAK_HASH_THRESHOLD) && (user_options->weak_hash_threshold != 0))
{
log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
event_log_error (hashcat_ctx, "ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
return -1;
}
@ -706,7 +706,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
if (user_options->nvidia_spin_damp > 100)
{
log_error ("ERROR: setting --nvidia-spin-damp must be between 0 and 100 (inclusive)");
event_log_error (hashcat_ctx, "ERROR: setting --nvidia-spin-damp must be between 0 and 100 (inclusive)");
return -1;
}
@ -715,7 +715,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->gpu_temp_abort < user_options->gpu_temp_retain)
{
log_error ("ERROR: Invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
event_log_error (hashcat_ctx, "ERROR: Invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
return -1;
}
@ -727,7 +727,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if (user_options->attack_mode != ATTACK_MODE_BF)
{
log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
event_log_error (hashcat_ctx, "ERROR: Only attack-mode 3 allowed in benchmark mode");
return -1;
}

@ -5,7 +5,7 @@
#include "common.h"
#include "types.h"
#include "logging.h"
#include "event.h"
#include "opencl.h"
#include "hashes.h"
#include "weak_hash.h"

@ -6,7 +6,7 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "event.h"
#include "convert.h"
#include "dictstat.h"
#include "thread.h"
@ -322,8 +322,8 @@ u64 count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile)
keyspace *= combinator_ctx->combs_cnt;
}
if (user_options->quiet == false) log_info ("Cache-hit dictionary stats %s: %" PRIu64 " bytes, %" PRIu64 " words, %" PRIu64 " keyspace", dictfile, d.stat.st_size, cached_cnt, keyspace);
if (user_options->quiet == false) log_info ("");
if (user_options->quiet == false) event_log_info (hashcat_ctx, "Cache-hit dictionary stats %s: %" PRIu64 " bytes, %" PRIu64 " words, %" PRIu64 " keyspace", dictfile, d.stat.st_size, cached_cnt, keyspace);
if (user_options->quiet == false) event_log_info (hashcat_ctx, "");
//hc_signal (sigHandler_default);
@ -399,13 +399,13 @@ u64 count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile)
double percent = (double) comp / (double) d.stat.st_size;
if (user_options->quiet == false) log_info_nn ("Generating dictionary stats for %s: %" PRIu64 " bytes (%.2f%%), %" PRIu64 " words, %" PRIu64 " keyspace", dictfile, comp, percent * 100, cnt2, cnt);
if (user_options->quiet == false) event_log_info_nn (hashcat_ctx, "Generating dictionary stats for %s: %" PRIu64 " bytes (%.2f%%), %" PRIu64 " words, %" PRIu64 " keyspace", dictfile, comp, percent * 100, cnt2, cnt);
time (&prev);
}
if (user_options->quiet == false) log_info ("Generated dictionary stats for %s: %" PRIu64 " bytes, %" PRIu64 " words, %" PRIu64 " keyspace", dictfile, comp, cnt2, cnt);
if (user_options->quiet == false) log_info ("");
if (user_options->quiet == false) event_log_info (hashcat_ctx, "Generated dictionary stats for %s: %" PRIu64 " bytes, %" PRIu64 " words, %" PRIu64 " keyspace", dictfile, comp, cnt2, cnt);
if (user_options->quiet == false) event_log_info (hashcat_ctx, "");
dictstat_append (hashcat_ctx, &d);

Loading…
Cancel
Save