From 32e01895a5fcf15da9658407a7e04065ecf5be4b Mon Sep 17 00:00:00 2001 From: s3inlc Date: Mon, 6 Oct 2025 17:02:46 +0200 Subject: [PATCH 1/2] filetypes and counts are inserted on exported files --- src/inc/utils/HashlistUtils.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/inc/utils/HashlistUtils.class.php b/src/inc/utils/HashlistUtils.class.php index 04601a6b8..377ca7770 100644 --- a/src/inc/utils/HashlistUtils.class.php +++ b/src/inc/utils/HashlistUtils.class.php @@ -213,7 +213,7 @@ public static function createWordlists($hashlistId, $user) { fclose($wordlistFile); //add file to files list - $file = new File(null, $wordlistName, Util::filesize($wordlistFilename), $hashlist->getIsSecret(), 0, $hashlist->getAccessGroupId(), $wordCount); + $file = new File(null, $wordlistName, Util::filesize($wordlistFilename), $hashlist->getIsSecret(), DFileType::WORDLIST, $hashlist->getAccessGroupId(), $wordCount); $file = Factory::getFileFactory()->save($file); # TODO: returning wordCount and wordlistName are not really required here as the name and the count are already given in the file object return [$wordCount, $wordlistName, $file]; @@ -711,6 +711,7 @@ public static function export($hashlistId, $user) { $pagingSize = SConfig::getInstance()->getVal(DConfig::HASHES_PAGE_SIZE); } $separator = SConfig::getInstance()->getVal(DConfig::FIELD_SEPARATOR); + $numEntries = 0; for ($x = 0; $x * $pagingSize < $count; $x++) { $oF = new OrderFilter($orderObject, "ASC LIMIT " . ($x * $pagingSize) . ",$pagingSize"); $entries = $factory->filter([Factory::FILTER => [$qF1, $qF2], Factory::ORDER => $oF]); @@ -733,12 +734,13 @@ public static function export($hashlistId, $user) { break; } } + $numEntries += sizeof($entries); fputs($file, $buffer); } fclose($file); usleep(1000000); - $file = new File(null, $tmpname, Util::filesize($tmpfile), $hashlist->getIsSecret(), 0, $hashlist->getAccessGroupId(), null); + $file = new File(null, $tmpname, Util::filesize($tmpfile), $hashlist->getIsSecret(), DFileType::OTHER, $hashlist->getAccessGroupId(), $numEntries); $file = Factory::getFileFactory()->save($file); return $file; } @@ -1098,6 +1100,7 @@ public static function leftlist($hashlistId, $user) { if (SConfig::getInstance()->getVal(DConfig::HASHES_PAGE_SIZE) !== false) { $pagingSize = SConfig::getInstance()->getVal(DConfig::HASHES_PAGE_SIZE); } + $numEntries = 0; for ($x = 0; $x * $pagingSize < $count; $x++) { $oF = new OrderFilter(Hash::HASH_ID, "ASC LIMIT " . ($x * $pagingSize) . ",$pagingSize"); $entries = Factory::getHashFactory()->filter([Factory::FILTER => [$qF1, $qF2], Factory::ORDER => $oF]); @@ -1109,12 +1112,13 @@ public static function leftlist($hashlistId, $user) { } $buffer .= "\n"; } + $numEntries += sizeof($numEntries); fputs($file, $buffer); } fclose($file); usleep(1000000); - $file = new File(null, $tmpname, Util::filesize($tmpfile), $hashlist->getIsSecret(), 0, $hashlist->getAccessGroupId(), null); + $file = new File(null, $tmpname, Util::filesize($tmpfile), $hashlist->getIsSecret(), DFileType::OTHER, $hashlist->getAccessGroupId(), $numEntries); return Factory::getFileFactory()->save($file); } From 68d4cc5ab09a7a20c51f4a99ea4ee507d5b0e030 Mon Sep 17 00:00:00 2001 From: s3inlc Date: Mon, 6 Oct 2025 17:14:05 +0200 Subject: [PATCH 2/2] fixed typo in counting --- src/inc/utils/HashlistUtils.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inc/utils/HashlistUtils.class.php b/src/inc/utils/HashlistUtils.class.php index 377ca7770..e2dece3c2 100644 --- a/src/inc/utils/HashlistUtils.class.php +++ b/src/inc/utils/HashlistUtils.class.php @@ -1112,7 +1112,7 @@ public static function leftlist($hashlistId, $user) { } $buffer .= "\n"; } - $numEntries += sizeof($numEntries); + $numEntries += sizeof($entries); fputs($file, $buffer); } fclose($file);