Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/inc/utils/HashlistUtils.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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]);
Expand All @@ -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;
}
Expand Down Expand Up @@ -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]);
Expand All @@ -1109,12 +1112,13 @@ public static function leftlist($hashlistId, $user) {
}
$buffer .= "\n";
}
$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);
return Factory::getFileFactory()->save($file);
}

Expand Down