1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 07:08:19 +00:00

use XDG_DATA_HOME for profile_dir

This commit is contained in:
nycex 2020-06-16 20:05:29 +02:00
parent 918a621506
commit 8d78815767
No known key found for this signature in database
GPG Key ID: EE6FBE8D3E7278A5
2 changed files with 10 additions and 1 deletions

View File

@ -31,7 +31,7 @@ The install target is linux FHS compatible and can be used like this:
$ make install
```
If you install it, cached kernels, session files, restore- and pot-files etc. will go to $HOME/.hashcat/
If you install it, cached kernels, session files, restore- and pot-files etc. will go to either $HOME/.hashcat/, if that already exists, otherwise to $XDG_DATA_HOME/hashcat/ or ~/.local/share/hashcat/, if that environment variable is not set.
### Building hashcat for Windows (using Windows Subsystem for Linux) ###

View File

@ -93,6 +93,15 @@ static void get_install_dir (char *install_dir, const char *exec_path)
static void get_profile_dir (char *profile_dir, const char *home_dir)
{
snprintf (profile_dir, HCBUFSIZ_TINY, "%s/%s", home_dir, DOT_HASHCAT);
struct stat st = {0};
if (stat(profile_dir, &st) == 0 && S_ISDIR(st.st_mode))
return;
if (getenv("XDG_DATA_HOME")) {
snprintf(profile_dir, HCBUFSIZ_TINY, "%s/hashcat", getenv("XDG_DATA_HOME"));
} else {
snprintf(profile_dir, HCBUFSIZ_TINY, "%s/.local/share/hashcat", home_dir);
}
}
static void get_session_dir (char *session_dir, const char *profile_dir)