From: Martin Westergaard Date: Sat, 30 Oct 2010 13:47:58 +0000 (+0200) Subject: rcracki_mt fixed for RTI2 usage. X-Git-Url: https://git.sesse.net/?p=freerainbowtables;a=commitdiff_plain;h=4e8aa96cd91b811f5f058736a89b16018161daeb rcracki_mt fixed for RTI2 usage. --- diff --git a/Client Applications/rcracki_mt/BaseRTReader.cpp b/Client Applications/rcracki_mt/BaseRTReader.cpp deleted file mode 100644 index 9b797ec..0000000 --- a/Client Applications/rcracki_mt/BaseRTReader.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * rcracki_mt is a multithreaded implementation and fork of the original - * RainbowCrack - * - * Copyright 2010 Martin Westergaard Jørgensen - * Copyright 2010 Daniël Niggebrugge - * Copyright 2010 James Nobis - * - * This file is part of rcracki_mt. - * - * rcracki_mt is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * rcracki_mt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with rcracki_mt. If not, see . - */ - -#include "BaseRTReader.h" diff --git a/Client Applications/rcracki_mt/BaseRTReader.h b/Client Applications/rcracki_mt/BaseRTReader.h deleted file mode 100644 index 17a93ac..0000000 --- a/Client Applications/rcracki_mt/BaseRTReader.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * rcracki_mt is a multithreaded implementation and fork of the original - * RainbowCrack - * - * Copyright 2010 Martin Westergaard Jørgensen - * Copyright 2010 Daniël Niggebrugge - * Copyright 2010 James Nobis - * - * This file is part of rcracki_mt. - * - * rcracki_mt is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * rcracki_mt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with rcracki_mt. If not, see . - */ - -#ifndef __BASERTREADER_H__ -#define __BASERTREADER_H__ - -#include "Public.h" -#include - -#if defined(_WIN32) && !defined(__GNUC__) - #include -#endif - -using namespace std; - -class BaseRTReader -{ -public: - virtual int ReadChains(unsigned int &numChains, RainbowChainO *pData) = 0; - virtual unsigned int GetChainsLeft() = 0; - -}; - -#endif diff --git a/Client Applications/rcracki_mt/HashAlgorithm.cpp b/Client Applications/rcracki_mt/HashAlgorithm.cpp deleted file mode 100644 index db22aeb..0000000 --- a/Client Applications/rcracki_mt/HashAlgorithm.cpp +++ /dev/null @@ -1,428 +0,0 @@ -/* - * rcracki_mt is a multithreaded implementation and fork of the original - * RainbowCrack - * - * Copyright (C) Zhu Shuanglei - * Copyright Martin Westergaard Jørgensen - * Copyright 2009, 2010 Daniël Niggebrugge - * Copyright 2009, 2010 James Nobis - * - * This file is part of rcracki_mt. - * - * rcracki_mt is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * rcracki_mt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with rcracki_mt. If not, see . - * - * Changes: not using OpenSSL routines the slow way anymore, as suggested by jci. - */ - -#include "HashAlgorithm.h" - -#include "Public.h" - -#include -//#include -#include -#include -//#include -#include "fast_md5.h" -#include "md4.h" -//#include "sha1.h" -#if defined(_WIN32) && !defined(__GNUC__) - #pragma comment(lib, "libeay32.lib") -#endif - -#ifdef __NetBSD__ - #include -#endif - -#define MSCACHE_HASH_SIZE 16 -void setup_des_key(unsigned char key_56[], des_key_schedule &ks) -{ - des_cblock key; - - key[0] = key_56[0]; - key[1] = (key_56[0] << 7) | (key_56[1] >> 1); - key[2] = (key_56[1] << 6) | (key_56[2] >> 2); - key[3] = (key_56[2] << 5) | (key_56[3] >> 3); - key[4] = (key_56[3] << 4) | (key_56[4] >> 4); - key[5] = (key_56[4] << 3) | (key_56[5] >> 5); - key[6] = (key_56[5] << 2) | (key_56[6] >> 6); - key[7] = (key_56[6] << 1); - - //des_set_odd_parity(&key); - des_set_key(&key, ks); -} - -void HashLM(unsigned char* pPlain, int nPlainLen, unsigned char* pHash) -{ - /* - unsigned char data[7] = {0}; - memcpy(data, pPlain, nPlainLen > 7 ? 7 : nPlainLen); - */ - - int i; - for (i = nPlainLen; i < 7; i++) - pPlain[i] = 0; - - static unsigned char magic[] = {0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25}; - des_key_schedule ks; - //setup_des_key(data, ks); - setup_des_key(pPlain, ks); - des_ecb_encrypt((des_cblock*)magic, (des_cblock*)pHash, ks, DES_ENCRYPT); -} - -void HashLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash) -{ - unsigned char pass[14]; - unsigned char pre_lmresp[21]; - static unsigned char magic[] = {0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25}; - static unsigned char spoofed_challange[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}; - des_key_schedule ks; - - memset (pass,0,sizeof(pass)); - memset (pre_lmresp,0,sizeof(pre_lmresp)); - - memcpy (pass,pPlain, nPlainLen); - - setup_des_key(pass, ks); - des_ecb_encrypt((des_cblock*)magic, (des_cblock*)pre_lmresp, ks, DES_ENCRYPT); - - setup_des_key(&pass[7], ks); - des_ecb_encrypt((des_cblock*)magic, (des_cblock*)&pre_lmresp[8], ks, DES_ENCRYPT); - - setup_des_key(pre_lmresp, ks); - des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)pHash, ks, DES_ENCRYPT); - - setup_des_key(&pre_lmresp[7], ks); - des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)&pHash[8], ks, DES_ENCRYPT); - - setup_des_key(&pre_lmresp[14], ks); - des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)&pHash[16], ks, DES_ENCRYPT); - -} - -void HashHALFLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash) -{ - unsigned char pre_lmresp[8]; - static unsigned char magic[] = {0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25}; - static unsigned char salt[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}; - - des_key_schedule ks; - unsigned char plain[8] = {0}; - memcpy(plain, pPlain, nPlainLen); - setup_des_key(plain, ks); - des_ecb_encrypt((des_cblock*)magic, (des_cblock*)pre_lmresp, ks, DES_ENCRYPT); - - setup_des_key(pre_lmresp, ks); - des_ecb_encrypt((des_cblock*)salt, (des_cblock*)pHash, ks, DES_ENCRYPT); -} - - - -void HashNTLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash) -{ - unsigned char UnicodePlain[MAX_PLAIN_LEN]; - static unsigned char spoofed_challange[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}; - - int len = (nPlainLen < 127) ? nPlainLen : 127; - int i; - - for (i = 0; i < len; i++) - { - UnicodePlain[i * 2] = pPlain[i]; - UnicodePlain[i * 2 + 1] = 0x00; - } - - des_key_schedule ks; - unsigned char lm[21]; - - /*MD4_CTX ctx; - MD4_Init(&ctx); - MD4_Update(&ctx, UnicodePlain, len * 2); - MD4_Final(lm, &ctx); */ - MD4_NEW(UnicodePlain, len * 2, lm); - - //MD4(UnicodePlain, len * 2, lm); - lm[16] = lm[17] = lm[18] = lm[19] = lm[20] = 0; - - setup_des_key(lm, ks); - des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)pHash, ks, DES_ENCRYPT); - - setup_des_key(&lm[7], ks); - des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)&pHash[8], ks, DES_ENCRYPT); - - setup_des_key(&lm[14], ks); - des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)&pHash[16], ks, DES_ENCRYPT); -} - -void HashORACLE(unsigned char* pPlain, int nPlainLen, unsigned char* pHash) -{ - char ToEncrypt[256]; - char temp[256]; - char username[256]; - - DES_cblock iv,iv2; - DES_key_schedule ks1,ks2; - unsigned char deskey_fixed[]={ 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}; - int i,j; -#if defined(_WIN32) && !defined(__GNUC__) - strcpy_s(username, sizeof(username), "SYS"); -#else - strcpy(username, "SYS"); -#endif - int userlen = 3; -#if defined(_WIN32) && !defined(__GNUC__) - _strupr((char*) pPlain); -#else - strupr((char*) pPlain); -#endif - memset (ToEncrypt,0,sizeof(ToEncrypt)); - - for (i=1,j=0; j ascii - 64 */ - "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - -void _crypt_to64(char *s, unsigned long v, int n) -{ - while (--n >= 0) { - *s++ = itoa64[v&0x3f]; - v >>= 6; - } -} - -void HashPIX(unsigned char* pPlain, int nPlainLen, unsigned char* pHash) -{ - char temp[MD5_DIGEST_LENGTH+1]; - unsigned char final[MD5_DIGEST_LENGTH]; - char* pass = (char*) calloc (nPlainLen+MD5_DIGEST_LENGTH,sizeof(char)); - - memcpy (pass,pPlain,nPlainLen); - - /*MD5_CTX ctx; - MD5_Init(&ctx); - MD5_Update(&ctx, (unsigned char *) pass, MD5_DIGEST_LENGTH); - MD5_Final(final, &ctx);*/ - fast_MD5((unsigned char *) pass, MD5_DIGEST_LENGTH, final); - - char* p = (char*) temp; - _crypt_to64(p,*(unsigned long*) (final+0),4); p += 4; - _crypt_to64(p,*(unsigned long*) (final+4),4); p += 4; - _crypt_to64(p,*(unsigned long*) (final+8),4); p += 4; - _crypt_to64(p,*(unsigned long*) (final+12),4); p += 4; - *p=0; - - memcpy(pHash,temp,MD5_DIGEST_LENGTH); - - free (pass); -} - -#if !defined(_WIN32) || defined(__GNUC__) -char *strupr(char *s1) -{ - char *p = s1; - while(*p) - { - *p = (char) toupper(*p); - p++; - } - return s1; -} -#endif diff --git a/Client Applications/rcracki_mt/HashAlgorithm.h b/Client Applications/rcracki_mt/HashAlgorithm.h deleted file mode 100644 index 401784f..0000000 --- a/Client Applications/rcracki_mt/HashAlgorithm.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * rcracki_mt is a multithreaded implementation and fork of the original - * RainbowCrack - * - * Copyright (C) Zhu Shuanglei - * Copyright Martin Westergaard Jørgensen - * Copyright 2009, 2010 Daniël Niggebrugge - * Copyright 2009, 2010 James Nobis - * - * This file is part of rcracki_mt. - * - * rcracki_mt is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * rcracki_mt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with rcracki_mt. If not, see . - */ - -#ifndef _HASHALGORITHM_H -#define _HASHALGORITHM_H - -void HashLM(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); -void HashNTLM(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); -//void HashMD2(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); -void HashMD4(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); -void HashMD5(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); -void HashDoubleMD5(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); -void HashSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); -//void HashRIPEMD160(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); -void HashMSCACHE(unsigned char *pPlain, int nPlainLen, unsigned char* pHash); - -//**************************************************************************** -// MySQL Password Hashing -//**************************************************************************** - -void HashMySQL323(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); -void HashMySQLSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); - -//**************************************************************************** -// Cisco PIX Password Hashing -//**************************************************************************** - -void HashPIX(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); - -//**************************************************************************** -// (HALF) LM CHALL hashing -void HashLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); -void HashHALFLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); - -// From mao -void HashNTLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); -void HashORACLE(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); - -#if !defined(_WIN32) || defined(__GNUC__) -char *strupr(char *s1); -#endif -#endif diff --git a/Client Applications/rcracki_mt/HashRoutine.cpp b/Client Applications/rcracki_mt/HashRoutine.cpp deleted file mode 100644 index 595f13d..0000000 --- a/Client Applications/rcracki_mt/HashRoutine.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * rcracki_mt is a multithreaded implementation and fork of the original - * RainbowCrack - * - * Copyright (C) Zhu Shuanglei - * Copyright Martin Westergaard Jørgensen - * Copyright 2009, 2010 Daniël Niggebrugge - * Copyright 2009, 2010 James Nobis - * - * This file is part of rcracki_mt. - * - * rcracki_mt is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * rcracki_mt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with rcracki_mt. If not, see . - */ - -#if defined(_WIN32) && !defined(__GNUC__) - #pragma warning(disable : 4786 4267 4018) -#endif - -#include "HashRoutine.h" -#include "HashAlgorithm.h" - -////////////////////////////////////////////////////////////////////// - -CHashRoutine::CHashRoutine() -{ - // Notice: MIN_HASH_LEN <= nHashLen <= MAX_HASH_LEN - - - AddHashRoutine("lm", HashLM, 8); - AddHashRoutine("ntlm", HashNTLM, 16); -// AddHashRoutine("md2", HashMD2, 16); - AddHashRoutine("md4", HashMD4, 16); - AddHashRoutine("md5", HashMD5, 16); - AddHashRoutine("doublemd5", HashDoubleMD5, 16); - AddHashRoutine("sha1", HashSHA1, 20); -// AddHashRoutine("ripemd160", HashRIPEMD160, 20); - AddHashRoutine("mysql323", HashMySQL323, 8); - AddHashRoutine("mysqlsha1", HashMySQLSHA1, 20); - AddHashRoutine("ciscopix", HashPIX, 16); - AddHashRoutine("mscache", HashMSCACHE, 16); - AddHashRoutine("halflmchall", HashHALFLMCHALL, 8); - - // Added from mao - AddHashRoutine("lmchall", HashLMCHALL, 24); - AddHashRoutine("ntlmchall", HashNTLMCHALL, 24); - AddHashRoutine("oracle", HashORACLE, 8); -} - -CHashRoutine::~CHashRoutine() -{ -} - -void CHashRoutine::AddHashRoutine(string sHashRoutineName, HASHROUTINE pHashRoutine, int nHashLen) -{ - vHashRoutineName.push_back(sHashRoutineName); - vHashRoutine.push_back(pHashRoutine); - vHashLen.push_back(nHashLen); -} - -string CHashRoutine::GetAllHashRoutineName() -{ - string sRet; - UINT4 i; - for (i = 0; i < vHashRoutineName.size(); i++) - sRet += vHashRoutineName[i] + " "; - - return sRet; -} - -void CHashRoutine::GetHashRoutine(string sHashRoutineName, HASHROUTINE& pHashRoutine, int& nHashLen) -{ - UINT4 i; - for (i = 0; i < vHashRoutineName.size(); i++) - { - if (sHashRoutineName == vHashRoutineName[i]) - { - pHashRoutine = vHashRoutine[i]; - nHashLen = vHashLen[i]; - return; - } - } - - pHashRoutine = NULL; - nHashLen = 0; -} diff --git a/Client Applications/rcracki_mt/HashRoutine.h b/Client Applications/rcracki_mt/HashRoutine.h deleted file mode 100644 index eaa10ce..0000000 --- a/Client Applications/rcracki_mt/HashRoutine.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * rcracki_mt is a multithreaded implementation and fork of the original - * RainbowCrack - * - * Copyright (C) Zhu Shuanglei - * Copyright Martin Westergaard Jørgensen - * Copyright 2009, 2010 Daniël Niggebrugge - * Copyright 2009, 2010 James Nobis - * - * This file is part of rcracki_mt. - * - * rcracki_mt is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * rcracki_mt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with rcracki_mt. If not, see . - */ - -#ifndef _HASHROUTINE_H -#define _HASHROUTINE_H - -#include -#include - -#include "global.h" - -using namespace std; - -typedef void (*HASHROUTINE)(unsigned char* pPlain, int nPlainLen, unsigned char* pHash); - -class CHashRoutine -{ -public: - CHashRoutine(); - virtual ~CHashRoutine(); - -private: - vector vHashRoutineName; - vector vHashRoutine; - vector vHashLen; - void AddHashRoutine(string sHashRoutineName, HASHROUTINE pHashRoutine, int nHashLen); - -public: - string GetAllHashRoutineName(); - void GetHashRoutine(string sHashRoutineName, HASHROUTINE& pHashRoutine, int& nHashLen); -}; - -#endif diff --git a/Client Applications/rcracki_mt/RTI2Reader.cpp b/Client Applications/rcracki_mt/RTI2Reader.cpp deleted file mode 100644 index 692c73e..0000000 --- a/Client Applications/rcracki_mt/RTI2Reader.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * rcracki_mt is a multithreaded implementation and fork of the original - * RainbowCrack - * - * Copyright 2010 Martin Westergaard Jørgensen - * Copyright 2010 Daniël Niggebrugge - * Copyright 2010 James Nobis - * - * This file is part of rcracki_mt. - * - * rcracki_mt is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * rcracki_mt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with rcracki_mt. If not, see . - */ - -#include "RTI2Reader.h" - -#include - -RTI2Header *RTI2Reader::m_pHeader = NULL; -RTI2Reader::RTI2Reader(string Filename) -{ - //m_pIndexPos = NULL, m_pChainPos = NULL;; - m_pIndex = NULL; - m_pFile = fopen(Filename.c_str(), "rb"); - if(m_pFile == NULL) - { - printf("Unable to open file %s", Filename.c_str()); - exit(1); - } - FILE *pFileIndex = fopen(Filename.append(".index").c_str(), "rb"); - if(pFileIndex == NULL) - { - printf("Unable to open file %s", Filename.append(".index").c_str()); - exit(1); - } - m_chainPosition = 0; - - unsigned int len = GetFileLen(pFileIndex); - fseek(pFileIndex, 0, SEEK_SET); - - m_pIndex = new unsigned char[len]; - if(fread(m_pIndex, 1, len, pFileIndex) != len) - { - printf("Error while reading index file"); - exit(1); - } - fclose(pFileIndex); - m_pHeader = new RTI2Header(); - memcpy(m_pHeader, m_pIndex, sizeof(RTI2Header)); - m_pHeader->m_cppos = (unsigned int*)(m_pIndex + 8); - m_pHeader->prefixstart = *(uint64*)(m_pIndex + 8 + (m_pHeader->rti_cplength * 4)); - m_chainsizebytes = (UINT4)ceil((float)(m_pHeader->rti_startptlength + m_pHeader->rti_endptlength + m_pHeader->rti_cplength) / 8); // Get the size of each chain in bytes - m_indexrowsizebytes = (UINT4)ceil((float)m_pHeader->rti_index_numchainslength / 8); - // Check the filesize - fseek(m_pFile, 0, SEEK_END); - len = ftell(m_pFile); - fseek(m_pFile, 0, SEEK_SET); - if(len % m_chainsizebytes > 0) - { - printf("Invalid filesize %u\n", len); - return; - } - - -} - -RTI2Reader::~RTI2Reader(void) -{ - if(m_pIndex != NULL) delete m_pIndex; - if(m_pFile != NULL) fclose(m_pFile); - -} - -unsigned int RTI2Reader::GetChainsLeft() -{ - int len = GetFileLen(m_pFile); - return len / m_chainsizebytes - m_chainPosition; -} - -int RTI2Reader::ReadChains(unsigned int &numChains, RainbowChainO *pData) -{ - if(strncmp(m_pHeader->header, "RTI2", 4) != 0) - { - numChains = 0; - return -1; - } - unsigned char *pNumChains = m_pIndex + (m_pHeader->rti_cplength * 4) + 16; // Pointer into the index containing info about how many numbers are in the first chain prefix - unsigned int i = 0; - unsigned int indexRow = 0; // Current offset into the index - unsigned int curRowPosition = 0; - - while(true) // Fast forward to current position - { - // ALERT: Possible problem here if m_indexrowsizebytes > 1 as pNumChains is a unsigned char. - unsigned int NumChainsInRow = (unsigned int)*(pNumChains + indexRow * m_indexrowsizebytes); - if(m_indexrowsizebytes > 1) - { - //XXX Have to find a solution to this problem - printf( "FATAL: m_indexrowsizebytes > 1: %d\n", m_indexrowsizebytes ); - exit(2); - } - if(i + NumChainsInRow > m_chainPosition) - { - curRowPosition = m_chainPosition - i; - break; // The current position is somewhere within this prefix - } - indexRow++; - i += NumChainsInRow; - } - - uint64 chainrow = 0; // Buffer to store a single read chain - unsigned int chainsProcessed = 0; // Number of chains processed - - // XXX: same problem with unsigned char here. - unsigned int NumChainsInRow = *(pNumChains + indexRow); - while(chainsProcessed < numChains && fread(&chainrow, 1, m_chainsizebytes, m_pFile) == m_chainsizebytes) - { - if(curRowPosition >= NumChainsInRow) - { // Skip to next index row position - indexRow++; - curRowPosition = 0; - NumChainsInRow = *(pNumChains + indexRow); - } - while(NumChainsInRow == 0) // We skip forward until we hit a index with > 0 chains - { - indexRow++; - NumChainsInRow = *(pNumChains + indexRow); - curRowPosition = 0; - } - // Load the starting point from the data - pData[chainsProcessed].nIndexS = chainrow << ( 64 - m_pHeader->rti_startptlength ); - pData[chainsProcessed].nIndexS = pData[chainsProcessed].nIndexS >> ( 64 - m_pHeader->rti_startptlength ); - - // Load the ending point prefix - pData[chainsProcessed].nIndexE = ( m_pHeader->prefixstart + indexRow ) << m_pHeader->rti_endptlength; - // Append the ending point suffix -#if defined(_WIN32) && !defined(__GNUC__) - pData[chainsProcessed].nIndexE |= (chainrow & (0xFFFFFFFFFFFFFFFFI64 >> m_pHeader->rti_cplength)) >> m_pHeader->rti_startptlength; -#else - pData[chainsProcessed].nIndexE |= (chainrow & (0xFFFFFFFFFFFFFFFFllu >> m_pHeader->rti_cplength)) >> m_pHeader->rti_startptlength; -#endif - //pData[chainsProcessed].nCheckPoint = (chainrow >> m_pHeader->rti_startptlength + m_pHeader->rti_endptlength); - curRowPosition++; - chainsProcessed++; - } - numChains = chainsProcessed; - m_chainPosition += numChains; - return 0; -} diff --git a/Client Applications/rcracki_mt/RTI2Reader.h b/Client Applications/rcracki_mt/RTI2Reader.h deleted file mode 100644 index cd36e7d..0000000 --- a/Client Applications/rcracki_mt/RTI2Reader.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * rcracki_mt is a multithreaded implementation and fork of the original - * RainbowCrack - * - * Copyright 2010 Martin Westergaard Jørgensen - * Copyright 2010 Daniël Niggebrugge - * Copyright 2010 James Nobis - * - * This file is part of rcracki_mt. - * - * rcracki_mt is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * rcracki_mt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with rcracki_mt. If not, see . - */ - -#ifndef __RTI2READER_H__ -#define __RTI2READER_H__ - -#include "Public.h" -#include - -#if defined(_WIN32) && !defined(__GNUC__) - #include -#endif - -#include -#include "BaseRTReader.h" - -using namespace std; - -typedef struct -{ - char header[4]; - unsigned char rti_startptlength, rti_endptlength, rti_cplength, rti_index_numchainslength; - uint64 prefixstart; - unsigned int *m_cppos; -} RTI2Header; - -class RTI2Reader : BaseRTReader -{ -private: - FILE *m_pFile; - UINT4 m_chainPosition; - unsigned char *m_pPos, *m_pChainPos; - static RTI2Header *m_pHeader; - unsigned char *m_pIndex; - UINT4 m_chainsizebytes; - UINT4 m_indexrowsizebytes; - - -public: - RTI2Reader(string Filename); - ~RTI2Reader(void); - int ReadChains(unsigned int &numChains, RainbowChainO *pData); - unsigned int GetChainsLeft(); - static RTI2Header *GetHeader() { return m_pHeader; } -}; - - -#endif diff --git a/Client Applications/rcracki_mt/md4.cpp b/Client Applications/rcracki_mt/md4.cpp deleted file mode 100644 index cb11c7e..0000000 --- a/Client Applications/rcracki_mt/md4.cpp +++ /dev/null @@ -1,334 +0,0 @@ -/* - * rcracki_mt is a multithreaded implementation and fork of the original - * RainbowCrack - * - * Copyright Bitweasil - * Copyright 2009, 2010 Daniël Niggebrugge - * Copyright 2009, 2010 James Nobis - * - * This file is part of rcracki_mt. - * - * rcracki_mt is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * rcracki_mt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with rcracki_mt. If not, see . - * - * This code implements the MD4 message-digest algorithm. - * "Just the reference implementation, single stage. Hardly "optimized." Though a good bit faster than libssl's MD4, as it isn't doing nearly the same amount of work." - Bitweasil - * - * little bit optimized (or at least attempted) for NTLM (unicode) by neinbrucke - */ - - -//#include -//#include -#include "md4.h" - -/* MD4 Defines as per RFC reference implementation */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) -#define FF(a, b, c, d, x, s) { \ - (a) += F ((b), (c), (d)) + (x); \ - (a) = ROTATE_LEFT ((a), (s)); \ - } -#define GG(a, b, c, d, x, s) { \ - (a) += G ((b), (c), (d)) + (x) + (UINT4)0x5a827999; \ - (a) = ROTATE_LEFT ((a), (s)); \ - } -#define HH(a, b, c, d, x, s) { \ - (a) += H ((b), (c), (d)) + (x) + (UINT4)0x6ed9eba1; \ - (a) = ROTATE_LEFT ((a), (s)); \ - } -#define S11 3 -#define S12 7 -#define S13 11 -#define S14 19 -#define S21 3 -#define S22 5 -#define S23 9 -#define S24 13 -#define S31 3 -#define S32 9 -#define S33 11 -#define S34 15 -/* End MD4 Defines */ - -void MD4_NEW( unsigned char * pData, int length, unsigned char * pDigest) -{ - // access data as 4-byte word - #define uData ((UINT4 *)pData) - #define uDigest ((UINT4 *)pDigest) - - // pad word and append bit at appropriate location - #define MD4_pad_w0() (0x00000080) - #define MD4_pad_w1(data) (((data) & 0x000000FF) | 0x00008000) - #define MD4_pad_w2(data) (((data) & 0x0000FFFF) | 0x00800000) - #define MD4_pad_w3(data) (((data) & 0x00FFFFFF) | 0x80000000) - - // For the hash working space - //__attribute__((aligned(16))) UINT4 data[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - //__declspec(align(16)) UINT4 data[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - UINT4 data[MD4_DIGEST_LENGTH] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - - // For the output result - UINT4 a,b,c,d; - - switch (length) - { - case 0: - { - data[ 0] = MD4_pad_w0(); - - data[14] = 0; - } - break; - case 1: - { - data[ 0] = MD4_pad_w1(uData[0]); - - data[14] = 1 << 3; - } - break; - case 2: - { - data[ 0] = MD4_pad_w2(uData[0]); - - data[14] = 2 << 3; - } - break; - case 3: - { - data[ 0] = MD4_pad_w3(uData[0]); - - data[14] = 3 << 3; - } - break; - case 4: - { - data[ 0] = uData[0]; - data[ 1] = MD4_pad_w0(); - - data[14] = 4 << 3; - } - break; - case 5: - { - data[ 0] = uData[0]; - data[ 1] = MD4_pad_w1(uData[1]); - - data[14] = 5 << 3; - } - break; - case 6: - { - data[ 0] = uData[0]; - data[ 1] = MD4_pad_w2(uData[1]); - - data[14] = 6 << 3; - } - break; - case 7: - { - data[ 0] = uData[0]; - data[ 1] = MD4_pad_w3(uData[1]); - - data[14] = 7 << 3; - } - break; - case 8: - { - data[ 0] = uData[0]; - data[ 1] = uData[1]; - data[ 2] = MD4_pad_w0(); - - data[14] = 8 << 3; - } - break; - case 9: - { - data[ 0] = uData[0]; - data[ 1] = uData[1]; - data[ 2] = MD4_pad_w1(uData[2]); - - data[14] = 9 << 3; - } - break; - case 10: - { - data[ 0] = uData[0]; - data[ 1] = uData[1]; - data[ 2] = MD4_pad_w2(uData[2]); - - data[14] = 10 << 3; - } - break; - case 11: - { - data[ 0] = uData[0]; - data[ 1] = uData[1]; - data[ 2] = MD4_pad_w3(uData[2]); - - data[14] = 11 << 3; - } - break; - case 12: - { - data[ 0] = uData[0]; - data[ 1] = uData[1]; - data[ 2] = uData[2]; - data[ 3] = MD4_pad_w0(); - - data[14] = 12 << 3; - } - break; - case 13: - { - data[ 0] = uData[0]; - data[ 1] = uData[1]; - data[ 2] = uData[2]; - data[ 3] = MD4_pad_w1(uData[3]); - - data[14] = 13 << 3; - } - break; - case 14: - { - data[ 0] = uData[0]; - data[ 1] = uData[1]; - data[ 2] = uData[2]; - data[ 3] = MD4_pad_w2(uData[3]); - - data[14] = 14 << 3; - } - break; - case 15: - { - data[ 0] = uData[0]; - data[ 1] = uData[1]; - data[ 2] = uData[2]; - data[ 3] = MD4_pad_w3(uData[3]); - - data[14] = 15 << 3; - } - break; - - default: - { - length = length % 32; // lenght >= 32 not suported - - int word = length >> 2; - - int i = 0; - while (i < word) { - data[i] = uData[i]; - i++; - } - - switch (length & 0x3) { - case 0: - { - data[word] = MD4_pad_w0(); - } - break; - case 1: - { - data[word] = MD4_pad_w1(uData[word]); - } - break; - case 2: - { - data[word] = MD4_pad_w2(uData[word]); - } - break; - case 3: - { - data[word] = MD4_pad_w3(uData[word]); - } - break; - } - - data[14] = length << 3; - } - break; - } - - a = 0x67452301; - b = 0xefcdab89; - c = 0x98badcfe; - d = 0x10325476; - - /* Round 1 */ - FF (a, b, c, d, data[ 0], S11); /* 1 */ - FF (d, a, b, c, data[ 1], S12); /* 2 */ - FF (c, d, a, b, data[ 2], S13); /* 3 */ - FF (b, c, d, a, data[ 3], S14); /* 4 */ - FF (a, b, c, d, data[ 4], S11); /* 5 */ - FF (d, a, b, c, data[ 5], S12); /* 6 */ - FF (c, d, a, b, data[ 6], S13); /* 7 */ - FF (b, c, d, a, data[ 7], S14); /* 8 */ - FF (a, b, c, d, 0, S11); /* 9 */ - FF (d, a, b, c, 0, S12); /* 10 */ - FF (c, d, a, b, 0, S13); /* 11 */ - FF (b, c, d, a, 0, S14); /* 12 */ - FF (a, b, c, d, 0, S11); /* 13 */ - FF (d, a, b, c, 0, S12); /* 14 */ - FF (c, d, a, b, data[14], S13); /* 15 */ - FF (b, c, d, a, 0, S14); /* 16 */ - - /* Round 2 */ - GG (a, b, c, d, data[ 0], S21); /* 17 */ - GG (d, a, b, c, data[ 4], S22); /* 18 */ - GG (c, d, a, b, 0, S23); /* 19 */ - GG (b, c, d, a, 0, S24); /* 20 */ - GG (a, b, c, d, data[ 1], S21); /* 21 */ - GG (d, a, b, c, data[ 5], S22); /* 22 */ - GG (c, d, a, b, 0, S23); /* 23 */ - GG (b, c, d, a, 0, S24); /* 24 */ - GG (a, b, c, d, data[ 2], S21); /* 25 */ - GG (d, a, b, c, data[ 6], S22); /* 26 */ - GG (c, d, a, b, 0, S23); /* 27 */ - GG (b, c, d, a, data[14], S24); /* 28 */ - GG (a, b, c, d, data[ 3], S21); /* 29 */ - GG (d, a, b, c, data[ 7], S22); /* 30 */ - GG (c, d, a, b, 0, S23); /* 31 */ - GG (b, c, d, a, 0, S24); /* 32 */ - - /* Round 3 */ - HH (a, b, c, d, data[ 0], S31); /* 33 */ - HH (d, a, b, c, 0, S32); /* 34 */ - HH (c, d, a, b, data[ 4], S33); /* 35 */ - HH (b, c, d, a, 0, S34); /* 36 */ - HH (a, b, c, d, data[ 2], S31); /* 37 */ - HH (d, a, b, c, 0, S32); /* 38 */ - HH (c, d, a, b, data[ 6], S33); /* 39 */ - HH (b, c, d, a, data[14], S34); /* 40 */ - HH (a, b, c, d, data[ 1], S31); /* 41 */ - HH (d, a, b, c, 0, S32); /* 42 */ - HH (c, d, a, b, data[ 5], S33); /* 43 */ - HH (b, c, d, a, 0, S34); /* 44 */ - HH (a, b, c, d, data[ 3], S31); /* 45 */ - HH (d, a, b, c, 0, S32); /* 46 */ - HH (c, d, a, b, data[ 7], S33); /* 47 */ - HH (b, c, d, a, 0, S34); /* 48 */ - - // Finally, add initial values, as this is the only pass we make. - a += 0x67452301; - b += 0xefcdab89; - c += 0x98badcfe; - d += 0x10325476; - - uDigest[0] = a; - uDigest[1] = b; - uDigest[2] = c; - uDigest[3] = d; -} diff --git a/Client Applications/rcracki_mt/md4.h b/Client Applications/rcracki_mt/md4.h deleted file mode 100644 index aeb3822..0000000 --- a/Client Applications/rcracki_mt/md4.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * rcracki_mt is a multithreaded implementation and fork of the original - * RainbowCrack - * - * Copyright Bitweasil - * Copyright 2009, 2010 Daniël Niggebrugge - * Copyright 2009, 2010 James Nobis - * - * This file is part of rcracki_mt. - * - * rcracki_mt is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * rcracki_mt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with rcracki_mt. If not, see . - */ - -#ifndef MD4_H -#define MD4_H - -#include "global.h" - -#define MD4_DIGEST_LENGTH 16 - -//Main function -void MD4_NEW( unsigned char * buf, int len, unsigned char * pDigest); - -#endif /* !MD4_H */