コード例 #1
0
function makeHashFiles($class, $data)
{
    $MD4 = new MD4();
    $NTLMOUT = "";
    $MD5OUT = "";
    $DMD5OUT = "";
    $MD4OUT = "";
    $SHA1OUT = "";
    $DUPMD5OUT = "";
    $DUPNTLMOUT = "";
    $LMOUT = "";
    $SHA256OUT = "";
    for ($i = 0; $i < count($data); $i++) {
        if (strlen($data[$i]) == 0) {
            continue;
        }
        $MD5OUT .= strtoupper(md5($data[$i])) . "\n";
        $DMD5OUT .= strtoupper(md5(md5($data[$i]))) . "\n";
        $DUPMD5OUT .= strtoupper(md5($data[$i] . $data[$i])) . "\n";
        $MD4OUT .= strtoupper($MD4->Calc($data[$i])) . "\n";
        $SHA1OUT .= strtoupper(sha1($data[$i])) . "\n";
        $ntlmString = "";
        for ($j = 0; $j < strlen($data[$i]); $j++) {
            $ntlmString .= $data[$i][$j] . chr(0);
        }
        $NTLMOUT .= strtoupper($MD4->Calc($ntlmString)) . "\n";
        $DUPNTLMOUT .= strtoupper($MD4->Calc($ntlmString . $ntlmString)) . "\n";
        $LMOUT .= LMhash($data[$i]) . "\n";
        $SHA256OUT .= hash('sha256', $data[$i]) . "\n";
    }
    file_put_contents("Hashes-MD4-{$class}.txt", $MD4OUT);
    file_put_contents("Hashes-MD5-{$class}.txt", $MD5OUT);
    file_put_contents("Hashes-DMD5-{$class}.txt", $DMD5OUT);
    file_put_contents("Hashes-DupMD5-{$class}.txt", $DUPMD5OUT);
    file_put_contents("Hashes-SHA1-{$class}.txt", $SHA1OUT);
    file_put_contents("Hashes-NTLM-{$class}.txt", $NTLMOUT);
    file_put_contents("Hashes-DupNTLM-{$class}.txt", $DUPNTLMOUT);
    file_put_contents("Hashes-LM-{$class}.txt", $LMOUT);
    file_put_contents("Hashes-SHA256-{$class}.txt", $SHA256OUT);
}
コード例 #2
0
function generateNTLMTestWordlistHashes($numPasswords, $passLength, $charset, $prefix) {
    $MD4 = new MD4;
    // Generate one password for every password up to passLength.
    $wordlistContents = "";
    $hashlistContents = "";
    
    $lengthCharset = "1234567890";
    
    for ($pl = 0; $pl < $passLength; $pl++) {
        $passString = "";
        // No null padding, for the wordlist file.
        $passStringWordlist = "";
        for ($length = 0; $length < $pl; $length++) {
            //$newCharacter = $charset[rand(0, strlen($charset) - 1)];
            $newCharacter = $lengthCharset[$length % 10];
            $passString .= $newCharacter . chr(0);
            $passStringWordlist .= $newCharacter;
        }
        $wordlistContents .= $passStringWordlist . "\n";
        $hashlistContents .= $MD4->Calc($passString) . "\n";
    }
    
    // Now, generate random passwords until the specified number.
    
    for ($password = 0; $password < $numPasswords; $password++) {
        $tempPassLen = rand(0, $passLength);
        $passString = "";
        $passStringWordlist = "";
        for ($length = 0; $length < $tempPassLen; $length++) {
            $newCharacter = $charset[rand(0, strlen($charset) - 1)];
            $passString .= $newCharacter . chr(0);
            $passStringWordlist .= $newCharacter;
        }
        $wordlistContents .= $passStringWordlist . "\n";
        $hashlistContents .= $MD4->Calc($passString) . "\n";
    }
    file_put_contents($prefix . ".pass", $wordlistContents);
    file_put_contents($prefix . ".hash", $hashlistContents);
}