mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-15 20:39:17 +00:00
Support for FIFO outfiles (fixes #3582)
This commit is contained in:
parent
6ee2658104
commit
c2fcef6c50
@ -116,28 +116,32 @@ bool hc_fopen (HCFILE *fp, const char *path, const char *mode)
|
||||
bool is_gzip = false;
|
||||
bool is_zip = false;
|
||||
bool is_xz = false;
|
||||
bool is_fifo = hc_path_is_fifo (path);
|
||||
|
||||
int fd_tmp = open (path, O_RDONLY);
|
||||
|
||||
if (fd_tmp != -1)
|
||||
if (is_fifo == false)
|
||||
{
|
||||
lseek (fd_tmp, 0, SEEK_SET);
|
||||
int fd_tmp = open (path, O_RDONLY);
|
||||
|
||||
if (read (fd_tmp, check, sizeof (check)) > 0)
|
||||
if (fd_tmp != -1)
|
||||
{
|
||||
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;
|
||||
lseek (fd_tmp, 0, SEEK_SET);
|
||||
|
||||
// compressed files with BOM will be undetected!
|
||||
|
||||
if (is_gzip == false && is_zip == false && is_xz == false)
|
||||
if (read (fd_tmp, check, sizeof (check)) > 0)
|
||||
{
|
||||
fp->bom_size = hc_string_bom_size (check);
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
close (fd_tmp);
|
||||
// compressed files with BOM will be undetected!
|
||||
|
||||
if (is_gzip == false && is_zip == false && is_xz == false)
|
||||
{
|
||||
fp->bom_size = hc_string_bom_size (check);
|
||||
}
|
||||
}
|
||||
|
||||
close (fd_tmp);
|
||||
}
|
||||
}
|
||||
|
||||
if (fmode == -1)
|
||||
|
@ -699,6 +699,11 @@ bool hc_same_files (char *file1, char *file2)
|
||||
{
|
||||
if ((file1 != NULL) && (file2 != NULL))
|
||||
{
|
||||
if (hc_path_is_fifo (file1) == true || hc_path_is_fifo (file2) == true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
struct stat tmpstat_file1;
|
||||
struct stat tmpstat_file2;
|
||||
|
||||
|
@ -2731,13 +2731,6 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
if (hc_path_exist (outfile_ctx->filename) == true)
|
||||
{
|
||||
if (hc_path_is_fifo (outfile_ctx->filename) == true)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: A fifo cannot be used as an outfile.", outfile_ctx->filename);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hc_path_is_directory (outfile_ctx->filename) == true)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: A directory cannot be used as an outfile.", outfile_ctx->filename);
|
||||
|
Loading…
Reference in New Issue
Block a user