1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

apply suggested changes

This commit is contained in:
nycex 2021-06-05 20:41:24 +02:00
parent 470e844e5d
commit 954b7d0a4d
No known key found for this signature in database
GPG Key ID: EE6FBE8D3E7278A5
2 changed files with 43 additions and 29 deletions

View File

@ -31,7 +31,35 @@ The install target is linux FHS compatible and can be used like this:
$ make install
```
If you install it, cached kernels will go to either $HOME/.hashcat/, if that already exists, otherwise to $XDG_CACHE_HOME/hashcat/ or ~/.cache/hashcat/, if that environment variable is not set. 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.
If the $HOME/.hashcat folder exists, then:
- Session related files go to: $HOME/.hashcat/sessions/
- Cached kernels go to: $HOME/.hashcat/kernels/
- Potfiles go to: $HOME/.hashcat/
Otherwise, if environment variable XDG_DATA_HOME and XDG_CACHE_HOME exists, then:
- Session related files go to: $XDG_DATA_HOME/hashcat/sessions/
- Cached kernels go to: $XDG_CACHE_HOME/hashcat/kernels/
- Potfiles go to: $XDG_DATA_HOME/hashcat/
Otherwise, if environment variable XDG_DATA_HOME exists, then:
- Session related files go to: $XDG_DATA_HOME/hashcat/sessions/
- Cached kernels go to: $HOME/.cache/hashcat
- Potfiles go to: $XDG_DATA_HOME/hashcat/
Otherwise, if environment variable XDG_CACHE_HOME exists, then:
- Session related files go to: $HOME/.local/share/hashcat/sessions/
- Cached kernels go to: $XDG_CACHE_HOME/hashcat/kernels/
- Potfiles go to: $HOME/.local/share/hashcat/
Otherwise:
- Session related files go to: $HOME/.local/share/hashcat/sessions/
- Cached kernels go to: $HOME/.cache/hashcat
- Potfiles go to: $HOME/.local/share/hashcat/
### Building hashcat for Windows (using Windows Subsystem for Linux) ###

View File

@ -93,51 +93,37 @@ 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;
char *data_dir = (char *) hcmalloc (HCBUFSIZ_TINY);
if (getenv ("XDG_DATA_HOME"))
if (hc_path_is_directory (profile_dir)) return;
char *xdg_data_home = getenv ("XDG_DATA_HOME");
if (xdg_data_home)
{
strncpy (data_dir, getenv ("XDG_DATA_HOME"), HCBUFSIZ_TINY);
snprintf (profile_dir, HCBUFSIZ_TINY, "%s/hashcat", xdg_data_home);
}
else
{
snprintf (data_dir, HCBUFSIZ_TINY, "%s/.local/share", home_dir);
snprintf (profile_dir, HCBUFSIZ_TINY, "%s/.local/share/hashcat", home_dir);
}
if (access (data_dir, R_OK) != -1)
{
snprintf (profile_dir, HCBUFSIZ_TINY, "%s/hashcat", data_dir);
}
hcfree (data_dir);
}
static void get_cache_dir (char *cache_dir, const char *home_dir)
{
snprintf (cache_dir, HCBUFSIZ_TINY, "%s/%s", home_dir, DOT_HASHCAT);
struct stat st = {0};
if (stat (cache_dir, &st) == 0 && S_ISDIR (st.st_mode))
return;
char *xdg_cache_dir = (char *) hcmalloc (HCBUFSIZ_TINY);
if (getenv ("XDG_CACHE_HOME"))
if (hc_path_is_directory (cache_dir)) return;
char *xdg_cache_home = getenv ("XDG_CACHE_HOME");
if (xdg_cache_home)
{
strncpy (xdg_cache_dir, getenv ("XDG_CACHE_HOME"), HCBUFSIZ_TINY);
snprintf (cache_dir, HCBUFSIZ_TINY, "%s/hashcat", xdg_cache_home);
}
else
{
snprintf (xdg_cache_dir, HCBUFSIZ_TINY, "%s/.cache", home_dir);
snprintf (cache_dir, HCBUFSIZ_TINY, "%s/.cache/hashcat", home_dir);
}
if (access (xdg_cache_dir, R_OK) != -1)
{
snprintf (cache_dir, HCBUFSIZ_TINY, "%s/hashcat", xdg_cache_dir);
}
hcfree (xdg_cache_dir);
}
static void get_session_dir (char *session_dir, const char *profile_dir)