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