Startup Checks: Improved the pidfile check: Do not just check for existing PID but also check executable filename

pull/2056/head
Jens Steube 5 years ago
parent f689532e4c
commit 68e39c2e47

@ -56,6 +56,7 @@
## Improvements
##
- Startup Checks: Improved the pidfile check: Do not just check for existing PID but also check executable filename
- Cracking bcrypt and Password Safe v2: Use a feedback from the OpenCL runtime to dynamically find out optimal thread count
- Bitcoin Wallet: Be more user friendly by allowing a larger data range for ckey and public_key
- Building: Updated BUILD.md

@ -72,17 +72,46 @@ static int check_running_process (hashcat_ctx_t *hashcat_ctx)
char *pidbin;
hc_asprintf (&pidbin, "/proc/%u/cmdline", pd->pid);
hc_asprintf (&pidbin, "/proc/%u/exe", pd->pid);
if (hc_path_exist (pidbin) == true)
{
event_log_error (hashcat_ctx, "Already an instance running on pid %u", pd->pid);
// pid info
char *pidexe = (char *) hcmalloc (HCBUFSIZ_TINY);
const ssize_t pidexe_len = readlink (pidbin, pidexe, HCBUFSIZ_TINY - 1);
pidexe[pidexe_len] = 0;
// self info
char *selfexe = (char *) hcmalloc (HCBUFSIZ_TINY);
const ssize_t selfexe_len = readlink ("/proc/self/exe", selfexe, HCBUFSIZ_TINY - 1);
selfexe[selfexe_len] = 0;
// compare
const int r = strncmp (pidexe, selfexe, selfexe_len);
if (r == 0)
{
event_log_error (hashcat_ctx, "Already an instance '%s' running on pid %u", pidexe, pd->pid);
}
hcfree (selfexe);
hcfree (pidexe);
hcfree (pd);
hcfree (pidbin);
return -1;
if (r == 0) return -1;
return 0;
}
hcfree (pidbin);

Loading…
Cancel
Save