mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-21 23:58:07 +00:00
Merge pull request #3249 from philsmd/code_style
minor code style fixes
This commit is contained in:
commit
be5994c306
@ -42,11 +42,11 @@ HC_API_CALL void *thread_keypress (void *p);
|
||||
void SetConsoleWindowSize (const int x);
|
||||
#endif
|
||||
|
||||
int tty_break(void);
|
||||
int tty_getchar(void);
|
||||
int tty_fix(void);
|
||||
int tty_break (void);
|
||||
int tty_getchar (void);
|
||||
int tty_fix (void);
|
||||
|
||||
bool is_stdout_terminal(void);
|
||||
bool is_stdout_terminal (void);
|
||||
|
||||
void compress_terminal_line_length (char *out_buf, const size_t keep_from_beginning, const size_t keep_from_end);
|
||||
|
||||
|
@ -70,7 +70,7 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
|
||||
#elif defined(__NetBSD__)
|
||||
cpuset_t * cpuset;
|
||||
const int cpu_id_max = 8 * cpuset_size (cpuset);
|
||||
cpuset = cpuset_create();
|
||||
cpuset = cpuset_create ();
|
||||
if (cpuset == NULL)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "cpuset_create() failed with error: %d", errno);
|
||||
@ -157,7 +157,7 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
pthread_t thread = pthread_self ();
|
||||
|
||||
const int rc = pthread_setaffinity_np (thread, cpuset_size(cpuset), cpuset);
|
||||
const int rc = pthread_setaffinity_np (thread, cpuset_size (cpuset), cpuset);
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
|
@ -353,7 +353,7 @@ static bool setup_opencl_device_types_filter (hashcat_ctx_t *hashcat_ctx, const
|
||||
{
|
||||
#if defined (__APPLE__)
|
||||
|
||||
if (is_apple_silicon() == true)
|
||||
if (is_apple_silicon () == true)
|
||||
{
|
||||
// With Apple's M1* use GPU only, because CPU device it is not recognized by OpenCL
|
||||
|
||||
@ -1747,7 +1747,7 @@ int run_hip_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_
|
||||
|
||||
const u64 kernel_threads = device_param->kernel_wgs_bzero;
|
||||
|
||||
u64 num_elements = CEILDIV(num16d, kernel_threads);
|
||||
u64 num_elements = CEILDIV (num16d, kernel_threads);
|
||||
|
||||
hipFunction_t function = device_param->hip_function_bzero;
|
||||
|
||||
@ -2020,7 +2020,7 @@ int run_opencl_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *devi
|
||||
{
|
||||
const u64 kernel_threads = device_param->kernel_wgs_bzero;
|
||||
|
||||
u64 num_elements = round_up_multiple_64(num16d, kernel_threads);
|
||||
u64 num_elements = round_up_multiple_64 (num16d, kernel_threads);
|
||||
|
||||
cl_kernel kernel = device_param->opencl_kernel_bzero;
|
||||
|
||||
@ -5791,7 +5791,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
device_param->use_opencl20 = false;
|
||||
device_param->use_opencl21 = false;
|
||||
|
||||
device_param->is_apple_silicon = is_apple_silicon();
|
||||
device_param->is_apple_silicon = is_apple_silicon ();
|
||||
|
||||
// some attributes have to be hardcoded values because they are used for instance in the build options
|
||||
|
||||
@ -9561,7 +9561,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-D M2S(x)=XM2S(x) ");
|
||||
|
||||
#if defined (__APPLE__)
|
||||
if (is_apple_silicon() == true)
|
||||
if (is_apple_silicon () == true)
|
||||
{
|
||||
build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-D IS_APPLE_SILICON ");
|
||||
}
|
||||
|
@ -3369,7 +3369,7 @@ int brain_server (const char *listen_host, const int listen_port, const char *br
|
||||
close (server_fd);
|
||||
|
||||
#if defined (_WIN)
|
||||
WSACleanup();
|
||||
WSACleanup ();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -27,7 +27,7 @@ UInt32 hm_IOKIT_strtoul (const char *str, int size, int base)
|
||||
}
|
||||
else
|
||||
{
|
||||
total += (unsigned char)(str[i] << (size - 1 - i) * 8);
|
||||
total += (unsigned char) (str[i] << (size - 1 - i) * 8);
|
||||
}
|
||||
}
|
||||
return total;
|
||||
@ -37,7 +37,7 @@ void hm_IOKIT_ultostr (char *str, UInt32 val)
|
||||
{
|
||||
str[0] = '\0';
|
||||
|
||||
sprintf (str, "%c%c%c%c", (unsigned int)(val >> 24), (unsigned int)(val >> 16), (unsigned int)(val >> 8), (unsigned int)(val));
|
||||
sprintf (str, "%c%c%c%c", (unsigned int) (val >> 24), (unsigned int) (val >> 16), (unsigned int) (val >> 8), (unsigned int) (val));
|
||||
}
|
||||
|
||||
kern_return_t hm_IOKIT_SMCOpen (void *hashcat_ctx, io_connect_t *conn)
|
||||
@ -68,7 +68,7 @@ kern_return_t hm_IOKIT_SMCOpen (void *hashcat_ctx, io_connect_t *conn)
|
||||
return 1;
|
||||
}
|
||||
|
||||
result = IOServiceOpen (device, mach_task_self(), 0, conn);
|
||||
result = IOServiceOpen (device, mach_task_self (), 0, conn);
|
||||
|
||||
IOObjectRelease (device);
|
||||
|
||||
@ -124,7 +124,7 @@ kern_return_t hm_IOKIT_SMCReadKey (UInt32Char_t key, SMCVal_t *val, io_connect_t
|
||||
|
||||
if (hm_IOKIT_SMCCall (KERNEL_INDEX_SMC, &inData, &outData, conn) != kIOReturnSuccess) return 1;
|
||||
|
||||
memcpy(val->bytes, outData.bytes, sizeof(outData.bytes));
|
||||
memcpy (val->bytes, outData.bytes, sizeof (outData.bytes));
|
||||
|
||||
return kIOReturnSuccess;
|
||||
}
|
||||
@ -145,9 +145,9 @@ int hm_IOKIT_SMCGetSensorGraphicHot (void *hashcat_ctx)
|
||||
|
||||
if (val.dataSize > 0)
|
||||
{
|
||||
if (strcmp(val.dataType, DATATYPE_UINT8) == 0)
|
||||
if (strcmp (val.dataType, DATATYPE_UINT8) == 0)
|
||||
{
|
||||
alarm = hm_IOKIT_strtoul ((char *)val.bytes, val.dataSize, 10);
|
||||
alarm = hm_IOKIT_strtoul ((char *) val.bytes, val.dataSize, 10);
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ int hm_IOKIT_SMCGetTemperature (void *hashcat_ctx, char *key, double *temp)
|
||||
{
|
||||
if (val.dataSize > 0)
|
||||
{
|
||||
if (strcmp(val.dataType, DATATYPE_SP78) == 0)
|
||||
if (strcmp (val.dataType, DATATYPE_SP78) == 0)
|
||||
{
|
||||
// convert sp78 value to temperature
|
||||
int intValue = val.bytes[0] * 256 + (unsigned char)val.bytes[1];
|
||||
@ -200,17 +200,17 @@ bool hm_IOKIT_SMCGetFanRPM (char *key, io_connect_t conn, float *ret)
|
||||
{
|
||||
if (val.dataSize > 0)
|
||||
{
|
||||
if (strcmp(val.dataType, DATATYPE_FLT) == 0)
|
||||
if (strcmp (val.dataType, DATATYPE_FLT) == 0)
|
||||
{
|
||||
*ret = *(float *) val.bytes;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcmp(val.dataType, DATATYPE_FPE2) == 0)
|
||||
if (strcmp (val.dataType, DATATYPE_FPE2) == 0)
|
||||
{
|
||||
// convert fpe2 value to RPM
|
||||
*ret = ntohs (*(UInt16*)val.bytes) / 4.0;
|
||||
*ret = ntohs (*(UInt16*) val.bytes) / 4.0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ static bool iokit_getGPUCore (void *hashcat_ctx, int *gpu_core)
|
||||
|
||||
// "gpu-core-count" is present only on Apple Silicon
|
||||
|
||||
CFNumberRef num = IORegistryEntryCreateCFProperty(service, CFSTR("gpu-core-count"), kCFAllocatorDefault, 0);
|
||||
CFNumberRef num = IORegistryEntryCreateCFProperty (service, CFSTR ("gpu-core-count"), kCFAllocatorDefault, 0);
|
||||
|
||||
int gc = 0;
|
||||
|
||||
@ -216,7 +216,7 @@ int mtl_init (void *hashcat_ctx)
|
||||
|
||||
mtl->devices = nil;
|
||||
|
||||
if (MTLCreateSystemDefaultDevice() == nil)
|
||||
if (MTLCreateSystemDefaultDevice () == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Metal is not supported on this computer");
|
||||
|
||||
@ -262,7 +262,7 @@ int hc_mtlDeviceGetCount (void *hashcat_ctx, int *count)
|
||||
|
||||
if (mtl == nil) return -1;
|
||||
|
||||
CFArrayRef devices = (CFArrayRef) MTLCopyAllDevices();
|
||||
CFArrayRef devices = (CFArrayRef) MTLCopyAllDevices ();
|
||||
|
||||
if (devices == nil)
|
||||
{
|
||||
@ -395,7 +395,7 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
|
||||
case MTL_DEVICE_ATTRIBUTE_UNIFIED_MEMORY:
|
||||
*pi = 0;
|
||||
|
||||
SEL hasUnifiedMemorySelector = NSSelectorFromString(@"hasUnifiedMemory");
|
||||
SEL hasUnifiedMemorySelector = NSSelectorFromString (@"hasUnifiedMemory");
|
||||
|
||||
hc_mtlInvocationHelper (metal_device, hasUnifiedMemorySelector, &valBool);
|
||||
|
||||
@ -467,7 +467,7 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
|
||||
case MTL_DEVICE_ATTRIBUTE_MAX_TRANSFER_RATE:
|
||||
val64 = 0;
|
||||
|
||||
SEL maxTransferRateSelector = NSSelectorFromString(@"maxTransferRate");
|
||||
SEL maxTransferRateSelector = NSSelectorFromString (@"maxTransferRate");
|
||||
|
||||
hc_mtlInvocationHelper (metal_device, maxTransferRateSelector, &val64);
|
||||
|
||||
@ -497,7 +497,7 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
|
||||
case MTL_DEVICE_ATTRIBUTE_PHYSICAL_LOCATION:
|
||||
*pi = 0;
|
||||
|
||||
SEL locationSelector = NSSelectorFromString(@"location");
|
||||
SEL locationSelector = NSSelectorFromString (@"location");
|
||||
valULong = 0;
|
||||
|
||||
hc_mtlInvocationHelper (metal_device, locationSelector, &valULong);
|
||||
@ -509,7 +509,7 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
|
||||
case MTL_DEVICE_ATTRIBUTE_LOCATION_NUMBER:
|
||||
*pi = 0;
|
||||
|
||||
SEL locationNumberSelector = NSSelectorFromString(@"locationNumber");
|
||||
SEL locationNumberSelector = NSSelectorFromString (@"locationNumber");
|
||||
|
||||
valULong = 0;
|
||||
hc_mtlInvocationHelper (metal_device, locationNumberSelector, &valULong);
|
||||
@ -538,7 +538,7 @@ int hc_mtlMemGetInfo (void *hashcat_ctx, size_t *mem_free, size_t *mem_total)
|
||||
vm_size_t page_size = 0;
|
||||
unsigned int count = HOST_VM_INFO64_COUNT;
|
||||
|
||||
mach_port_t port = mach_host_self();
|
||||
mach_port_t port = mach_host_self ();
|
||||
|
||||
if (host_page_size (port, &page_size) != KERN_SUCCESS)
|
||||
{
|
||||
@ -580,7 +580,7 @@ int hc_mtlDeviceMaxMemAlloc (void *hashcat_ctx, size_t *bytes, mtl_device_id met
|
||||
|
||||
uint64_t memsize = 0;
|
||||
|
||||
SEL maxBufferLengthSelector = NSSelectorFromString(@"maxBufferLength");
|
||||
SEL maxBufferLengthSelector = NSSelectorFromString (@"maxBufferLength");
|
||||
|
||||
if (hc_mtlInvocationHelper (metal_device, maxBufferLengthSelector, &memsize) == -1) return -1;
|
||||
|
||||
@ -1094,7 +1094,7 @@ int hc_mtlMemcpyDtoH (void *hashcat_ctx, mtl_command_queue command_queue, void *
|
||||
|
||||
int hc_mtlRuntimeGetVersionString (void *hashcat_ctx, char *runtimeVersion_str, size_t *size)
|
||||
{
|
||||
CFURLRef plist_url = CFURLCreateWithFileSystemPath (kCFAllocatorDefault, CFSTR("/System/Library/Frameworks/Metal.framework/Versions/Current/Resources/version.plist"), kCFURLPOSIXPathStyle, false);
|
||||
CFURLRef plist_url = CFURLCreateWithFileSystemPath (kCFAllocatorDefault, CFSTR ("/System/Library/Frameworks/Metal.framework/Versions/Current/Resources/version.plist"), kCFURLPOSIXPathStyle, false);
|
||||
|
||||
if (plist_url == NULL)
|
||||
{
|
||||
@ -1137,7 +1137,7 @@ int hc_mtlRuntimeGetVersionString (void *hashcat_ctx, char *runtimeVersion_str,
|
||||
return -1;
|
||||
}
|
||||
|
||||
CFStringRef runtime_version_str = CFRetain (CFDictionaryGetValue (plist_prop, CFSTR("CFBundleVersion")));
|
||||
CFStringRef runtime_version_str = CFRetain (CFDictionaryGetValue (plist_prop, CFSTR ("CFBundleVersion")));
|
||||
|
||||
if (runtime_version_str != NULL)
|
||||
{
|
||||
@ -1290,8 +1290,8 @@ int hc_mtlEncodeComputeCommand (void *hashcat_ctx, mtl_command_encoder metal_com
|
||||
CFTimeInterval myGPUStartTime = 0;
|
||||
CFTimeInterval myGPUEndTime = 0;
|
||||
|
||||
SEL myGPUStartTimeSelector = NSSelectorFromString(@"GPUStartTime");
|
||||
SEL myGPUEndTimeSelector = NSSelectorFromString(@"GPUEndTime");
|
||||
SEL myGPUStartTimeSelector = NSSelectorFromString (@"GPUStartTime");
|
||||
SEL myGPUEndTimeSelector = NSSelectorFromString (@"GPUEndTime");
|
||||
|
||||
if (hc_mtlInvocationHelper (metal_command_buffer, myGPUStartTimeSelector, &myGPUStartTime) == -1) return -1;
|
||||
if (hc_mtlInvocationHelper (metal_command_buffer, myGPUEndTimeSelector, &myGPUEndTime) == -1) return -1;
|
||||
@ -1355,7 +1355,7 @@ int hc_mtlCreateLibraryWithSource (void *hashcat_ctx, mtl_device_id metal_device
|
||||
|
||||
if (build_options_buf != nil)
|
||||
{
|
||||
//printf("using build_opts from arg:\n%s\n", build_options_buf);
|
||||
//printf ("using build_opts from arg:\n%s\n", build_options_buf);
|
||||
|
||||
build_options_dict = [NSMutableDictionary dictionary]; //[[NSMutableDictionary alloc] init];
|
||||
|
||||
|
@ -126,7 +126,7 @@ bool hc_fopen (HCFILE *fp, const char *path, const char *mode)
|
||||
{
|
||||
if (check[0] == 0x1f && check[1] == 0x8b && check[2] == 0x08) is_gzip = true;
|
||||
if (check[0] == 0x50 && check[1] == 0x4b && check[2] == 0x03 && check[3] == 0x04) is_zip = true;
|
||||
if (memcmp(check, XZ_SIG, XZ_SIG_SIZE) == 0) is_xz = true;
|
||||
if (memcmp (check, XZ_SIG, XZ_SIG_SIZE) == 0) is_xz = true;
|
||||
|
||||
// compressed files with BOM will be undetected!
|
||||
|
||||
|
@ -67,7 +67,7 @@ static int get_exec_path (char *exec_path, const size_t exec_path_sz)
|
||||
|
||||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_PROC_ARGS;
|
||||
mib[2] = getpid();
|
||||
mib[2] = getpid ();
|
||||
mib[3] = KERN_PROC_PATHNAME;
|
||||
|
||||
size_t size = exec_path_sz;
|
||||
|
@ -246,7 +246,7 @@ int hm_get_temperature_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b
|
||||
|
||||
char *key = HM_IOKIT_SMC_CPU_PROXIMITY;
|
||||
|
||||
if (hm_IOKIT_SMCGetTemperature(hashcat_ctx, key, &temperature) == -1)
|
||||
if (hm_IOKIT_SMCGetTemperature (hashcat_ctx, key, &temperature) == -1)
|
||||
{
|
||||
hwmon_ctx->hm_device[backend_device_idx].temperature_get_supported = false;
|
||||
|
||||
|
@ -30,7 +30,7 @@ int _dowildcard = -1;
|
||||
|
||||
static void main_log_clear_line (MAYBE_UNUSED const size_t prev_len, MAYBE_UNUSED FILE *fp)
|
||||
{
|
||||
if (!is_stdout_terminal()) return;
|
||||
if (!is_stdout_terminal ()) return;
|
||||
|
||||
#if defined (_WIN)
|
||||
|
||||
@ -81,7 +81,8 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, FILE *fp, const int loglevel)
|
||||
#endif
|
||||
|
||||
// color stuff pre
|
||||
if (is_stdout_terminal()) {
|
||||
if (is_stdout_terminal ())
|
||||
{
|
||||
#if defined (_WIN)
|
||||
switch (loglevel)
|
||||
{
|
||||
@ -111,7 +112,8 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, FILE *fp, const int loglevel)
|
||||
fwrite (msg_buf, msg_len, 1, fp);
|
||||
|
||||
// color stuff post
|
||||
if (is_stdout_terminal()) {
|
||||
if (is_stdout_terminal ())
|
||||
{
|
||||
#if defined (_WIN)
|
||||
switch (loglevel)
|
||||
{
|
||||
|
@ -315,7 +315,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
// convert back SID
|
||||
|
||||
SID_tmp = (u8 *) hcmalloc ((SID_len + 1) * sizeof(u8));
|
||||
SID_tmp = (u8 *) hcmalloc ((SID_len + 1) * sizeof (u8));
|
||||
|
||||
for (u32 i = 0; i < (SID_len / 4); i++)
|
||||
{
|
||||
|
@ -160,7 +160,7 @@ static int check_huffman (const unsigned char *next)
|
||||
{
|
||||
zero_count += 2;
|
||||
|
||||
while (zero_count-- > 0 && i < sizeof(bit_length) / sizeof (bit_length[0]))
|
||||
while (zero_count-- > 0 && i < sizeof (bit_length) / sizeof (bit_length[0]))
|
||||
{
|
||||
bit_length[i++] = 0;
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
pdf->P = P;
|
||||
|
||||
memcpy ( pdf->u_pass_buf, u_pass_buf_pos, 32);
|
||||
pdf->u_pass_len = strlen((char *) pdf->u_pass_buf);
|
||||
pdf->u_pass_len = strlen ((char *) pdf->u_pass_buf);
|
||||
|
||||
pdf->enc_md = enc_md;
|
||||
|
||||
@ -496,7 +496,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
|
||||
pdf_t *pdf = (pdf_t *) hashes->esalts_buf;
|
||||
|
||||
// if the password in tmp->out is equal to the padding, then we recovered just the owner-password
|
||||
if(pdf_tmp->out[0]==padding[0] && pdf_tmp->out[1]==padding[1] && pdf_tmp->out[2]==padding[2] && pdf_tmp->out[3]==padding[3])
|
||||
|
||||
if (pdf_tmp->out[0] == padding[0] &&
|
||||
pdf_tmp->out[1] == padding[1] &&
|
||||
pdf_tmp->out[2] == padding[2] &&
|
||||
pdf_tmp->out[3] == padding[3])
|
||||
{
|
||||
return snprintf ((char *) dst_buf, dst_sz, "%s (user password not set)", (char *) src_buf);
|
||||
}
|
||||
@ -511,14 +515,15 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
|
||||
const u8 *u8OutPadPtr;
|
||||
u8OutPadPtr = (u8*) u32OutPadPtr;
|
||||
|
||||
bool remove_padding=false;
|
||||
int i_padding=0;
|
||||
for(int i=0;i<16;i++)
|
||||
bool remove_padding = false;
|
||||
int i_padding = 0;
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
if(u8OutBufPtr[i]==u8OutPadPtr[i_padding] || remove_padding)
|
||||
if (u8OutBufPtr[i] == u8OutPadPtr[i_padding] || remove_padding)
|
||||
{
|
||||
u8OutBufPtr[i]=0x0;
|
||||
remove_padding=true;
|
||||
u8OutBufPtr[i] = 0x0;
|
||||
remove_padding = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -527,9 +532,13 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
|
||||
// TODO would be better to actually also verify the u-value whether we've retrieved the correct user-password,
|
||||
// however, we'd need to include a lot of code/complexity here to do so (or call into 10500 kernel).
|
||||
// this seems relevant: run_kernel (hashcat_ctx, device_param, KERN_RUN_3, 0, 1, false, 0)
|
||||
if(pdf_tmp->out[0]==src_buf[0] && pdf_tmp->out[1]==src_buf[1] && pdf_tmp->out[2]==src_buf[2] && pdf_tmp->out[3]==src_buf[3])
|
||||
|
||||
if (pdf_tmp->out[0] == src_buf[0] &&
|
||||
pdf_tmp->out[1] == src_buf[1] &&
|
||||
pdf_tmp->out[2] == src_buf[2] &&
|
||||
pdf_tmp->out[3] == src_buf[3])
|
||||
{
|
||||
if(pdf->u_pass_len==0)
|
||||
if (pdf->u_pass_len == 0)
|
||||
{
|
||||
// we seem to only have recovered the user-password as we don't have one yet
|
||||
return snprintf ((char *) dst_buf, dst_sz, "(user password=%s)", (char *) src_buf);
|
||||
|
@ -65,7 +65,7 @@ static const char *SIGNATURE_DEVICE_AUTHENTICATION_CODE = "$knx-ip-secure-device
|
||||
static const char *SALT_DEVICE_AUTHENTICATION_CODE = "device-authentication-code.1.secure.ip.knx.org";
|
||||
static const int ROUNDS_DEVICE_AUTHENTICATION_CODE = 65536;
|
||||
|
||||
char *module_jit_build_options(MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param)
|
||||
char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param)
|
||||
{
|
||||
char *jit_build_options = NULL;
|
||||
|
||||
@ -78,7 +78,7 @@ char *module_jit_build_options(MAYBE_UNUSED const hashconfig_t *hashconfig, MAYB
|
||||
// NVIDIA GPU
|
||||
if (device_param->opencl_device_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
hc_asprintf(&jit_build_options, "-D _unroll");
|
||||
hc_asprintf (&jit_build_options, "-D _unroll");
|
||||
}
|
||||
|
||||
// HIP
|
||||
@ -90,7 +90,7 @@ char *module_jit_build_options(MAYBE_UNUSED const hashconfig_t *hashconfig, MAYB
|
||||
// ROCM
|
||||
if ((device_param->opencl_device_vendor_id == VENDOR_ID_AMD) && (device_param->has_vperm == true))
|
||||
{
|
||||
hc_asprintf(&jit_build_options, "-D _unroll");
|
||||
hc_asprintf (&jit_build_options, "-D _unroll");
|
||||
}
|
||||
|
||||
return jit_build_options;
|
||||
@ -204,7 +204,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
public_value_xor[3],
|
||||
public_value_xor[4],
|
||||
public_value_xor[5] };
|
||||
memcpy (blocks->b1, b1, sizeof(b1));
|
||||
memcpy (blocks->b1, b1, sizeof (b1));
|
||||
|
||||
memcpy (blocks->b2, &public_value_xor[6], 16);
|
||||
|
||||
@ -213,7 +213,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
memcpy (blocks->b3, &public_value_xor[22], 10);
|
||||
|
||||
// The salt used in the derivation of the device authentication code is constant
|
||||
size_t salt_len = strlen(SALT_DEVICE_AUTHENTICATION_CODE); // exclude the null byte
|
||||
size_t salt_len = strlen (SALT_DEVICE_AUTHENTICATION_CODE); // exclude the null byte
|
||||
memcpy (salt->salt_buf, SALT_DEVICE_AUTHENTICATION_CODE, salt_len);
|
||||
salt->salt_len = salt_len;
|
||||
salt->salt_iter = ROUNDS_DEVICE_AUTHENTICATION_CODE - 1;
|
||||
@ -238,8 +238,8 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
memcpy (&public_value_xor[ 6], &(blocks->b2[0]), 16);
|
||||
memcpy (&public_value_xor[22], &(blocks->b3[0]), 10);
|
||||
|
||||
hex_encode(secure_session_identifier, 2, secure_session_identifier_hex);
|
||||
hex_encode(public_value_xor, 32, public_value_xor_hex);
|
||||
hex_encode (secure_session_identifier, 2, secure_session_identifier_hex);
|
||||
hex_encode (public_value_xor, 32, public_value_xor_hex);
|
||||
|
||||
const int line_len = snprintf (line_buf, line_size, "%s*%s*%s*%08x%08x%08x%08x",
|
||||
SIGNATURE_DEVICE_AUTHENTICATION_CODE,
|
||||
|
@ -81,20 +81,20 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY
|
||||
// NVIDIA GPU
|
||||
if (device_param->opencl_device_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
hc_asprintf(&jit_build_options, "-D _unroll");
|
||||
hc_asprintf (&jit_build_options, "-D _unroll");
|
||||
}
|
||||
|
||||
// HIP
|
||||
if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD_USE_HIP)
|
||||
{
|
||||
hc_asprintf(&jit_build_options, "-D _unroll");
|
||||
hc_asprintf (&jit_build_options, "-D _unroll");
|
||||
}
|
||||
|
||||
// ROCM
|
||||
if ((device_param->opencl_device_vendor_id == VENDOR_ID_AMD) &&
|
||||
(device_param->has_vperm == true))
|
||||
{
|
||||
hc_asprintf(&jit_build_options, "-D _unroll");
|
||||
hc_asprintf (&jit_build_options, "-D _unroll");
|
||||
}
|
||||
|
||||
return jit_build_options;
|
||||
@ -191,22 +191,22 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
memcpy (postgres_sha256->salt, tmp_buf, tmp_len);
|
||||
|
||||
postgres_sha256->salt[ 0] = byte_swap_32(postgres_sha256->salt[ 0]);
|
||||
postgres_sha256->salt[ 1] = byte_swap_32(postgres_sha256->salt[ 1]);
|
||||
postgres_sha256->salt[ 2] = byte_swap_32(postgres_sha256->salt[ 2]);
|
||||
postgres_sha256->salt[ 3] = byte_swap_32(postgres_sha256->salt[ 3]);
|
||||
postgres_sha256->salt[ 4] = byte_swap_32(postgres_sha256->salt[ 4]);
|
||||
postgres_sha256->salt[ 5] = byte_swap_32(postgres_sha256->salt[ 5]);
|
||||
postgres_sha256->salt[ 6] = byte_swap_32(postgres_sha256->salt[ 6]);
|
||||
postgres_sha256->salt[ 7] = byte_swap_32(postgres_sha256->salt[ 7]);
|
||||
postgres_sha256->salt[ 8] = byte_swap_32(postgres_sha256->salt[ 8]);
|
||||
postgres_sha256->salt[ 9] = byte_swap_32(postgres_sha256->salt[ 9]);
|
||||
postgres_sha256->salt[10] = byte_swap_32(postgres_sha256->salt[10]);
|
||||
postgres_sha256->salt[11] = byte_swap_32(postgres_sha256->salt[11]);
|
||||
postgres_sha256->salt[12] = byte_swap_32(postgres_sha256->salt[12]);
|
||||
postgres_sha256->salt[13] = byte_swap_32(postgres_sha256->salt[13]);
|
||||
postgres_sha256->salt[14] = byte_swap_32(postgres_sha256->salt[14]);
|
||||
postgres_sha256->salt[15] = byte_swap_32(postgres_sha256->salt[15]);
|
||||
postgres_sha256->salt[ 0] = byte_swap_32 (postgres_sha256->salt[ 0]);
|
||||
postgres_sha256->salt[ 1] = byte_swap_32 (postgres_sha256->salt[ 1]);
|
||||
postgres_sha256->salt[ 2] = byte_swap_32 (postgres_sha256->salt[ 2]);
|
||||
postgres_sha256->salt[ 3] = byte_swap_32 (postgres_sha256->salt[ 3]);
|
||||
postgres_sha256->salt[ 4] = byte_swap_32 (postgres_sha256->salt[ 4]);
|
||||
postgres_sha256->salt[ 5] = byte_swap_32 (postgres_sha256->salt[ 5]);
|
||||
postgres_sha256->salt[ 6] = byte_swap_32 (postgres_sha256->salt[ 6]);
|
||||
postgres_sha256->salt[ 7] = byte_swap_32 (postgres_sha256->salt[ 7]);
|
||||
postgres_sha256->salt[ 8] = byte_swap_32 (postgres_sha256->salt[ 8]);
|
||||
postgres_sha256->salt[ 9] = byte_swap_32 (postgres_sha256->salt[ 9]);
|
||||
postgres_sha256->salt[10] = byte_swap_32 (postgres_sha256->salt[10]);
|
||||
postgres_sha256->salt[11] = byte_swap_32 (postgres_sha256->salt[11]);
|
||||
postgres_sha256->salt[12] = byte_swap_32 (postgres_sha256->salt[12]);
|
||||
postgres_sha256->salt[13] = byte_swap_32 (postgres_sha256->salt[13]);
|
||||
postgres_sha256->salt[14] = byte_swap_32 (postgres_sha256->salt[14]);
|
||||
postgres_sha256->salt[15] = byte_swap_32 (postgres_sha256->salt[15]);
|
||||
|
||||
postgres_sha256->salt_len = tmp_len;
|
||||
salt->salt_len = tmp_len;
|
||||
@ -245,7 +245,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
const u8 *hash_pos = token.buf[4];
|
||||
const int hash_len = token.len[4];
|
||||
|
||||
memset (tmp_buf, 0, sizeof(tmp_buf));
|
||||
memset (tmp_buf, 0, sizeof (tmp_buf));
|
||||
|
||||
tmp_len = base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf);
|
||||
|
||||
|
113
src/terminal.c
113
src/terminal.c
@ -477,7 +477,7 @@ int tty_getchar ()
|
||||
if (retval == 0) return 0;
|
||||
if (retval == -1) return -1;
|
||||
|
||||
return getchar();
|
||||
return getchar ();
|
||||
}
|
||||
|
||||
int tty_fix ()
|
||||
@ -526,7 +526,7 @@ int tty_getchar ()
|
||||
if (retval == 0) return 0;
|
||||
if (retval == -1) return -1;
|
||||
|
||||
return getchar();
|
||||
return getchar ();
|
||||
}
|
||||
|
||||
int tty_fix ()
|
||||
@ -600,12 +600,12 @@ int tty_fix ()
|
||||
}
|
||||
#endif
|
||||
|
||||
bool is_stdout_terminal(void)
|
||||
bool is_stdout_terminal (void)
|
||||
{
|
||||
#if defined(_WIN)
|
||||
return _isatty(_fileno(stdout));
|
||||
return _isatty(_fileno (stdout));
|
||||
#else
|
||||
return isatty(fileno(stdout));
|
||||
return isatty (fileno (stdout));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -652,22 +652,22 @@ void hash_info_single_json (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *us
|
||||
{
|
||||
u32 t = hashconfig->salt_type;
|
||||
const char *t_desc = (t == SALT_TYPE_EMBEDDED) ? "embedded" : (t == SALT_TYPE_GENERIC) ? "generic" : "virtual";
|
||||
printf("\"salt_type\": \"%s\", ", t_desc);
|
||||
printf("\"salt_len_min\": %u, ", hashconfig->salt_min);
|
||||
printf("\"salt_len_max\": %u, ", hashconfig->salt_max);
|
||||
printf ("\"salt_type\": \"%s\", ", t_desc);
|
||||
printf ("\"salt_len_min\": %u, ", hashconfig->salt_min);
|
||||
printf ("\"salt_len_max\": %u, ", hashconfig->salt_max);
|
||||
}
|
||||
|
||||
if ((hashconfig->has_pure_kernel) && (hashconfig->has_optimized_kernel))
|
||||
{
|
||||
printf("\"kernel_type\": %s, ", "[ \"pure\", \"optimized\" ]");
|
||||
printf ("\"kernel_type\": %s, ", "[ \"pure\", \"optimized\" ]");
|
||||
}
|
||||
else if (hashconfig->has_pure_kernel)
|
||||
{
|
||||
printf("\"kernel_type\": %s, ", "[ \"pure\" ]");
|
||||
printf ("\"kernel_type\": %s, ", "[ \"pure\" ]");
|
||||
}
|
||||
else if (hashconfig->has_optimized_kernel)
|
||||
{
|
||||
printf("\"kernel_type\": %s, ", "[ \"optimized\" ]");
|
||||
printf ("\"kernel_type\": %s, ", "[ \"optimized\" ]");
|
||||
}
|
||||
|
||||
if ((hashconfig->st_hash != NULL) && (hashconfig->st_pass != NULL))
|
||||
@ -676,18 +676,18 @@ void hash_info_single_json (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *us
|
||||
{
|
||||
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE_OPTIONAL)
|
||||
{
|
||||
printf("\"example_hash_format\": \"%s\", ", "hex-encoded");
|
||||
printf ("\"example_hash_format\": \"%s\", ", "hex-encoded");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\"example_hash_format\": \"%s\", ", "hex-encoded (binary file only)");
|
||||
printf ("\"example_hash_format\": \"%s\", ", "hex-encoded (binary file only)");
|
||||
}
|
||||
printf("\"example_hash\": \"%s\", ", hashconfig->st_hash);
|
||||
printf ("\"example_hash\": \"%s\", ", hashconfig->st_hash);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\"example_hash_format\": \"%s\", ", "plain");
|
||||
printf("\"example_hash\": \"%s\", ", hashconfig->st_hash);
|
||||
printf ("\"example_hash_format\": \"%s\", ", "plain");
|
||||
printf ("\"example_hash\": \"%s\", ", hashconfig->st_hash);
|
||||
}
|
||||
|
||||
if (need_hexify ((const u8 *) hashconfig->st_pass, strlen (hashconfig->st_pass), user_options_extra->separator, false))
|
||||
@ -709,7 +709,7 @@ void hash_info_single_json (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *us
|
||||
tmp_buf[tmp_len++] = ']';
|
||||
tmp_buf[tmp_len++] = 0;
|
||||
|
||||
printf("\"example_pass\": \"%s\", ", tmp_buf);
|
||||
printf ("\"example_pass\": \"%s\", ", tmp_buf);
|
||||
|
||||
hcfree (tmp_buf);
|
||||
}
|
||||
@ -723,46 +723,46 @@ void hash_info_single_json (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *us
|
||||
|
||||
uppercase ((u8 *) tmp_buf, st_pass_len);
|
||||
|
||||
printf("\"example_pass\": \"%s\", ", tmp_buf);
|
||||
printf ("\"example_pass\": \"%s\", ", tmp_buf);
|
||||
|
||||
hcfree (tmp_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\"example_pass\": \"%s\", ", hashconfig->st_pass);
|
||||
printf ("\"example_pass\": \"%s\", ", hashconfig->st_pass);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\"example_hash_format\": \"%s\", ", "N/A");
|
||||
printf("\"example_hash\": \"%s\", ", "N/A");
|
||||
printf("\"example_pass\": \"%s\", ", "N/A");
|
||||
printf ("\"example_hash_format\": \"%s\", ", "N/A");
|
||||
printf ("\"example_hash\": \"%s\", ", "N/A");
|
||||
printf ("\"example_pass\": \"%s\", ", "N/A");
|
||||
}
|
||||
|
||||
if (hashconfig->benchmark_mask != NULL)
|
||||
{
|
||||
printf("\"benchmark_mask\": \"%s\", ", hashconfig->benchmark_mask);
|
||||
printf ("\"benchmark_mask\": \"%s\", ", hashconfig->benchmark_mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\"benchmark_mask\": \"%s\", ", "N/A");
|
||||
printf ("\"benchmark_mask\": \"%s\", ", "N/A");
|
||||
}
|
||||
|
||||
printf("\"autodetect_enabled\": %s, ", (hashconfig->opts_type & OPTS_TYPE_AUTODETECT_DISABLE) ? "false" : "true");
|
||||
printf("\"self_test_enabled\": %s, ", (hashconfig->opts_type & OPTS_TYPE_SELF_TEST_DISABLE) ? "false" : "true");
|
||||
printf("\"potfile_enabled\": %s, ", (hashconfig->opts_type & OPTS_TYPE_POTFILE_NOPASS) ? "false" : "true");
|
||||
printf ("\"autodetect_enabled\": %s, ", (hashconfig->opts_type & OPTS_TYPE_AUTODETECT_DISABLE) ? "false" : "true");
|
||||
printf ("\"self_test_enabled\": %s, ", (hashconfig->opts_type & OPTS_TYPE_SELF_TEST_DISABLE) ? "false" : "true");
|
||||
printf ("\"potfile_enabled\": %s, ", (hashconfig->opts_type & OPTS_TYPE_POTFILE_NOPASS) ? "false" : "true");
|
||||
|
||||
if (hashconfig->opts_type & OPTS_TYPE_PT_ALWAYS_ASCII)
|
||||
{
|
||||
printf("\"plaintext_encoding\": %s", "[ \"ASCII\" ]");
|
||||
printf ("\"plaintext_encoding\": %s", "[ \"ASCII\" ]");
|
||||
}
|
||||
else if (hashconfig->opts_type & OPTS_TYPE_PT_ALWAYS_HEXIFY)
|
||||
{
|
||||
printf("\"plaintext_encoding\": %s", "[ \"HEX\" ]");
|
||||
printf ("\"plaintext_encoding\": %s", "[ \"HEX\" ]");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\"plaintext_encoding\": %s", "[ \"ASCII\", \"HEX\" ]");
|
||||
printf ("\"plaintext_encoding\": %s", "[ \"ASCII\", \"HEX\" ]");
|
||||
}
|
||||
|
||||
event_log_info (hashcat_ctx, NULL);
|
||||
@ -922,30 +922,29 @@ void hash_info (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (user_options->machine_readable == false)
|
||||
{
|
||||
event_log_info(hashcat_ctx, "Hash Info:");
|
||||
event_log_info(hashcat_ctx, "==========");
|
||||
event_log_info(hashcat_ctx, NULL);
|
||||
event_log_info (hashcat_ctx, "Hash Info:");
|
||||
event_log_info (hashcat_ctx, "==========");
|
||||
event_log_info (hashcat_ctx, NULL);
|
||||
}
|
||||
|
||||
if (user_options->hash_mode_chgd == true)
|
||||
{
|
||||
if (user_options->machine_readable == true)
|
||||
{
|
||||
printf("{ ");
|
||||
hash_info_single_json(hashcat_ctx, user_options_extra);
|
||||
printf(" }");
|
||||
printf ("{ ");
|
||||
hash_info_single_json (hashcat_ctx, user_options_extra);
|
||||
printf (" }");
|
||||
}
|
||||
else
|
||||
{
|
||||
hash_info_single(hashcat_ctx, user_options_extra);
|
||||
hash_info_single (hashcat_ctx, user_options_extra);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||
|
||||
if (user_options->machine_readable == true)
|
||||
printf("{ ");
|
||||
if (user_options->machine_readable == true) printf ("{ ");
|
||||
|
||||
for (int i = 0; i < MODULE_HASH_MODES_MAXIMUM; i++)
|
||||
{
|
||||
@ -959,19 +958,18 @@ void hash_info (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
printf(", ");
|
||||
printf (", ");
|
||||
}
|
||||
|
||||
hash_info_single_json(hashcat_ctx, user_options_extra);
|
||||
hash_info_single_json (hashcat_ctx, user_options_extra);
|
||||
}
|
||||
else
|
||||
{
|
||||
hash_info_single(hashcat_ctx, user_options_extra);
|
||||
hash_info_single (hashcat_ctx, user_options_extra);
|
||||
}
|
||||
}
|
||||
|
||||
if (user_options->machine_readable == true)
|
||||
printf(" }");
|
||||
if (user_options->machine_readable == true) printf (" }");
|
||||
|
||||
hcfree (modulefile);
|
||||
}
|
||||
@ -1723,14 +1721,14 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
|
||||
hcfree (hashcat_status);
|
||||
}
|
||||
|
||||
void json_encode(char *text, char *escaped)
|
||||
void json_encode (char *text, char *escaped)
|
||||
{
|
||||
/*
|
||||
* Based on https://www.freeformatter.com/json-escape.html, below these 7 different chars
|
||||
* are getting escaped before being printed.
|
||||
*/
|
||||
|
||||
size_t len = strlen(text);
|
||||
size_t len = strlen (text);
|
||||
unsigned long i, j;
|
||||
|
||||
for (i = 0, j = 0; i < len; i++, j++)
|
||||
@ -1789,17 +1787,28 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
|
||||
printf ("{ \"session\": \"%s\",", hashcat_status->session);
|
||||
printf (" \"guess\": {");
|
||||
if (hashcat_status->guess_base)
|
||||
{
|
||||
printf (" \"guess_base\": \"%s\",", hashcat_status->guess_base);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf (" \"guess_base\": null,");
|
||||
}
|
||||
|
||||
printf (" \"guess_base_count\": %u,", hashcat_status->guess_base_count);
|
||||
printf (" \"guess_base_offset\": %u,", hashcat_status->guess_base_offset);
|
||||
printf (" \"guess_base_percent\": %.02f,", hashcat_status->guess_base_percent);
|
||||
printf (" \"guess_mask_length\": %u,", hashcat_status->guess_mask_length);
|
||||
|
||||
if (hashcat_status->guess_mod)
|
||||
{
|
||||
printf (" \"guess_mod\": \"%s\",", hashcat_status->guess_mod);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf (" \"guess_mod\": null,");
|
||||
}
|
||||
|
||||
printf (" \"guess_mod_count\": %u,", hashcat_status->guess_mod_count);
|
||||
printf (" \"guess_mod_offset\": %u,", hashcat_status->guess_mod_offset);
|
||||
printf (" \"guess_mod_percent\": %.02f,", hashcat_status->guess_mod_percent);
|
||||
@ -1812,7 +1821,7 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
|
||||
* some salts can contain chars which need to be escaped to not break the JSON encoding.
|
||||
*/
|
||||
char *target_json_encoded = (char *) hcmalloc (strlen (hashcat_status->hash_target) * 2);
|
||||
json_encode(hashcat_status->hash_target, target_json_encoded);
|
||||
json_encode (hashcat_status->hash_target, target_json_encoded);
|
||||
printf (" \"target\": \"%s\",", target_json_encoded);
|
||||
hcfree (target_json_encoded);
|
||||
|
||||
@ -1839,14 +1848,14 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
printf (" { \"device_id\": %u,", device_id + 1);
|
||||
|
||||
char *device_name_json_encoded = (char *)hcmalloc(strlen(device_info->device_name) * 2);
|
||||
json_encode(device_info->device_name, device_name_json_encoded);
|
||||
printf(" \"device_name\": \"%s\",", device_name_json_encoded);
|
||||
hcfree(device_name_json_encoded);
|
||||
char *device_name_json_encoded = (char *) hcmalloc (strlen (device_info->device_name) * 2);
|
||||
json_encode (device_info->device_name, device_name_json_encoded);
|
||||
printf (" \"device_name\": \"%s\",", device_name_json_encoded);
|
||||
hcfree (device_name_json_encoded);
|
||||
|
||||
const char *device_type_desc = ((device_info->device_type & CL_DEVICE_TYPE_CPU) ? "CPU" :
|
||||
((device_info->device_type & CL_DEVICE_TYPE_GPU) ? "GPU" : "Accelerator"));
|
||||
printf(" \"device_type\": \"%s\",", device_type_desc);
|
||||
printf (" \"device_type\": \"%s\",", device_type_desc);
|
||||
|
||||
printf (" \"speed\": %" PRIu64 ",", (u64) (device_info->hashes_msec_dev * 1000));
|
||||
|
||||
|
@ -291,7 +291,7 @@ void usage_mini_print (const char *progname)
|
||||
printf ("\n");
|
||||
printf ("Press any key to exit\n");
|
||||
|
||||
getch();
|
||||
getch ();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -613,8 +613,9 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
if ((user_options->separator[0] == '0') && (user_options->separator[1] == 'x'))
|
||||
{
|
||||
if (is_valid_hex_string((u8 * )(&(user_options->separator[2])),2)){
|
||||
u8 sep = hex_to_u8((u8 * )(&(user_options->separator[2])));
|
||||
if (is_valid_hex_string ((u8 * ) (&(user_options->separator[2])), 2))
|
||||
{
|
||||
u8 sep = hex_to_u8 ((u8 * ) (&(user_options->separator[2])));
|
||||
user_options->separator[0] = sep;
|
||||
user_options->separator[1] = 0;
|
||||
}
|
||||
@ -627,7 +628,9 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
if (error){
|
||||
|
||||
if (error)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Separator length has to be exactly 1 byte (single char or hex format e.g. 0x09 for TAB)");
|
||||
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user