]> git.sesse.net Git - freerainbowtables/blob - Client Applications/rcracki_mt/lm2ntlm.h
test
[freerainbowtables] / Client Applications / rcracki_mt / lm2ntlm.h
1 /*
2  * rcracki_mt is a multithreaded implementation and fork of the original 
3  * RainbowCrack
4  *
5  * Copyright 2009, 2010 DaniĆ«l Niggebrugge <niggebrugge@fox-it.com>
6  * Copyright 2009, 2010 James Nobis <frt@quelrod.net>
7  *
8  * This file is part of rcracki_mt.
9  *
10  * rcracki_mt is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * rcracki_mt is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with rcracki_mt.  If not, see <http://www.gnu.org/licenses/>.
22  */
23
24 #include <stdio.h>
25 #include <string>
26 #include <map>
27 #ifdef _WIN32
28         #include <conio.h>
29 #endif
30 //#include "openssl/md4.h"
31 #include <time.h>
32 #include "signal.h"
33 #include "Public.h"
34 #include "md4.h"
35
36 using namespace std;
37
38 class LM2NTLMcorrector
39 {
40 public:
41         LM2NTLMcorrector();
42
43 private:
44         map<unsigned char, map<int, unsigned char> > m_mapChar;
45         uint64 progressCurrentCombination;
46         uint64 totalCurrentCombination;
47         uint64 counterOverall;
48         unsigned char NTLMHash[16];
49         clock_t startClock;
50         int countCombinations;
51         int countTotalCombinations;
52         int counter;
53         clock_t previousClock;
54         unsigned char currentCharmap[16][128];
55         bool aborting;
56         string sBinary;
57
58 private:
59         bool checkNTLMPassword(unsigned char* pLMPassword, int nLMPasswordLen, string& sNTLMPassword);
60         bool startCorrecting(string sLMPassword, string& sNTLMPassword, unsigned char* pLMPassword);
61         void printString(unsigned char* muteThis, int length);
62         void setupCombinationAtPositions(int length, unsigned char* pMuteMe, unsigned char* pTempMute, int* jAtPos, bool* fullAtPos, int* sizeAtPos);
63         bool checkPermutations(int length, unsigned char* pTempMute, int* jAtPos, int* sizeAtPos, unsigned char* pLMPassword, string& sNTLMPassword);
64
65         int calculateTotalCombinations(int length, int setSize);
66         int factorial (int num);
67
68         bool parseHexPassword(string hexPassword, string& sPlain);
69         bool NormalizeHexString(string& sHash);
70         void ParseHash(string sHash, unsigned char* pHash, int& nHashLen);
71         string ByteToStr(const unsigned char* pData, int nLen);
72         void addToMapW(unsigned char key, unsigned char value1, unsigned char value2);
73         void fillMapW();
74         void checkAbort();
75         void writeEndStats();
76 public:
77         bool LMPasswordCorrectUnicode(string hexPassword, unsigned char* NTLMHash, string& sNTLMPassword);
78         string getBinary();
79 };
80