Skip to content

Commit

Permalink
FIX: fix issue where hashes that are in binary format do not get thei… (
Browse files Browse the repository at this point in the history
#1108)

* fix: fix issue where hashes that are in binary format do not get their cracked plaintext returned through the api
  • Loading branch information
yungcero authored Nov 5, 2024
1 parent 087bd05 commit 6875527
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/inc/utils/HashlistUtils.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1130,20 +1130,23 @@ public static function getCrackedHashes($hashlistId, $user) {
if (!AccessUtils::userCanAccessHashlists($lists, $user)) {
throw new HTException("No access to the hashlists!");
}

$hashlistIds = Util::arrayOfIds($lists);
$qF1 = new ContainFilter(Hash::HASHLIST_ID, $hashlistIds);
$qF2 = new QueryFilter(Hash::IS_CRACKED, 1, "=");
$hashes = [];
$entries = Factory::getHashFactory()->filter([Factory::FILTER => [$qF1, $qF2]]);
$isBinary = $hashlist->getFormat() != 0;
$factory = $isBinary ? Factory::getHashBinaryFactory() : Factory::getHashFactory();
$entries = $factory->filter([Factory::FILTER => [$qF1, $qF2]]);
foreach ($entries as $entry) {
$arr = [
"hash" => $entry->getHash(),
"plain" => $entry->getPlaintext(),
"crackpos" => $entry->getCrackPos()
];
if (strlen($entry->getSalt()) > 0) {
$arr["hash"] .= $hashlist->getSaltSeparator() . $entry->getSalt();
if ($hashlist->getIsSalted()) {
if (strlen($entry->getSalt()) > 0) {
$arr["hash"] .= $hashlist->getSaltSeparator() . $entry->getSalt();
}
}
$hashes[] = $arr;
}
Expand Down

0 comments on commit 6875527

Please sign in to comment.