From: James Nobis Date: Sun, 7 Nov 2010 01:19:23 +0000 (-0500) Subject: Merge branch 'master' of git@gitorious.org:freerainbowtables-applications/freerainbow... X-Git-Url: https://git.sesse.net/?p=freerainbowtables;a=commitdiff_plain;h=86bbf0fd5ba4e07d3279b4179fd8fc808198eaae;hp=0fb676244827a448dc60118d6558c4a4e346ffee Merge branch 'master' of git@gitorious.org:freerainbowtables-applications/freerainbowtables Conflicts: Client Applications/rcracki_mt/ChainWalkContext.cpp Client Applications/rcracki_mt/ChainWalkContext.h Client Applications/rcracki_mt/CrackEngine.cpp Client Applications/rcracki_mt/HashAlgorithm.cpp Client Applications/rcracki_mt/HashRoutine.cpp Client Applications/rcracki_mt/HashSet.cpp Client Applications/rcracki_mt/MemoryPool.cpp Client Applications/rcracki_mt/MemoryPool.h Client Applications/rcracki_mt/Public.cpp Client Applications/rcracki_mt/Public.h Client Applications/rcracki_mt/RTI2Reader.cpp Client Applications/rcracki_mt/RTI2Reader.h Client Applications/rcracki_mt/RainbowCrack.cpp Client Applications/rcracki_mt/lm2ntlm.cpp Client Applications/rcracki_mt/md4.cpp Client Applications/rcracki_mt/rcrackiThread.cpp Client Applications/rcracki_mt/sha1.cpp Client Applications/rti2rto/rti2rto.cpp Common/rt api/BaseRTReader.h Common/rt api/MemoryPool.cpp Common/rt api/RTI2Reader.cpp Common/rt api/RTIReader.cpp merging with PB's changes UINT4 -> uint32 changes misc fixes for rti2 misc fixes for long 64/32 compat --- diff --git a/BOINC software/BOINC client apps/chain_checker/chain_checker.cpp b/BOINC software/BOINC client apps/chain_checker/chain_checker.cpp deleted file mode 100644 index 041ff6e..0000000 --- a/BOINC software/BOINC client apps/chain_checker/chain_checker.cpp +++ /dev/null @@ -1,188 +0,0 @@ -// This file is part of BOINC. -// http://boinc.berkeley.edu -// Copyright (C) 2008 University of California -// -// BOINC is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License -// as published by the Free Software Foundation, -// either version 3 of the License, or (at your option) any later version. -// -// BOINC 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with BOINC. If not, see . - -// Modified by Martin Westergaard for the chain check usage -#ifdef _WIN32 -#include "boinc_win.h" -#else -#include "config.h" -#include -#include -#include -#include -#include -#include -#include -#endif - -#include -#include - -#include "str_util.h" -#include "util.h" -#include "filesys.h" -#include "boinc_api.h" -#include "Public.h" -// Rainbowcrack code -#include "ChainWalkContext.h" -#include "chain_checker.h" - -typedef unsigned int uint32; - - -using std::string; - -int main(int argc, char **argv) { - int retval; - char output_path[512], chkpt_path[512]; - string sHashRoutineName, sCharsetName, sHash; - uint32 nPlainLenMin, nPlainLenMax, nRainbowTableIndex; - FILE* state, *infile, *outfile; - retval = boinc_init(); - if (retval) { - fprintf(stderr, "boinc_init returned %d\n", retval); - exit(retval); - } - - if(argc < 7) - { - std::cerr << "Not enough parameters"; - return -1; - } - - // Initialize the args - sHashRoutineName = argv[1]; - sCharsetName = argv[2]; - nPlainLenMin = atoi(argv[3]); - nPlainLenMax = atoi(argv[4]); - nRainbowTableIndex = atoi(argv[5]); - sHash = argv[6]; - - - // Setup the ChainWalkContext - if (!CChainWalkContext::SetHashRoutine(sHashRoutineName)) - { - std::cerr << "hash routine " << sHashRoutineName << " not supported" << std::endl; - return 1; - } - - if (!CChainWalkContext::SetPlainCharset(sCharsetName, nPlainLenMin, nPlainLenMax)) - { - std::cerr << "charset " << sCharsetName << " not supported" << std::endl; - return 2; - } - - if (!CChainWalkContext::SetRainbowTableIndex(nRainbowTableIndex)) - { - std::cerr << "invalid rainbow table index " << nRainbowTableIndex << std::endl; - return 3; - } - - - // Open the file containing the chains we have to check. - boinc_resolve_filename("chains", output_path, sizeof(output_path)); - infile = boinc_fopen(output_path, "rb"); - if (infile == NULL) - { - std::cerr << "failed to open " << output_path << std::endl; - return 4; - } - - // Open the resulting file. This will *maybe* contain the password (if found) - boinc_resolve_filename("result", output_path, sizeof(output_path)); - outfile = boinc_fopen(output_path, "wb"); - if (outfile == NULL) - { - std::cerr << "failed to create " << output_path << std::endl; - return 5; - } - - // Read the chains from the input file - int len = GetFileLen(infile); - int numchains = len / 12; // Each chain is 12 bytes. 8 bytes startpoint and 4 bytes for the guessed position - fseek(infile, 0, SEEK_SET); - ChainCheckChain *pChain = new ChainCheckChain[numchains]; - int totalread = 0, read; - for(int i = 0; i < numchains; i++) - { - int read = fread(&pChain[i].nIndexS, sizeof(pChain[i].nIndexS), 1, infile); - if(read != 1) - { - std::cerr << "Error reading chaincheck file" << std::endl; - return 6; - } - read = fread(&pChain[i].nGuessedPos, sizeof(pChain[i].nGuessedPos), 1, infile); - if(read != 1) - { - std::cerr << "Error reading chaincheck file" << std::endl; - return 7; - } - - } - fclose(infile); - - - // Start checking the chains for false alarms - CChainWalkContext cwc; - int found = 0; - for(int i = 0; i < numchains; i++) - { - cwc.SetIndex(pChain[i].nIndexS); - int nPos; - for (nPos = 0; nPos < pChain[i].nGuessedPos; nPos++) - { - cwc.IndexToPlain(); - cwc.PlainToHash(); - cwc.HashToIndex(nPos); - } - cwc.IndexToPlain(); - cwc.PlainToHash(); - std::string sHashme = cwc.GetHash(); - // Check if this is a matching chain - if(sHashme.compare(sHash) == 0) - { - fwrite(cwc.GetPlain().c_str(), 1, cwc.GetPlain().length(), outfile); - std::cout << "Password is " << cwc.GetPlain() << std::endl; - found = 1; - break; // Password is found. Lets break out. - } - // This chain didn't contain the password, so we update the progress - boinc_fraction_done((double)i / (double)numchains); - - } - if(found == 0) - fwrite("0x00", 4, 1, outfile); - // Last step: Clean up - fclose(outfile); - boinc_fraction_done(1); - boinc_finish(0); -} - -#ifdef _WIN32 -int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode) { - LPSTR command_line; - char* argv[100]; - int argc; - - command_line = GetCommandLine(); - argc = parse_command_line( command_line, argv ); - return main(argc, argv); -} -#endif - -const char *BOINC_RCSID_33ac47a071 = "$Id: chain_checker.cpp 2008-11-28 Martin Westergaard $"; - diff --git a/BOINC software/BOINC client apps/chain_checker/chain_checker.h b/BOINC software/BOINC client apps/chain_checker/chain_checker.h deleted file mode 100644 index d385ee6..0000000 --- a/BOINC software/BOINC client apps/chain_checker/chain_checker.h +++ /dev/null @@ -1,12 +0,0 @@ -#include "boinc_api.h" - -struct UC_SHMEM { - double update_time; - double fraction_done; - double cpu_time; - BOINC_STATUS status; - int countdown; - // graphics app sets this to 5 repeatedly, - // main program decrements it once/sec. - // If it's zero, don't bother updating shmem -}; diff --git a/BOINC software/BOINC client apps/chain_checker/chain_checker.sln b/BOINC software/BOINC client apps/chain_checker/chain_checker.sln deleted file mode 100644 index efe9687..0000000 --- a/BOINC software/BOINC client apps/chain_checker/chain_checker.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chain_checker", "chain_checker.vcproj", "{74C09EAC-2EA2-4548-9B61-0FEE56147DFE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {74C09EAC-2EA2-4548-9B61-0FEE56147DFE}.Debug|Win32.ActiveCfg = Debug|Win32 - {74C09EAC-2EA2-4548-9B61-0FEE56147DFE}.Debug|Win32.Build.0 = Debug|Win32 - {74C09EAC-2EA2-4548-9B61-0FEE56147DFE}.Release|Win32.ActiveCfg = Release|Win32 - {74C09EAC-2EA2-4548-9B61-0FEE56147DFE}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/BOINC software/BOINC client apps/chain_checker/chain_checker.suo b/BOINC software/BOINC client apps/chain_checker/chain_checker.suo deleted file mode 100644 index d24e681..0000000 Binary files a/BOINC software/BOINC client apps/chain_checker/chain_checker.suo and /dev/null differ diff --git a/BOINC software/BOINC client apps/chain_checker/chain_checker.vcproj b/BOINC software/BOINC client apps/chain_checker/chain_checker.vcproj deleted file mode 100644 index 423716c..0000000 --- a/BOINC software/BOINC client apps/chain_checker/chain_checker.vcproj +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BOINC software/BOINC client apps/chain_checker/charset.txt b/BOINC software/BOINC client apps/chain_checker/charset.txt deleted file mode 100644 index d1e0179..0000000 --- a/BOINC software/BOINC client apps/chain_checker/charset.txt +++ /dev/null @@ -1,61 +0,0 @@ -# charset configuration file for DistrRTgen v3.2 by Martin Westergaard (martinwj2005@gmail.com) - -byte = [] -alpha = [ABCDEFGHIJKLMNOPQRSTUVWXYZ] -alpha-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ ] -alpha-numeric = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789] -alpha-numeric-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ] -alpha-numeric-symbol14 = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=] -alpha-numeric-symbol14-space= [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+= ] -all = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/] -all-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] -alpha-numeric-symbol32-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] -lm-frt-cp437 = [ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~€Ž’™š›œžŸ¥àáâãäæçèéêëî] -lm-frt-cp850 = [ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~€Ž’™šœŸ¥µ¶·½¾ÇÏÑÒÓÔÕÖ×ØÞàáâãåæèéêëíï] -lm-frt-cp437-850 = [ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~€Ž’™š›œžŸ¥µ¶·½¾ÇÏÑÒÓÔÕÖ×ØÞàáâãäåæçèéêëíîï] - -numeric = [0123456789] -numeric-space = [0123456789 ] -loweralpha = [abcdefghijklmnopqrstuvwxyz] -loweralpha-space = [abcdefghijklmnopqrstuvwxyz ] -loweralpha-numeric = [abcdefghijklmnopqrstuvwxyz0123456789] -loweralpha-numeric-space = [abcdefghijklmnopqrstuvwxyz0123456789 ] -loweralpha-numeric-symbol14 = [abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_+=] -loweralpha-numeric-all = [abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/] -loweralpha-numeric-symbol32-space= [abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] - -mixalpha = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ] -mixalpha-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ] -mixalpha-numeric = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789] -mixalpha-numeric-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ] -mixalpha-numeric-symbol14 = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=] -mixalpha-numeric-all = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/] -mixalpha-numeric-symbol32-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] -mixalpha-numeric-all-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BOINC software/BOINC client apps/distrrtgen/createlinks.bat b/BOINC software/BOINC client apps/distrrtgen/createlinks.bat deleted file mode 100644 index 213689b..0000000 --- a/BOINC software/BOINC client apps/distrrtgen/createlinks.bat +++ /dev/null @@ -1,21 +0,0 @@ -mklink /H ChainWalkContext.cpp "../../../Common/rt api/ChainWalkContext.cpp" -mklink /H ChainWalkContext.h "../../../Common/rt api/ChainWalkContext.h" -mklink /H des.h "../../../Common/rt api/des.h" -mklink /H des_enc.c "../../../Common/rt api/des_enc.c" -mklink /H des_locl.h "../../../Common/rt api/des_locl.h" -mklink /H des_setkey.c "../../../Common/rt api/des_setkey.c" -mklink /H ecb_enc.c "../../../Common/rt api/ecb_enc.c" -mklink /H global.h "../../../Common/rt api/global.h" -mklink /H HashAlgorithm.h "../../../Common/rt api/HashAlgorithm.h" -mklink /H HashAlgorithm.cpp "../../../Common/rt api/HashAlgorithm.cpp" -mklink /H HashRoutine.cpp "../../../Common/rt api/HashRoutine.cpp" -mklink /H HashRoutine.h "../../../Common/rt api/HashRoutine.h" -mklink /H md4.cpp "../../../Common/rt api/md4.cpp" -mklink /H md4.h "../../../Common/rt api/md4.h" -mklink /H md5.cpp "../../../Common/rt api/md5.cpp" -mklink /H md5.h "../../../Common/rt api/md5.h" -mklink /H podd.h "../../../Common/rt api/podd.h" -mklink /H Public.cpp "../../../Common/rt api/Public.cpp" -mklink /H Public.h "../../../Common/rt api/Public.h" -mklink /H sk.h "../../../Common/rt api/sk.h" -mklink /H spr.h "../../../Common/rt api/spr.h" diff --git a/BOINC software/BOINC client apps/distrrtgen/distrrtgen.sln b/BOINC software/BOINC client apps/distrrtgen/distrrtgen.sln index 24b2d5b..6969853 100644 --- a/BOINC software/BOINC client apps/distrrtgen/distrrtgen.sln +++ b/BOINC software/BOINC client apps/distrrtgen/distrrtgen.sln @@ -1,9 +1,9 @@  -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "distrrtgen", "distrrtgen.vcproj", "{A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}" +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "distrrtgen", "distrrtgen.vcxproj", "{A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "index_calculator", "..\index_calculator\index_calculator.vcproj", "{C7A957CF-9FDC-4C72-9C3E-7C029E915D1E}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "index_calculator", "..\index_calculator\index_calculator.vcxproj", "{C7A957CF-9FDC-4C72-9C3E-7C029E915D1E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rti2rto", "..\..\standalone\rti2rto\rti2rto.vcproj", "{E0FBC06A-C902-4468-A614-CBF9F591AA7C}" EndProject @@ -15,7 +15,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rtperfectp", "..\..\standal EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rcracki", "..\..\standalone\rcracki\rcracki.vcproj", "{966DA4B4-E13C-449D-9A93-303C6FEA25C4}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chain_checker", "..\chain_checker\chain_checker.vcproj", "{74C09EAC-2EA2-4548-9B61-0FEE56147DFE}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chain_checker", "..\chain_checker\chain_checker.vcxproj", "{74C09EAC-2EA2-4548-9B61-0FEE56147DFE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/BOINC software/BOINC client apps/distrrtgen/distrrtgen.suo b/BOINC software/BOINC client apps/distrrtgen/distrrtgen.suo index cb8fc8f..5691790 100644 Binary files a/BOINC software/BOINC client apps/distrrtgen/distrrtgen.suo and b/BOINC software/BOINC client apps/distrrtgen/distrrtgen.suo differ diff --git a/BOINC software/BOINC client apps/distrrtgen/distrrtgen.vcxproj b/BOINC software/BOINC client apps/distrrtgen/distrrtgen.vcxproj index 538bc62..0fb305c 100644 --- a/BOINC software/BOINC client apps/distrrtgen/distrrtgen.vcxproj +++ b/BOINC software/BOINC client apps/distrrtgen/distrrtgen.vcxproj @@ -1,4 +1,4 @@ - + @@ -89,8 +89,8 @@ Disabled - /boinc/lib;/boinc/api;/boinc/zip;/boinc/client/win;/boinc/;../../rt api;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_MT;_CONSOLE;%(PreprocessorDefinitions) + ../../../common/rt api;%(AdditionalIncludeDirectories) + BOINC;WIN32;_DEBUG;_MT;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug @@ -114,11 +114,11 @@ true Speed true - C:\Users\mwj\git\Common\rt api;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_MT;_CONSOLE;%(PreprocessorDefinitions) + ..\..\..\Common\rt api;%(AdditionalIncludeDirectories) + BOINC;WIN32;NDEBUG;_MT;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded true - StreamingSIMDExtensions2 + StreamingSIMDExtensions Level3 @@ -126,7 +126,7 @@ false - odbc32.lib;odbccp32.lib;libcmt.lib;libcpmt.lib;libboinc_staticcrt.lib;libboincapi_staticcrt.lib;%(AdditionalDependencies) + odbc32.lib;odbccp32.lib;libcmt.lib;libcpmt.lib;C:\lib\boinc\Win32\Release\2010\libboinc_staticcrt.lib;C:\lib\boinc\Win32\Release\2010\libboincapi_staticcrt.lib;%(AdditionalDependencies) true false Windows @@ -213,6 +213,7 @@ + diff --git a/BOINC software/BOINC client apps/distrrtgen/distrrtgen.vcxproj.filters b/BOINC software/BOINC client apps/distrrtgen/distrrtgen.vcxproj.filters index 7253c31..8dc6044 100644 --- a/BOINC software/BOINC client apps/distrrtgen/distrrtgen.vcxproj.filters +++ b/BOINC software/BOINC client apps/distrrtgen/distrrtgen.vcxproj.filters @@ -83,5 +83,8 @@ Header Files + + Header Files + \ No newline at end of file diff --git a/BOINC software/BOINC client apps/distrrtgen_flash/Makefile b/BOINC software/BOINC client apps/distrrtgen_flash/Makefile deleted file mode 100644 index 0963011..0000000 --- a/BOINC software/BOINC client apps/distrrtgen_flash/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# This should work on Linux. Modify as needed for other platforms. - -BOINC_DIR = /home/frt/server_stable -BOINC_API_DIR = $(BOINC_DIR)/api -BOINC_LIB_DIR = $(BOINC_DIR)/lib - -CXXFLAGS = -g \ - -DAPP_GRAPHICS \ - -I$(BOINC_DIR) \ - -I$(BOINC_LIB_DIR) \ - -I$(BOINC_API_DIR) \ - -L$(BOINC_API_DIR) \ - -L$(BOINC_LIB_DIR) \ - -L /usr/X11R6/lib \ - -L. - - -PROGS = distrrtgen \ - -all: $(PROGS) - -libstdc++.a: - ln -s `g++ -print-file-name=libstdc++.a` - -clean: - /bin/rm -f $(PROGS) *.o - -distclean: - /bin/rm -f $(PROGS) *.o libstdc++.a - -distrrtgen: distrrtgen.o libstdc++.a $(BOINC_API_DIR)/libboinc_api.a $(BOINC_LIB_DIR)/libboinc.a - $(CXX) Public.cpp ChainWalkContext.cpp HashAlgorithm.cpp HashRoutine.cpp md5.cpp $(CXXFLAGS) -o distrrtgen distrrtgen.o libstdc++.a -pthread -lboinc_api -lboinc -lssl -O3 diff --git a/BOINC software/BOINC client apps/distrrtgen_flash/charset.txt b/BOINC software/BOINC client apps/distrrtgen_flash/charset.txt deleted file mode 100644 index 6e749fa..0000000 --- a/BOINC software/BOINC client apps/distrrtgen_flash/charset.txt +++ /dev/null @@ -1,34 +0,0 @@ -# charset configuration file for DistrRTgen v3.2 by Martin Westergaard (martinwj2005@gmail.com) - -byte = [] -alpha = [ABCDEFGHIJKLMNOPQRSTUVWXYZ] -alpha-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ ] -alpha-numeric = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789] -alpha-numeric-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ] -alpha-numeric-symbol14 = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=] -alpha-numeric-symbol14-space= [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+= ] -all = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/] -all-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] -alpha-numeric-symbol32-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] -lm-frt-cp437 = [ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~€Ž’™š›œžŸ¥àáâãäæçèéêëî] -lm-frt-cp850 = [ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~€Ž’™šœŸ¥µ¶·½¾ÇÏÑÒÓÔÕÖ×ØÞàáâãåæèéêëíï] -lm-frt-cp437-850 = [ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~€Ž’™š›œžŸ¥µ¶·½¾ÇÏÑÒÓÔÕÖ×ØÞàáâãäåæçèéêëíîï] - -numeric = [0123456789] -numeric-space = [0123456789 ] -loweralpha = [abcdefghijklmnopqrstuvwxyz] -loweralpha-space = [abcdefghijklmnopqrstuvwxyz ] -loweralpha-numeric = [abcdefghijklmnopqrstuvwxyz0123456789] -loweralpha-numeric-space = [abcdefghijklmnopqrstuvwxyz0123456789 ] -loweralpha-numeric-symbol14 = [abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_+=] -loweralpha-numeric-all = [abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/] -loweralpha-numeric-symbol32-space= [abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] - -mixalpha = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ] -mixalpha-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ] -mixalpha-numeric = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789] -mixalpha-numeric-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ] -mixalpha-numeric-symbol14 = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=] -mixalpha-numeric-all = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/] -mixalpha-numeric-symbol32-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] -mixalpha-numeric-all-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] diff --git a/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.cpp b/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.cpp deleted file mode 100644 index bfd0ca4..0000000 --- a/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.cpp +++ /dev/null @@ -1,199 +0,0 @@ -// This file is part of BOINC. -// http://boinc.berkeley.edu -// Copyright (C) 2008 University of California -// -// BOINC is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License -// as published by the Free Software Foundation, -// either version 3 of the License, or (at your option) any later version. -// -// BOINC 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with BOINC. If not, see . - -// This program serves as both -// - An example BOINC application, illustrating the use of the BOINC API -// - A program for testing various features of BOINC -// -// NOTE: this file exists as both -// boinc/apps/upper_case.C -// and -// boinc_samples/example_app/uc2.C -// If you update one, please update the other! - -// The program converts a mixed-case file to upper case: -// read "in", convert to upper case, write to "out" -// -// command line options -// -run_slow: sleep 1 second after each character -// -cpu_time N: use about N CPU seconds after copying files -// -early_exit: exit(10) after 30 chars -// -early_crash: crash after 30 chars -// - -#ifdef _WIN32 - -#else -#include -#include -#include -#include -#include -#include -#include -#endif - -#include -#include -#include -#include -#include "Public.h" -// Rainbowcrack code -#include "ChainWalkContext.h" -typedef unsigned int uint32; -//typedef unsigned __int64 uint64; - - -using std::string; - -/* -bool early_exit = false; -bool early_crash = false; -bool early_sleep = false; -double cpu_time = 20, comp_result; -*/ -int main(int argc, char **argv) { - int retval; - double fd; - - - if(argc < 10) - { - fprintf(stderr, "Not enough parameters"); - return -1; - } - string sHashRoutineName, sCharsetName, sSalt, sCheckPoints; - uint32 nRainbowChainCount, nPlainLenMin, nPlainLenMax, nRainbowTableIndex, nRainbowChainLen; - uint64 nChainStart; - sHashRoutineName = argv[1]; - sCharsetName = argv[2]; - nPlainLenMin = atoi(argv[3]); - nPlainLenMax = atoi(argv[4]); - nRainbowTableIndex = atoi(argv[5]); - nRainbowChainLen = atoi(argv[6]); - nRainbowChainCount = atoi(argv[7]); -#ifdef _WIN32 - - nChainStart = _atoi64(argv[8]); - -#else - nChainStart = atoll(argv[8]); -#endif - sCheckPoints = argv[9]; - vector vCPPositions; - char *cp = strtok((char *)sCheckPoints.c_str(), ","); - while(cp != NULL) - { - vCPPositions.push_back(atoi(cp)); - cp = strtok(NULL, ","); - } - if(argc == 11) - { - sSalt = argv[10]; - } - //std::cout << "Starting ChainGenerator" << std::endl; - // Setup CChainWalkContext - //std::cout << "ChainGenerator started." << std::endl; - - if (!CChainWalkContext::SetHashRoutine(sHashRoutineName)) - { - fprintf(stderr, "hash routine %s not supported\n", sHashRoutineName.c_str()); - return 1; - } - //std::cout << "Hash routine validated" << std::endl; - - if (!CChainWalkContext::SetPlainCharset(sCharsetName, nPlainLenMin, nPlainLenMax)) - { - std::cerr << "charset " << sCharsetName << " not supported" << std::endl; - return 2; - } - //std::cout << "Plain charset validated" << std::endl; - - if (!CChainWalkContext::SetRainbowTableIndex(nRainbowTableIndex)) - { - std::cerr << "invalid rainbow table index " << nRainbowTableIndex << std::endl; - return 3; - } - //std::cout << "Rainbowtable index validated" << std::endl; - - if(sHashRoutineName == "mscache")// || sHashRoutineName == "lmchall" || sHashRoutineName == "halflmchall") - { - // Convert username to unicode - const char *szSalt = sSalt.c_str(); - int salt_length = strlen(szSalt); - unsigned char cur_salt[256]; - for (int i=0; i. - -#include "boinc_api.h" - -struct UC_SHMEM { - double update_time; - double fraction_done; - double cpu_time; - BOINC_STATUS status; - int countdown; - // graphics app sets this to 5 repeatedly, - // main program decrements it once/sec. - // If it's zero, don't bother updating shmem -}; diff --git a/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.ncb b/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.ncb deleted file mode 100644 index 4b3076b..0000000 Binary files a/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.ncb and /dev/null differ diff --git a/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.sln b/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.sln deleted file mode 100644 index 24b2d5b..0000000 --- a/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.sln +++ /dev/null @@ -1,62 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "distrrtgen", "distrrtgen.vcproj", "{A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "index_calculator", "..\index_calculator\index_calculator.vcproj", "{C7A957CF-9FDC-4C72-9C3E-7C029E915D1E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rti2rto", "..\..\standalone\rti2rto\rti2rto.vcproj", "{E0FBC06A-C902-4468-A614-CBF9F591AA7C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "convertrti2", "..\..\standalone\converti2\converti2.vcproj", "{066FD6F1-5990-47AD-B095-7AE0029CF5AE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rsearch", "..\..\standalone\rsearch\rsearch.vcproj", "{40F12861-0A31-4E0E-8324-24F897271C8E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rtperfectp", "..\..\standalone\rtperfectp\rtperfectp.vcproj", "{9725038C-A07B-40DD-87CD-3A119021A244}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rcracki", "..\..\standalone\rcracki\rcracki.vcproj", "{966DA4B4-E13C-449D-9A93-303C6FEA25C4}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chain_checker", "..\chain_checker\chain_checker.vcproj", "{74C09EAC-2EA2-4548-9B61-0FEE56147DFE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Debug|Win32.ActiveCfg = Debug|Win32 - {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Debug|Win32.Build.0 = Debug|Win32 - {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Release|Win32.ActiveCfg = Release|Win32 - {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Release|Win32.Build.0 = Release|Win32 - {C7A957CF-9FDC-4C72-9C3E-7C029E915D1E}.Debug|Win32.ActiveCfg = Debug|Win32 - {C7A957CF-9FDC-4C72-9C3E-7C029E915D1E}.Debug|Win32.Build.0 = Debug|Win32 - {C7A957CF-9FDC-4C72-9C3E-7C029E915D1E}.Release|Win32.ActiveCfg = Release|Win32 - {C7A957CF-9FDC-4C72-9C3E-7C029E915D1E}.Release|Win32.Build.0 = Release|Win32 - {E0FBC06A-C902-4468-A614-CBF9F591AA7C}.Debug|Win32.ActiveCfg = Debug|Win32 - {E0FBC06A-C902-4468-A614-CBF9F591AA7C}.Debug|Win32.Build.0 = Debug|Win32 - {E0FBC06A-C902-4468-A614-CBF9F591AA7C}.Release|Win32.ActiveCfg = Release|Win32 - {E0FBC06A-C902-4468-A614-CBF9F591AA7C}.Release|Win32.Build.0 = Release|Win32 - {066FD6F1-5990-47AD-B095-7AE0029CF5AE}.Debug|Win32.ActiveCfg = Debug|Win32 - {066FD6F1-5990-47AD-B095-7AE0029CF5AE}.Debug|Win32.Build.0 = Debug|Win32 - {066FD6F1-5990-47AD-B095-7AE0029CF5AE}.Release|Win32.ActiveCfg = Release|Win32 - {066FD6F1-5990-47AD-B095-7AE0029CF5AE}.Release|Win32.Build.0 = Release|Win32 - {40F12861-0A31-4E0E-8324-24F897271C8E}.Debug|Win32.ActiveCfg = Debug|Win32 - {40F12861-0A31-4E0E-8324-24F897271C8E}.Debug|Win32.Build.0 = Debug|Win32 - {40F12861-0A31-4E0E-8324-24F897271C8E}.Release|Win32.ActiveCfg = Release|Win32 - {40F12861-0A31-4E0E-8324-24F897271C8E}.Release|Win32.Build.0 = Release|Win32 - {9725038C-A07B-40DD-87CD-3A119021A244}.Debug|Win32.ActiveCfg = Debug|Win32 - {9725038C-A07B-40DD-87CD-3A119021A244}.Debug|Win32.Build.0 = Debug|Win32 - {9725038C-A07B-40DD-87CD-3A119021A244}.Release|Win32.ActiveCfg = Release|Win32 - {9725038C-A07B-40DD-87CD-3A119021A244}.Release|Win32.Build.0 = Release|Win32 - {966DA4B4-E13C-449D-9A93-303C6FEA25C4}.Debug|Win32.ActiveCfg = Debug|Win32 - {966DA4B4-E13C-449D-9A93-303C6FEA25C4}.Debug|Win32.Build.0 = Debug|Win32 - {966DA4B4-E13C-449D-9A93-303C6FEA25C4}.Release|Win32.ActiveCfg = Release|Win32 - {966DA4B4-E13C-449D-9A93-303C6FEA25C4}.Release|Win32.Build.0 = Release|Win32 - {74C09EAC-2EA2-4548-9B61-0FEE56147DFE}.Debug|Win32.ActiveCfg = Debug|Win32 - {74C09EAC-2EA2-4548-9B61-0FEE56147DFE}.Debug|Win32.Build.0 = Debug|Win32 - {74C09EAC-2EA2-4548-9B61-0FEE56147DFE}.Release|Win32.ActiveCfg = Release|Win32 - {74C09EAC-2EA2-4548-9B61-0FEE56147DFE}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.suo b/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.suo deleted file mode 100644 index 426c9d9..0000000 Binary files a/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.suo and /dev/null differ diff --git a/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.vcproj b/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.vcproj deleted file mode 100644 index d4e339c..0000000 --- a/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.vcproj +++ /dev/null @@ -1,290 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.vcproj.MWJ-PC.mwj.user b/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.vcproj.MWJ-PC.mwj.user deleted file mode 100644 index 15b19f6..0000000 --- a/BOINC software/BOINC client apps/distrrtgen_flash/distrrtgen.vcproj.MWJ-PC.mwj.user +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - diff --git a/BOINC software/BOINC client apps/index_calculator/charset.txt b/BOINC software/BOINC client apps/index_calculator/charset.txt deleted file mode 100644 index 6e749fa..0000000 --- a/BOINC software/BOINC client apps/index_calculator/charset.txt +++ /dev/null @@ -1,34 +0,0 @@ -# charset configuration file for DistrRTgen v3.2 by Martin Westergaard (martinwj2005@gmail.com) - -byte = [] -alpha = [ABCDEFGHIJKLMNOPQRSTUVWXYZ] -alpha-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ ] -alpha-numeric = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789] -alpha-numeric-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ] -alpha-numeric-symbol14 = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=] -alpha-numeric-symbol14-space= [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+= ] -all = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/] -all-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] -alpha-numeric-symbol32-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] -lm-frt-cp437 = [ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~€Ž’™š›œžŸ¥àáâãäæçèéêëî] -lm-frt-cp850 = [ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~€Ž’™šœŸ¥µ¶·½¾ÇÏÑÒÓÔÕÖ×ØÞàáâãåæèéêëíï] -lm-frt-cp437-850 = [ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~€Ž’™š›œžŸ¥µ¶·½¾ÇÏÑÒÓÔÕÖ×ØÞàáâãäåæçèéêëíîï] - -numeric = [0123456789] -numeric-space = [0123456789 ] -loweralpha = [abcdefghijklmnopqrstuvwxyz] -loweralpha-space = [abcdefghijklmnopqrstuvwxyz ] -loweralpha-numeric = [abcdefghijklmnopqrstuvwxyz0123456789] -loweralpha-numeric-space = [abcdefghijklmnopqrstuvwxyz0123456789 ] -loweralpha-numeric-symbol14 = [abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_+=] -loweralpha-numeric-all = [abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/] -loweralpha-numeric-symbol32-space= [abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] - -mixalpha = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ] -mixalpha-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ] -mixalpha-numeric = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789] -mixalpha-numeric-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ] -mixalpha-numeric-symbol14 = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=] -mixalpha-numeric-all = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/] -mixalpha-numeric-symbol32-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] -mixalpha-numeric-all-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ] diff --git a/BOINC software/BOINC client apps/index_calculator/index_calculator.cpp b/BOINC software/BOINC client apps/index_calculator/index_calculator.cpp deleted file mode 100644 index 04041be..0000000 --- a/BOINC software/BOINC client apps/index_calculator/index_calculator.cpp +++ /dev/null @@ -1,225 +0,0 @@ -// This file is part of BOINC. -// http://boinc.berkeley.edu -// Copyright (C) 2008 University of California -// -// BOINC is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License -// as published by the Free Software Foundation, -// either version 3 of the License, or (at your option) any later version. -// -// BOINC 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with BOINC. If not, see . - - -#ifdef _WIN32 -#include "boinc_win.h" -#else -#include "config.h" -#include -#include -#include -#include -#include -#include -#include -#endif - -#include -#include - -#include "str_util.h" -#include "util.h" -#include "filesys.h" -#include "boinc_api.h" -#include "Public.h" -// Rainbowcrack code -#include "ChainWalkSet.h" -#include "ChainWalkContext.h" -typedef unsigned int uint32; -//typedef unsigned __int64 uint64; - - -using std::string; - -int main(int argc, char **argv) { - int i; - int c, nchars = 0, retval, n; - double fsize, fd; - char output_path[512], chkpt_path[512]; - FILE* state, *infile; - retval = boinc_init(); - if (retval) { - fprintf(stderr, "boinc_init returned %d\n", retval); - exit(retval); - } - - - // get size of input file (used to compute fraction done) - // - //file_size(input_path, fsize); - - // See if there's a valid checkpoint file. - // If so seek input file and truncate output file - // - - - if(argc < 8) - { - std::cerr << "Not enough parameters"; - return -1; - } - string sHashRoutineName, sCharsetName, sHash; - uint32 nRainbowChainCount, nPlainLenMin, nPlainLenMax, nRainbowTableIndex, nRainbowChainLen; - uint64 nChainStart; - sHashRoutineName = argv[1]; - sCharsetName = argv[2]; - nPlainLenMin = atoi(argv[3]); - nPlainLenMax = atoi(argv[4]); - nRainbowTableIndex = atoi(argv[5]); - nRainbowChainLen = atoi(argv[6]); - sHash = argv[7]; - //std::cout << "Starting ChainGenerator" << std::endl; - // Setup CChainWalkContext - //std::cout << "ChainGenerator started." << std::endl; - - if (!CChainWalkContext::SetHashRoutine(sHashRoutineName)) - { - std::cerr << "hash routine " << sHashRoutineName << " not supported" << std::endl; - return 1; - } - //std::cout << "Hash routine validated" << std::endl; - - if (!CChainWalkContext::SetPlainCharset(sCharsetName, nPlainLenMin, nPlainLenMax)) - { - std::cerr << "charset " << sCharsetName << " not supported" << std::endl; - return 2; - } - //std::cout << "Plain charset validated" << std::endl; - - if (!CChainWalkContext::SetRainbowTableIndex(nRainbowTableIndex)) - { - std::cerr << "invalid rainbow table index " << nRainbowTableIndex << std::endl; - return 3; - } - //std::cout << "Rainbowtable index validated" << std::endl; -/* - if(sHashRoutineName == "mscache")// || sHashRoutineName == "lmchall" || sHashRoutineName == "halflmchall") - { - // Convert username to unicode - const char *szSalt = sSalt.c_str(); - int salt_length = strlen(szSalt); - unsigned char cur_salt[256]; - for (int i=0; i= 0; nPos--) - { - if(time(NULL) - tStart > 1) - { - time(&tStart); - double nCurrentChains = pow(((double)nRainbowChainLen - 2 - (double)nPos), 2) / 2 - (nRainbowChainLen - 2); - double fResult = ((double)((double)(nCurrentChains) / nTargetChains)); - if(fResult < 0) - fResult = 0; - boinc_fraction_done(fResult); - } - - cwc.SetHash(TargetHash); - cwc.HashToIndex(nPos); - int i; - for (i = nPos + 1; i <= nRainbowChainLen - 2; i++) - { - cwc.IndexToPlain(); - cwc.PlainToHash(); - cwc.HashToIndex(i); - } - uint64 index = cwc.GetIndex(); - if(fwrite(&index, 8, 1, outfile) != 1) - { - fprintf(stderr, "unable to write to outfile"); - return 9; - } - //nChainWalkStep += nRainbowChainLen - 2 - nPos; - } -// printf("ok\n"); - double nCurrentChains = pow(((double)nRainbowChainLen - 2 - (double)nPos), 2) / 2 - (nRainbowChainLen - 2); - double fResult = ((double)((double)(nCurrentChains) / nTargetChains)); - boinc_fraction_done(fResult); - } - - - fclose(outfile); - - // main loop - read characters, convert to UC, write - // - - boinc_fraction_done(1); - boinc_finish(0); -} - -#ifdef _WIN32 -int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode) { - LPSTR command_line; - char* argv[100]; - int argc; - - command_line = GetCommandLine(); - argc = parse_command_line( command_line, argv ); - return main(argc, argv); -} -#endif - -const char *BOINC_RCSID_33ac47a071 = "$Id: upper_case.C 12135 2007-02-21 20:04:14Z davea $"; - diff --git a/BOINC software/BOINC client apps/index_calculator/index_calculator.h b/BOINC software/BOINC client apps/index_calculator/index_calculator.h deleted file mode 100644 index d360617..0000000 --- a/BOINC software/BOINC client apps/index_calculator/index_calculator.h +++ /dev/null @@ -1,29 +0,0 @@ -// This file is part of BOINC. -// http://boinc.berkeley.edu -// Copyright (C) 2008 University of California -// -// BOINC is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License -// as published by the Free Software Foundation, -// either version 3 of the License, or (at your option) any later version. -// -// BOINC 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with BOINC. If not, see . - -#include "boinc_api.h" - -struct UC_SHMEM { - double update_time; - double fraction_done; - double cpu_time; - BOINC_STATUS status; - int countdown; - // graphics app sets this to 5 repeatedly, - // main program decrements it once/sec. - // If it's zero, don't bother updating shmem -}; diff --git a/BOINC software/BOINC client apps/index_calculator/index_calculator.suo b/BOINC software/BOINC client apps/index_calculator/index_calculator.suo deleted file mode 100644 index 393645d..0000000 Binary files a/BOINC software/BOINC client apps/index_calculator/index_calculator.suo and /dev/null differ diff --git a/BOINC software/BOINC client apps/index_calculator/index_calculator.vcproj b/BOINC software/BOINC client apps/index_calculator/index_calculator.vcproj deleted file mode 100644 index c372b13..0000000 --- a/BOINC software/BOINC client apps/index_calculator/index_calculator.vcproj +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BOINC software/BOINC client apps/win_build/boinc_apps.sln b/BOINC software/BOINC client apps/win_build/boinc_apps.sln new file mode 100644 index 0000000..ac2739c --- /dev/null +++ b/BOINC software/BOINC client apps/win_build/boinc_apps.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "distrrtgen", "..\distrrtgen\distrrtgen.vcxproj", "{A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Debug|Win32.ActiveCfg = Debug|Win32 + {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Debug|Win32.Build.0 = Debug|Win32 + {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Debug|x64.ActiveCfg = Debug|x64 + {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Debug|x64.Build.0 = Debug|x64 + {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Release|Win32.ActiveCfg = Release|Win32 + {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Release|Win32.Build.0 = Release|Win32 + {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Release|x64.ActiveCfg = Release|x64 + {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Client Applications/converti2/Makefile b/Client Applications/converti2/Makefile index 6323267..4886c1a 100644 --- a/Client Applications/converti2/Makefile +++ b/Client Applications/converti2/Makefile @@ -3,10 +3,10 @@ CC = g++ OPTIMIZATION = -O3 INCLUDES = -I../../Common/rt\ api # XXX todo currently only 32-bit targets work -CFLAGS = -Wall -m32 -ansi $(INCLUDES) $(OPTIMIZATION) -c -LFLAGS = -Wall -m32 -ansi $(INCLUDES) $(OPTIMIZATION) +CFLAGS = -Wall -m32 -ansi $(INCLUDES) $(OPTIMIZATION) -c $(DEBUG) +LFLAGS = -Wall -m32 -ansi $(INCLUDES) $(OPTIMIZATION) $(DEBUG) LIBS = -OBJS = MemoryPool.o Public.o +OBJS = MemoryPool.o Public.o RTI2Reader.o RTIReader.o RTReader.o COMMON_API_PATH = ../../Common/rt\ api all: converti2 @@ -17,6 +17,12 @@ converti2: $(OBJS) clean: rm -f *.o converti2 +debug: DEBUG += -DDEBUG -g +debug: all + +#m32: DEBUG += -m32 +#m32: converti2 + rebuild: clean all MemoryPool.o: $(COMMON_API_PATH)/MemoryPool.h $(COMMON_API_PATH)/MemoryPool.cpp $(COMMON_API_PATH)/Public.h @@ -24,3 +30,12 @@ MemoryPool.o: $(COMMON_API_PATH)/MemoryPool.h $(COMMON_API_PATH)/MemoryPool.cpp Public.o: $(COMMON_API_PATH)/Public.h $(COMMON_API_PATH)/Public.cpp $(CC) $(CFLAGS) $(COMMON_API_PATH)/Public.cpp + +RTI2Reader.o: $(COMMON_API_PATH)/RTI2Reader.h $(COMMON_API_PATH)/RTI2Reader.cpp + $(CC) $(CFLAGS) $(COMMON_API_PATH)/RTI2Reader.cpp + +RTIReader.o: $(COMMON_API_PATH)/RTIReader.h $(COMMON_API_PATH)/RTIReader.cpp + $(CC) $(CFLAGS) $(COMMON_API_PATH)/RTIReader.cpp + +RTReader.o: $(COMMON_API_PATH)/RTReader.h $(COMMON_API_PATH)/RTReader.cpp + $(CC) $(CFLAGS) $(COMMON_API_PATH)/RTReader.cpp diff --git a/Client Applications/converti2/Public.cpp b/Client Applications/converti2/Public.cpp deleted file mode 100644 index 7e54203..0000000 --- a/Client Applications/converti2/Public.cpp +++ /dev/null @@ -1,319 +0,0 @@ -/* - * freerainbowtables is a project for generating, distributing, and using - * perfect rainbow tables - * - * 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 freerainbowtables. - * - * freerainbowtables 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. - * - * freerainbowtables 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 freerainbowtables. If not, see . -*/ - -#ifdef _WIN32 - #pragma warning(disable : 4786) -#endif - -#ifdef _WIN32 - -#else -#include -#include -#include -#include -#include -#include -#include - -#endif - -#include "Public.h" - -#ifdef _WIN32 - #include -#elif defined(__APPLE__) || \ - ((defined(__unix__) || defined(unix)) && !defined(USG)) - - #include - - #if defined(BSD) - #include - #elif defined(__linux__) - #include - #else - #error Unsupported Operating system - #endif -#endif - -////////////////////////////////////////////////////////////////////// - -unsigned int GetFileLen(FILE* file) -{ - unsigned int pos = ftell(file); - fseek(file, 0, SEEK_END); - unsigned int len = ftell(file); - fseek(file, pos, SEEK_SET); - - return len; -} - -string TrimString(string s) -{ - while (s.size() > 0) - { - if (s[0] == ' ' || s[0] == '\t') - s = s.substr(1); - else - break; - } - - while (s.size() > 0) - { - if (s[s.size() - 1] == ' ' || s[s.size() - 1] == '\t') - s = s.substr(0, s.size() - 1); - else - break; - } - - return s; -} -bool GetHybridCharsets(string sCharset, vector& vCharset) -{ - // Example: hybrid(mixalpha-numeric-all-space#1-6,numeric#1-4) - if(sCharset.substr(0, 6) != "hybrid") // Not hybrid charset - return false; - - UINT4 nEnd = (int) sCharset.rfind(')'); - UINT4 nStart = (int) sCharset.rfind('('); - string sChar = sCharset.substr(nStart + 1, nEnd - nStart - 1); - vector vParts; - SeperateString(sChar, ",", vParts); - for(UINT4 i = 0; i < vParts.size(); i++) - { - tCharset stCharset; - vector vParts2; - SeperateString(vParts[i], "#", vParts2); - stCharset.sName = vParts2[0]; - vector vParts3; - SeperateString(vParts2[1], "-", vParts3); - stCharset.nPlainLenMin = atoi(vParts3[0].c_str()); - stCharset.nPlainLenMax = atoi(vParts3[1].c_str()); - vCharset.push_back(stCharset); - } - return true; -} -bool ReadLinesFromFile(string sPathName, vector& vLine) -{ - vLine.clear(); - FILE *file = fopen(sPathName.c_str(), "rb"); - if (file != NULL) - { - unsigned int len = GetFileLen(file); - char* data = new char[len + 1]; - fread(data, 1, len, file); - data[len] = '\0'; - string content = data; - content += "\n"; - delete [] data; - - unsigned int i; - for (i = 0; i < content.size(); i++) - { - if (content[i] == '\r') - content[i] = '\n'; - } - - int n; - while ((n = content.find("\n", 0)) != -1) - { - string line = content.substr(0, n); - line = TrimString(line); - if (line != "") - vLine.push_back(line); - content = content.substr(n + 1); - } - - fclose(file); - } - else - return false; - - return true; -} - -bool SeperateString(string s, string sSeperator, vector& vPart) -{ - vPart.clear(); - - unsigned int i; - for (i = 0; i < sSeperator.size(); i++) - { - int n = s.find(sSeperator[i]); - if (n != -1) - { - vPart.push_back(s.substr(0, n)); - s = s.substr(n + 1); - } - else - return false; - } - vPart.push_back(s); - - return true; -} - -string uint64tostr(uint64 n) -{ - char str[32]; - -#ifdef _WIN32 - sprintf(str, "%I64u", n); -#else - sprintf(str, "%llu", n); -#endif - - return str; -} - -string uint64tohexstr(uint64 n) -{ - char str[32]; - -#ifdef _WIN32 - sprintf(str, "%016I64x", n); -#else - sprintf(str, "%016llx", n); -#endif - - return str; -} - -string HexToStr(const unsigned char* pData, int nLen) -{ - string sRet; - int i; - for (i = 0; i < nLen; i++) - { - char szByte[3]; - sprintf(szByte, "%02x", pData[i]); - sRet += szByte; - } - - return sRet; -} - -uint64 GetAvailPhysMemorySize() -{ -#ifdef _WIN32 - MEMORYSTATUS ms; - GlobalMemoryStatus(&ms); - return ms.dwAvailPhys; -#elif defined(BSD) - int mib[2] = { CTL_HW, HW_PHYSMEM }; - uint64 physMem; - //XXX warning size_t isn't portable - size_t len; - len = sizeof(physMem); - sysctl(mib, 2, &physMem, &len, NULL, 0); - return physMem; -#elif defined(__linux__) - struct sysinfo info; - sysinfo(&info); - return ( info.freeram + info.bufferram ) * (unsigned long) info.mem_unit; -#else - return 0; - #error Unsupported Operating System -#endif -} - -void ParseHash(string sHash, unsigned char* pHash, int& nHashLen) -{ - UINT4 i; - for (i = 0; i < sHash.size() / 2; i++) - { - string sSub = sHash.substr(i * 2, 2); - int nValue; - sscanf(sSub.c_str(), "%02x", &nValue); - pHash[i] = (unsigned char)nValue; - } - - nHashLen = sHash.size() / 2; -} - -void Logo() -{ - printf("RainbowCrack (improved) 2.0 - Making a Faster Cryptanalytic Time-Memory Trade-Off\n"); - printf("by Martin Westergaard \n"); - printf("http://www.freerainbowtables.com/\n"); - printf("original code by Zhu Shuanglei \n"); - printf("http://www.antsight.com/zsl/rainbowcrack/\n\n"); -} - -// XXX nmap is GPL2, will check newer releases regarding license -// Code comes from nmap, used for the linux implementation of kbhit() -#ifndef _WIN32 - -static int tty_fd = 0; -struct termios saved_ti; - -int tty_getchar() -{ - int c, numChars; - - if (tty_fd && tcgetpgrp(tty_fd) == getpid()) { - c = 0; - numChars = read(tty_fd, &c, 1); - if (numChars > 0) return c; - } - - return -1; -} - -void tty_done() -{ - if (!tty_fd) return; - - tcsetattr(tty_fd, TCSANOW, &saved_ti); - - close(tty_fd); - tty_fd = 0; -} - -void tty_init() -{ - struct termios ti; - - if (tty_fd) - return; - - if ((tty_fd = open("/dev/tty", O_RDONLY | O_NONBLOCK)) < 0) return; - - tcgetattr(tty_fd, &ti); - saved_ti = ti; - ti.c_lflag &= ~(ICANON | ECHO); - ti.c_cc[VMIN] = 1; - ti.c_cc[VTIME] = 0; - tcsetattr(tty_fd, TCSANOW, &ti); - - atexit(tty_done); -} - -void tty_flush(void) -{ - tcflush(tty_fd, TCIFLUSH); -} -// end nmap code -#endif diff --git a/Client Applications/converti2/Public.h b/Client Applications/converti2/Public.h deleted file mode 100644 index 6c15430..0000000 --- a/Client Applications/converti2/Public.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * freerainbowtables is a project for generating, distributing, and using - * perfect rainbow tables - * - * Copyright (C) Zhu Shuanglei - * Copyright 2009, 2010 Daniël Niggebrugge - * Copyright 2009, 2010 James Nobis - * - * This file is part of freerainbowtables. - * - * freerainbowtables 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. - * - * freerainbowtables 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 freerainbowtables. If not, see . - */ - -#ifndef _PUBLIC_H -#define _PUBLIC_H - -#include - -#include -#include -#include - -#include "global.h" - -using namespace std; - -struct RainbowChain -{ - uint64 nIndexS; - uint64 nIndexE; -}; - -struct RainbowChainCP -{ - uint64 nIndexS; - uint64 nIndexE; - unsigned short nCheckPoint; -}; -struct IndexChain -{ - uint64 nPrefix; - int nFirstChain; - unsigned int nChainCount; -}; -struct FoundRainbowChain -{ - uint64 nIndexS; - int nIndexE; - int nCheckPoint; - int nGuessedPos; -}; -struct ChainCheckChain -{ - uint64 nIndexS; - int nGuessedPos; -}; -struct IndexRow -{ - uint64 prefix; - unsigned int prefixstart, numchains; -}; - -typedef struct -{ - string sName; - int nPlainLenMin; - int nPlainLenMax; -} tCharset; - -#define MAX_PLAIN_LEN 256 -#define MIN_HASH_LEN 8 -#define MAX_HASH_LEN 256 -#define MAX_SALT_LEN 256 - -// XXX nmap is GPL2, will check newer releases regarding license -// Code comes from nmap, used for the linux implementation of kbhit() -#ifndef _WIN32 -#include -#include -#include - -int tty_getchar(); -void tty_done(); -void tty_init(); -void tty_flush(void); -// end nmap code - -#endif - -unsigned int GetFileLen(FILE* file); -string TrimString(string s); -bool ReadLinesFromFile(string sPathName, vector& vLine); -bool SeperateString(string s, string sSeperator, vector& vPart); -string uint64tostr(uint64 n); -string uint64tohexstr(uint64 n); -string HexToStr(const unsigned char* pData, int nLen); -uint64 GetAvailPhysMemorySize(); -void ParseHash(string sHash, unsigned char* pHash, int& nHashLen); -bool GetHybridCharsets(string sCharset, vector& vCharset); -void Logo(); - -#endif diff --git a/Client Applications/converti2/converti2.cpp b/Client Applications/converti2/converti2.cpp old mode 100644 new mode 100755 index db703e9..da728c3 --- a/Client Applications/converti2/converti2.cpp +++ b/Client Applications/converti2/converti2.cpp @@ -14,9 +14,11 @@ #include #include #include - +#include #include "Public.h" #include "MemoryPool.h" +#include "RTIReader.h" +#include "RTReader.h" using namespace std; @@ -246,13 +248,10 @@ void GetTableList(string sWildCharPathName, vector& vPathName) _finddata_t fd; long handle = _findfirst(sWildCharPathName.c_str(), &fd); - if (handle != -1) - { - do - { + if (handle != -1) { + do { string sName = fd.name; - if (sName != "." && sName != ".." && !(fd.attrib & _A_SUBDIR)) - { + if (sName != "." && sName != ".." && !(fd.attrib & _A_SUBDIR)) { string sPathName = sPath + sName; vPathName.push_back(sPathName); } @@ -290,108 +289,93 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, unsigned int int nIndex = sPathName.find_last_of('/'); #endif string sFileName; - if (nIndex != -1) + if (nIndex != -1) { sFileName = sPathName.substr(nIndex + 1); - else + } + else { sFileName = sPathName; - // Info - printf("%s:\n", sFileName.c_str()); - FILE* file = fopen(sPathName.c_str(), "rb"); - FILE* fileR = fopen(sResultFileName.c_str(), "wb"); + } unsigned int distribution[64] = {0}; unsigned int numProcessedChains = 0; - - if (file != NULL && fileR != NULL) - { + FILE* fileR; + BaseRTReader *reader = NULL; + if(sPathName.substr(sPathName.length() - 2, sPathName.length()) == "rt") + reader = (BaseRTReader*)new RTReader(sPathName); + else if(sPathName.substr(sPathName.length() - 3, sPathName.length()) == "rti") + reader = (BaseRTReader*)new RTIReader(sPathName); + if(reader == NULL) { + printf("%s is not a supported file (Only RT and RTI is supported)\n", sPathName.c_str()); + return; + } + // Info + printf("%s:\n", sFileName.c_str()); + if(showDistribution == 0) { + fileR = fopen(sResultFileName.c_str(), "wb"); + } + if (fileR != NULL || showDistribution == 1) { // File length check - UINT4 nFileLen = GetFileLen(file); - UINT4 nTotalChainCount = 0; - if(hascp == 0) nTotalChainCount = nFileLen / 16; - else nTotalChainCount = nFileLen / 18; - if ((hascp == 0 && nFileLen % 16 != 0) || (hascp == 1 && nFileLen % 18 != 0)) - { - printf("file length mismatch\n"); - } - else - { + + int size = reader->GetChainsLeft() * sizeof(RainbowChain); static CMemoryPool mp; unsigned int nAllocatedSize; - RainbowChainCP* pChain = (RainbowChainCP*)mp.Allocate(nFileLen, nAllocatedSize); - - unsigned int chainrowsize = ceil((float)(rti_startptlength + rti_endptlength + rti_cplength) / 8) * 8 ; // The size in bits (in whole bytes) + RainbowChain* pChain = (RainbowChain*)mp.Allocate(size, nAllocatedSize); + uint32 chainrowsize = (uint32)ceil((float)(rti_startptlength + rti_endptlength + rti_cplength) / 8) * 8 ; // The size in bits (in whole bytes) unsigned int chainrowsizebytes = chainrowsize / 8; - - if (pChain != NULL) - { - nAllocatedSize = nAllocatedSize / sizeof(RainbowChainCP) * sizeof(RainbowChainCP); - fseek(file, 0, SEEK_SET); + if (pChain != NULL) { + nAllocatedSize = nAllocatedSize / sizeof(RainbowChain) * sizeof(RainbowChain); + unsigned int nChains = nAllocatedSize / sizeof(RainbowChain); uint64 curPrefix = 0, prefixStart = 0; vector indexes; - UINT4 nRainbowChainCountRead = 0; - while (true) // Chunk read loop - { + unsigned int chainsLeft; + while((chainsLeft = reader->GetChainsLeft()) > 0) { + /* if (ftell(file) == nFileLen) break;*/ - UINT4 nReadThisRound; - memset(pChain, 0x00, nAllocatedSize); - printf("reading...\n"); + printf("%u chains left to read\n", chainsLeft); + //int nReadThisRound; clock_t t1 = clock(); - for(nReadThisRound = 0; nReadThisRound < nAllocatedSize / sizeof(RainbowChainCP) && nRainbowChainCountRead < nTotalChainCount; nReadThisRound++) - { - if(fread(&pChain[nReadThisRound], 16, 1, file) != 1) - { - printf("Error reading file\n"); exit(1); - } - if(hascp == 1) - { - if(fread(&pChain[nReadThisRound].nCheckPoint, 2, 1, file) != 1) - { - printf("Error reading file\n"); exit(2); - } - } - nRainbowChainCountRead++; - } + printf("reading...\n"); +#ifdef _MEMORYDEBUG + printf("Grabbing %i chains from file\n", nChains); +#endif + reader->ReadChains(nChains, pChain); +#ifdef _MEMORYDEBUG + printf("Recieved %i chains from file\n", nChains); +#endif clock_t t2 = clock(); float fTime = 1.0f * (t2 - t1) / CLOCKS_PER_SEC; - int nDataRead = nRainbowChainCountRead * 16; - if(hascp == 1) nDataRead += nRainbowChainCountRead * 2; // Add the index readings too - printf("%u bytes read, disk access time: %.2f s\n", nDataRead , fTime); + printf("reading time: %.2f s\n", fTime); + printf("converting %i chains...\n", nChains); t1 = clock(); - - for(UINT4 i = 0; i < nReadThisRound; i++) - { - if(showDistribution == 1) - { + for(unsigned int i = 0; i < nChains; i++) { + if(showDistribution == 1) { distribution[GetMaxBits(pChain[i].nIndexS)-1]++; } else { uint64 chainrow = pChain[i].nIndexS; // Insert the complete start point chainrow |= ((uint64)pChain[i].nIndexE & (0xffffffff >> (32 - rti_endptlength))) << rti_startptlength; // - if(hascp == 1 && rti_cplength > 0) - { +/* if(hascp == 1 && rti_cplength > 0) { chainrow |= (uint64)pChain[i].nCheckPoint << rti_startptlength + rti_endptlength; - } + }*/ fwrite(&chainrow, 1, chainrowsizebytes, fileR); uint64 prefix = pChain[i].nIndexE >> rti_endptlength; if(i == 0) curPrefix = prefix; - if(prefix != curPrefix && numProcessedChains - prefixStart > 0) - { - if(prefix < curPrefix) - { - printf("**** Error writeChain(): Prefix is smaller than previous prefix. %llu < %llu****\n", prefix, curPrefix); - exit(1); - } - //unsigned char index[11] = {0}; // [0 - 10] - unsigned int numchains = numProcessedChains - prefixStart; - IndexRow index; - index.prefix = curPrefix; + if(prefix != curPrefix && numProcessedChains - prefixStart > 0) { + if(prefix < curPrefix) { + printf("**** Error writeChain(): Prefix is smaller than previous prefix. %llu < %llu****\n", prefix, curPrefix); + exit(1); + } + //unsigned char index[11] = {0}; // [0 - 10] + unsigned int numchains = numProcessedChains - prefixStart; + IndexRow index; + index.prefix = curPrefix; // index.prefixstart = prefixStart; - index.numchains = numchains; - indexes.push_back(index); - prefixStart = numProcessedChains; - curPrefix = prefix; + index.numchains = numchains; + indexes.push_back(index); + prefixStart = numProcessedChains; + curPrefix = prefix; } } numProcessedChains++; @@ -399,14 +383,11 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, unsigned int t2 = clock(); fTime = 1.0f * (t2 - t1) / CLOCKS_PER_SEC; printf("conversion time: %.2f s\n", fTime); - if(nRainbowChainCountRead == nTotalChainCount) - break; - if(showDistribution == 1) - { - for(int i = 0; i < 64; i++) - { + if(showDistribution == 1) { + for(int i = 0; i < 64; i++) { printf("%u - %u\n", (i+1), distribution[i]); } + delete reader; return; } @@ -436,7 +417,7 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, unsigned int // unsigned int m_rti_index_prefixlength = GetMaxBits(high.prefix); unsigned int m_rti_index_numchainslength = GetMaxBits(high.numchains); // unsigned int m_rti_index_indexlength = GetMaxBits(high.prefixstart); - unsigned int m_indexrowsize = ceil((float)(/*m_rti_index_indexlength + */m_rti_index_numchainslength) / 8) * 8; // The size in bits (in whole bytes) + uint32 m_indexrowsize = (uint32)ceil((float)(/*m_rti_index_indexlength + */m_rti_index_numchainslength) / 8) * 8; // The size in bits (in whole bytes) unsigned int m_indexrowsizebytes = m_indexrowsize / 8; FILE *pFileIndex = fopen(sResultFileName.append(".index").c_str(), "wb"); fwrite("RTI2", 1, 4, pFileIndex); @@ -444,29 +425,29 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, unsigned int fwrite(&rti_endptlength, 1, 1, pFileIndex); fwrite(&rti_cplength, 1, 1, pFileIndex); // fwrite(&m_rti_index_indexlength , 1, 1, pFileIndex); + fwrite(&m_rti_index_numchainslength, 1, 1, pFileIndex); - for(UINT4 i = 0; i < rti_cppos.size(); i++) - { + for(UINT4 i = 0; i < rti_cppos.size(); i++) { fwrite(&rti_cppos[i], 1, 4, pFileIndex); // The position of the checkpoints } // fwrite(&m_rti_index_prefixlength, 1, 1, pFileIndex); int zero = 0; fwrite(&indexes[0].prefix, 1, 8, pFileIndex); // Write the first prefix unsigned int lastPrefix = 0; - for(UINT4 i = 0; i < indexes.size(); i++) - { - if(i == 0) + for(UINT4 i = 0; i < indexes.size(); i++) { + if(i == 0) { lastPrefix = indexes[0].prefix; + } + //unsigned int indexrow = 0; // Checks how big a distance there is between the current and the next prefix. eg cur is 3 and next is 10 = 7. unsigned int diffSize = indexes[i].prefix - lastPrefix; - if(i > 0 && diffSize > 1) - { + if(i > 0 && diffSize > 1) { //indexrow |= indexes[i].prefixstart; //printf("Diffsize is %u\n", diffSize); // then write the distance amount of 00's if(diffSize > 1000) { - printf("WARNING! The distance to the next prefix is %i. Do you want to continue writing %i bytes of 0x00? Press y to continue", diffSize, diffSize); + printf("WARNING! The distance to the next prefix is %i. Do you want to continue writing %i bytes of 0x00? Press y to continue", diffSize, (diffSize*m_indexrowsizebytes)); #ifdef _WIN32 if ( _getch() != 'y' ) { #else @@ -486,17 +467,20 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, unsigned int } fclose(pFileIndex); } - else printf("memory allocation fail\n"); - - - // Already finished? - - } - fclose(file); + else { + printf("memory allocation fail\n"); + } + // Already finished? } - else + else { printf("can't open file\n"); - + } + if(reader != NULL) + delete reader; + if(fileR != NULL) { + fclose(fileR); + } + } int main(int argc, char* argv[]) @@ -507,76 +491,63 @@ int main(int argc, char* argv[]) int usecp = 0;// How many bits to use from the index int hascp = 0; vector cppositions; - if (argc == 1) - { + if (argc == 1) { Usage(); return 0; } - else if(argc > 2) - { + else if(argc > 2) { for (; argi < argc; argi++) { - if (strcmp(argv[argi], "-d") == 0 && (argsUsed & 0x8) == 0) - { + if(strcmp(argv[argi], "-d") == 0 && (argsUsed & 0x8) == 0) { // Enable verbose mode argsUsed |= 0x8; showDistribution = 1; } - else if (strncmp(argv[argi], "-sptl=", 6) == 0 && (argsUsed & 0x1) == 0) - { + else if (strncmp(argv[argi], "-sptl=", 6) == 0 && (argsUsed & 0x1) == 0) { // Maximum index for starting point argsUsed |= 0x1; sptl = 0; - for (i = 6; argv[argi][i] >= '0' && argv[argi][i] <= '9'; i++) - { + for (i = 6; argv[argi][i] >= '0' && argv[argi][i] <= '9'; i++) { sptl *= 10; sptl += ((int) argv[argi][i]) - 0x30; } - if (argv[argi][i] != '\0') - { + if (argv[argi][i] != '\0') { printf("Error: Invalid number.\n\n"); Usage(); return 1; } - if (i > 23) // i - 3 > 20 - { + if (i > 23) { // i - 3 > 20 printf("Error: Number is too large.\n\n"); Usage(); return 1; } } - else if (strncmp(argv[argi], "-eptl=", 6) == 0 && (argsUsed & 0x2) == 0) - { + else if (strncmp(argv[argi], "-eptl=", 6) == 0 && (argsUsed & 0x2) == 0) { // Maximum index for ending points argsUsed |= 0x2; eptl = 0; - for (i = 6; argv[argi][i] >= '0' && argv[argi][i] <= '9'; i++) - { + for (i = 6; argv[argi][i] >= '0' && argv[argi][i] <= '9'; i++) { eptl *= 10; eptl += ((int) argv[argi][i]) - 0x30; } - if (argv[argi][i] != '\0') - { + if (argv[argi][i] != '\0') { printf("Error: Invalid number.\n\n"); Usage(); return 1; } - if (i > 23) // i - 3 > 20 - { + if (i > 23) { // i - 3 > 20 printf("Error: Number is too large.\n\n"); Usage(); return 1; } } - else if(strncmp(argv[argi], "-usecp=", 7) == 0 && (argsUsed & 0x4) == 0) - { + else if(strncmp(argv[argi], "-usecp=", 7) == 0 && (argsUsed & 0x4) == 0) { argsUsed |= 0x4; hascp = 1; usecp = 0; unsigned int cppos = 0; - for(i = 7; argv[argi][i] != ' ' && argv[argi][i] != '\n' && argv[argi][i] != 0;) - { + for(i = 7; argv[argi][i] != ' ' && argv[argi][i] != '\n' && argv[argi][i] != 0;) { if(cppositions.size() > 0) i++; for (; argv[argi][i] >= '0' && argv[argi][i] <= '9'; i++) { @@ -590,19 +561,19 @@ int main(int argc, char* argv[]) cppos = 0; //} } - if (argv[argi][i] != '\0') - { + if (argv[argi][i] != '\0') { printf("Error: Invalid number.\n\n"); Usage(); return 1; } - if (usecp > 16) // i - 3 > 20 - { + if (usecp > 16) { // i - 3 > 20 printf("Error: Number is too large.\n\n"); Usage(); return 1; } - else printf("Using %i bits of the checkpoints\n", usecp); + else { + printf("Using %i bits of the checkpoints\n", usecp); + } } } @@ -614,22 +585,32 @@ int main(int argc, char* argv[]) #else GetTableList(argc, argv, vPathName); #endif - if (vPathName.size() == 0) - { + if (vPathName.size() == 0) { printf("no rainbow table found\n"); return 0; } - for (UINT4 i = 0; i < vPathName.size(); i++) - { + for (UINT4 i = 0; i < vPathName.size(); i++) { string sResultFile; int n = vPathName[i].find_last_of('\\'); - if (n != -1) - sResultFile = vPathName[i].substr(n+1, vPathName[i].length()) + "i2"; - else - sResultFile = vPathName[i] + "i2"; // Resulting file is .rt, not .rti - printf("Using %i of 64 bits. sptl: %i, eptl: %i, cp: %i. Chains will be %i bytes in size\n", (sptl + eptl + usecp), sptl, eptl, usecp, ((sptl + eptl + usecp) / 8)); - if(sptl + eptl + usecp > 64) - { + if (n != -1) { + if(vPathName[i].substr(vPathName[i].length() - 3, vPathName[i].length()) == "rti") { + sResultFile = vPathName[i].substr(n+1, vPathName[i].length()) + "2"; + } + else { + sResultFile = vPathName[i].substr(n+1, vPathName[i].length()) + "i2"; + } + } + else { + if(vPathName[i].substr(vPathName[i].length() - 3, vPathName[i].length()) == "rti") { + sResultFile = vPathName[i] + "2"; + } else { + sResultFile = vPathName[i] + "i2"; // Resulting file is .rt, not .rti + } + } + if(usecp == 0 && showDistribution == 0) { + printf("Using %i of 64 bits. sptl: %i, eptl: %i, cp: %i. Chains will be %i bytes in size\n", (sptl + eptl + usecp), sptl, eptl, usecp, ((sptl + eptl + usecp) / 8)); + } + if(sptl + eptl + usecp > 64) { exit(1); } ConvertRainbowTable(vPathName[i], sResultFile, sptl, eptl, showDistribution, hascp, usecp, cppositions); diff --git a/Client Applications/converti2/converti2.sln b/Client Applications/converti2/converti2.sln deleted file mode 100644 index d4e3874..0000000 --- a/Client Applications/converti2/converti2.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "converti2", "converti2.vcproj", "{066FD6F1-5990-47AD-B095-7AE0029CF5AE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rcracki_mt", "..\rcracki_mt\rcracki_mt.vcproj", "{D484ABA1-C117-4AB1-B361-22E5EA62FA00}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {066FD6F1-5990-47AD-B095-7AE0029CF5AE}.Debug|Win32.ActiveCfg = Debug|Win32 - {066FD6F1-5990-47AD-B095-7AE0029CF5AE}.Debug|Win32.Build.0 = Debug|Win32 - {066FD6F1-5990-47AD-B095-7AE0029CF5AE}.Release|Win32.ActiveCfg = Release|Win32 - {066FD6F1-5990-47AD-B095-7AE0029CF5AE}.Release|Win32.Build.0 = Release|Win32 - {D484ABA1-C117-4AB1-B361-22E5EA62FA00}.Debug|Win32.ActiveCfg = Debug|Win32 - {D484ABA1-C117-4AB1-B361-22E5EA62FA00}.Debug|Win32.Build.0 = Debug|Win32 - {D484ABA1-C117-4AB1-B361-22E5EA62FA00}.Release|Win32.ActiveCfg = Release|Win32 - {D484ABA1-C117-4AB1-B361-22E5EA62FA00}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Client Applications/converti2/converti2.suo b/Client Applications/converti2/converti2.suo old mode 100644 new mode 100755 index d24f654..8a63fa9 Binary files a/Client Applications/converti2/converti2.suo and b/Client Applications/converti2/converti2.suo differ diff --git a/Client Applications/converti2/converti2.vcproj b/Client Applications/converti2/converti2.vcproj deleted file mode 100644 index 0103995..0000000 --- a/Client Applications/converti2/converti2.vcproj +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Client Applications/converti2/converti2.vcxproj b/Client Applications/converti2/converti2.vcxproj new file mode 100644 index 0000000..90f75b9 --- /dev/null +++ b/Client Applications/converti2/converti2.vcxproj @@ -0,0 +1,105 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {066FD6F1-5990-47AD-B095-7AE0029CF5AE} + convertrti2 + Win32Proj + + + + Application + NotSet + true + + + Application + NotSet + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + ../../Common/rt api;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + MaxSpeed + true + ../../Common/rt api;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Client Applications/converti2/converti2.vcxproj.filters b/Client Applications/converti2/converti2.vcxproj.filters new file mode 100644 index 0000000..e0c08d7 --- /dev/null +++ b/Client Applications/converti2/converti2.vcxproj.filters @@ -0,0 +1,54 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/Client Applications/converti2/converti2.vcxproj.user b/Client Applications/converti2/converti2.vcxproj.user new file mode 100644 index 0000000..8e3e8c4 --- /dev/null +++ b/Client Applications/converti2/converti2.vcxproj.user @@ -0,0 +1,7 @@ + + + + C:\Users\mwj\Desktop\tables\*.rti -d + WindowsLocalDebugger + + \ No newline at end of file diff --git a/Client Applications/rcracki_mt/BaseRTReader.h b/Client Applications/rcracki_mt/BaseRTReader.h index 17a93ac..a662ff4 100644 --- a/Client Applications/rcracki_mt/BaseRTReader.h +++ b/Client Applications/rcracki_mt/BaseRTReader.h @@ -37,9 +37,10 @@ using namespace std; class BaseRTReader { public: - virtual int ReadChains(unsigned int &numChains, RainbowChainO *pData) = 0; - virtual unsigned int GetChainsLeft() = 0; + virtual int ReadChains(uint32 &numChains, RainbowChainO *pData) = 0; + virtual uint32 GetChainsLeft() = 0; + virtual ~BaseRTReader() { }; }; #endif diff --git a/Client Applications/rcracki_mt/ChainWalkSet.cpp b/Client Applications/rcracki_mt/ChainWalkSet.cpp index 84db65f..b80b4ab 100644 --- a/Client Applications/rcracki_mt/ChainWalkSet.cpp +++ b/Client Applications/rcracki_mt/ChainWalkSet.cpp @@ -1,324 +1,324 @@ -/* - * 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) -#endif - -#include "ChainWalkSet.h" - -CChainWalkSet::CChainWalkSet() -{ - m_sHashRoutineName = ""; - m_sPlainCharsetName = ""; - m_nPlainLenMin = 0; - m_nPlainLenMax = 0; - m_nRainbowTableIndex = 0; - m_nRainbowChainLen = 0; - debug = false; - sPrecalcPathName = ""; - preCalcPart = 0; -} - -CChainWalkSet::~CChainWalkSet() -{ - DiscardAll(); -} - -void CChainWalkSet::DiscardAll() -{ - //printf("debug: discarding all walk...\n"); - - list::iterator it; - for (it = m_lChainWalk.begin(); it != m_lChainWalk.end(); it++) - delete [] it->pIndexE; - m_lChainWalk.clear(); -} - -string CChainWalkSet::CheckOrRotatePreCalcFile() -{ - char sPreCalcFileName[255]; - - // 255 files limit to be sure - for (; preCalcPart < 255; preCalcPart++) - { - sprintf(sPreCalcFileName, "%s.%d", sPrecalcPathName.c_str(), preCalcPart); - string sReturnPreCalcPath(sPreCalcFileName); - - unsigned int fileLen = 0; - - FILE* file = fopen(sReturnPreCalcPath.c_str(), "ab"); - if(file!=NULL) - { - fileLen = GetFileLen(file); - long unsigned int nextFileLen = fileLen + (sizeof(uint64) * (m_nRainbowChainLen-1)); - // Rotate to next file if we are going to pass 2GB filesize - if (nextFileLen < ((unsigned)2 * 1024 * 1024 * 1024)) - { - // We might want to vPrecalcFiles.push_back(sReturnPreCalcPath) if we just created this file - // We don't as only newly generated chainwalksets will be stored to this new file, so we don't have to look there - if (debug) printf("Debug: Using for precalc: %s\n", sReturnPreCalcPath.c_str()); - fclose(file); - return sReturnPreCalcPath; - } - fclose(file); - } - } - - return string(""); -} - -void CChainWalkSet::updateUsedPrecalcFiles() -{ - // we might also use this function to search a wildcard path of precalc files - vPrecalcFiles.clear(); - char sPreCalcFileName[255]; - - int i; - // 255 files max - for (i = 0; i < 255; i++) - { - sprintf(sPreCalcFileName, "%s.%d", sPrecalcPathName.c_str(), i); - string sTryPreCalcPath(sPreCalcFileName); - FILE* file = fopen(sTryPreCalcPath.c_str(), "rb"); - if(file!=NULL) { - vPrecalcFiles.push_back(sTryPreCalcPath); - fclose(file); - } - else { - break; - } - } -} - -void CChainWalkSet::removePrecalcFiles() -{ - if (debug) printf("Debug: Removing precalc files.\n"); - updateUsedPrecalcFiles(); - string sCurrentPrecalcPathName = ""; - string sCurrentPrecalcIndexPathName = ""; - - int i; - for (i = 0; i < (int)vPrecalcFiles.size(); i++) - { - sCurrentPrecalcPathName = vPrecalcFiles[i]; - sCurrentPrecalcIndexPathName = sCurrentPrecalcPathName + ".index"; - - if (debug) printf("Debug: Removing precalc file: %s\n", sCurrentPrecalcPathName.c_str()); - - if (remove(sCurrentPrecalcPathName.c_str()) != 0) - if (debug) printf("Debug: Failed removing precalc file: %s\n", sCurrentPrecalcPathName.c_str()); - - if (debug) printf("Debug: Removing precalc index file: %s\n", sCurrentPrecalcIndexPathName.c_str()); - - if (remove(sCurrentPrecalcIndexPathName.c_str()) != 0) - if (debug) printf("Debug: Failed removing precalc index file: %s\n", sCurrentPrecalcIndexPathName.c_str()); - - } -} - -bool CChainWalkSet::FindInFile(uint64* pIndexE, unsigned char* pHash, int nHashLen) -{ - int gotPrecalcOnLine = -1; - char precalculationLine[255]; - sprintf(precalculationLine, "%s_%s#%d-%d_%d_%d:%s\n", m_sHashRoutineName.c_str(), m_sPlainCharsetName.c_str(), m_nPlainLenMin, m_nPlainLenMax, m_nRainbowTableIndex, m_nRainbowChainLen, HexToStr(pHash, nHashLen).c_str() ); - string precalcString(precalculationLine); - - string sCurrentPrecalcPathName = ""; - string sCurrentPrecalcIndexPathName = ""; - long unsigned int offset; - - int i; - for (i = 0; i < (int)vPrecalcFiles.size() && gotPrecalcOnLine == -1; i++) - { - sCurrentPrecalcPathName = vPrecalcFiles[i]; - sCurrentPrecalcIndexPathName = sCurrentPrecalcPathName + ".index"; - - offset = 0; - - vector precalcLines; - if (ReadLinesFromFile(sCurrentPrecalcIndexPathName.c_str(), precalcLines)) - { - int j; - for (j = 0; j < (int)precalcLines.size(); j++) - { - if (precalcString.compare(0, precalcString.size()-1, precalcLines[j]) == 0) - { - gotPrecalcOnLine = j; - break; - } - - // Parse - vector vPart; - if (SeperateString(precalcLines[j], "___:", vPart)) - { - // add to offset - offset += ((atoi(vPart[3].c_str())-1) * sizeof(uint64)); - } - else { - // corrupt file - printf("Corrupted precalculation file!\n"); - gotPrecalcOnLine = -1; - break; - } - } - } - } - - if (gotPrecalcOnLine > -1) - { - if (debug) printf("Debug: Reading pre calculations from file, line %d offset %lu\n", gotPrecalcOnLine, offset); - - FILE* fp = fopen(sCurrentPrecalcPathName.c_str(), "rb"); - - if (fp!=NULL) { - fseek(fp, offset, SEEK_SET); - - // We should do some verification here, for example by recalculating the middle chain, to catch corrupted files - if(fread(pIndexE, sizeof(uint64), (unsigned long)m_nRainbowChainLen-1, fp) != (unsigned long)m_nRainbowChainLen-1) - printf("File read error."); - fclose(fp); - } - else - printf("Cannot open precalculation file %s.\n", sCurrentPrecalcPathName.c_str()); - - //printf("\npIndexE[0]: %s\n", uint64tostr(pIndexE[0]).c_str()); - //printf("\npIndexE[nRainbowChainLen-2]: %s\n", uint64tostr(pIndexE[m_nRainbowChainLen-2]).c_str()); - - return true; - } - - return false; -} - -void CChainWalkSet::StoreToFile(uint64* pIndexE, unsigned char* pHash, int nHashLen) -{ - if (debug) printf("\nDebug: Storing precalc\n"); - - string sCurrentPrecalcPathName = CheckOrRotatePreCalcFile(); - string sCurrentPrecalcIndexPathName = sCurrentPrecalcPathName + ".index"; - - FILE* fp = fopen(sCurrentPrecalcPathName.c_str(), "ab"); - if(fp!=NULL) - { - if(fwrite(pIndexE, sizeof(uint64), (unsigned long)m_nRainbowChainLen-1, fp) != (unsigned long)m_nRainbowChainLen-1) - printf("File write error."); - else - { - FILE* file = fopen(sCurrentPrecalcIndexPathName.c_str(), "a"); - if (file!=NULL) - { - char precalculationLine[255]; - sprintf(precalculationLine, "%s_%s#%d-%d_%d_%d:%s\n", m_sHashRoutineName.c_str(), m_sPlainCharsetName.c_str(), m_nPlainLenMin, m_nPlainLenMax, m_nRainbowTableIndex, m_nRainbowChainLen, HexToStr(pHash, nHashLen).c_str() ); - fputs (precalculationLine, file); - fclose (file); - } - } - fclose(fp); - } - else - printf("Cannot open precalculation file %s\n", sCurrentPrecalcPathName.c_str()); -} - -uint64* CChainWalkSet::RequestWalk(unsigned char* pHash, int nHashLen, - string sHashRoutineName, - string sPlainCharsetName, int nPlainLenMin, int nPlainLenMax, - int nRainbowTableIndex, - int nRainbowChainLen, - bool& fNewlyGenerated, - bool setDebug, - string sPrecalc) -{ - debug = setDebug; - sPrecalcPathName = sPrecalc; - - if ( m_sHashRoutineName != sHashRoutineName - || m_sPlainCharsetName != sPlainCharsetName - || m_nPlainLenMin != nPlainLenMin - || m_nPlainLenMax != nPlainLenMax - || m_nRainbowTableIndex != nRainbowTableIndex - || m_nRainbowChainLen != nRainbowChainLen) - { - DiscardAll(); - - m_sHashRoutineName = sHashRoutineName; - m_sPlainCharsetName = sPlainCharsetName; - m_nPlainLenMin = nPlainLenMin; - m_nPlainLenMax = nPlainLenMax; - m_nRainbowTableIndex = nRainbowTableIndex; - m_nRainbowChainLen = nRainbowChainLen; - - ChainWalk cw; - memcpy(cw.Hash, pHash, nHashLen); - cw.pIndexE = new uint64[nRainbowChainLen - 1]; - m_lChainWalk.push_back(cw); - - // Only update this list when we search through another rainbow table - updateUsedPrecalcFiles(); - - if (!FindInFile(cw.pIndexE, pHash, nHashLen)) - fNewlyGenerated = true; - else - fNewlyGenerated = false; - return cw.pIndexE; - } - - list::iterator it; - for (it = m_lChainWalk.begin(); it != m_lChainWalk.end(); it++) - { - if (memcmp(it->Hash, pHash, nHashLen) == 0) - { - fNewlyGenerated = false; - return it->pIndexE; - } - } - - ChainWalk cw; - memcpy(cw.Hash, pHash, nHashLen); - cw.pIndexE = new uint64[nRainbowChainLen - 1]; - m_lChainWalk.push_back(cw); - - if (!FindInFile(cw.pIndexE, pHash, nHashLen)) - fNewlyGenerated = true; - else - fNewlyGenerated = false; - return cw.pIndexE; -} - -void CChainWalkSet::DiscardWalk(uint64* pIndexE) -{ - list::iterator it; - for (it = m_lChainWalk.begin(); it != m_lChainWalk.end(); it++) - { - if (it->pIndexE == pIndexE) - { - delete it->pIndexE; - m_lChainWalk.erase(it); - return; - } - } - - printf("debug: pIndexE not found\n"); -} +/* + * 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) +#endif + +#include "ChainWalkSet.h" + +CChainWalkSet::CChainWalkSet() +{ + m_sHashRoutineName = ""; + m_sPlainCharsetName = ""; + m_nPlainLenMin = 0; + m_nPlainLenMax = 0; + m_nRainbowTableIndex = 0; + m_nRainbowChainLen = 0; + debug = false; + sPrecalcPathName = ""; + preCalcPart = 0; +} + +CChainWalkSet::~CChainWalkSet() +{ + DiscardAll(); +} + +void CChainWalkSet::DiscardAll() +{ + //printf("debug: discarding all walk...\n"); + + list::iterator it; + for (it = m_lChainWalk.begin(); it != m_lChainWalk.end(); it++) + delete [] it->pIndexE; + m_lChainWalk.clear(); +} + +string CChainWalkSet::CheckOrRotatePreCalcFile() +{ + char sPreCalcFileName[255]; + + // 255 files limit to be sure + for (; preCalcPart < 255; preCalcPart++) + { + sprintf(sPreCalcFileName, "%s.%d", sPrecalcPathName.c_str(), preCalcPart); + string sReturnPreCalcPath(sPreCalcFileName); + + long fileLen = 0; + + FILE* file = fopen(sReturnPreCalcPath.c_str(), "ab"); + if(file!=NULL) + { + fileLen = GetFileLen(file); + long unsigned int nextFileLen = fileLen + (sizeof(uint64) * (m_nRainbowChainLen-1)); + // Rotate to next file if we are going to pass 2GB filesize + if (nextFileLen < ((unsigned)2 * 1024 * 1024 * 1024)) + { + // We might want to vPrecalcFiles.push_back(sReturnPreCalcPath) if we just created this file + // We don't as only newly generated chainwalksets will be stored to this new file, so we don't have to look there + if (debug) printf("Debug: Using for precalc: %s\n", sReturnPreCalcPath.c_str()); + fclose(file); + return sReturnPreCalcPath; + } + fclose(file); + } + } + + return string(""); +} + +void CChainWalkSet::updateUsedPrecalcFiles() +{ + // we might also use this function to search a wildcard path of precalc files + vPrecalcFiles.clear(); + char sPreCalcFileName[255]; + + int i; + // 255 files max + for (i = 0; i < 255; i++) + { + sprintf(sPreCalcFileName, "%s.%d", sPrecalcPathName.c_str(), i); + string sTryPreCalcPath(sPreCalcFileName); + FILE* file = fopen(sTryPreCalcPath.c_str(), "rb"); + if(file!=NULL) { + vPrecalcFiles.push_back(sTryPreCalcPath); + fclose(file); + } + else { + break; + } + } +} + +void CChainWalkSet::removePrecalcFiles() +{ + if (debug) printf("Debug: Removing precalc files.\n"); + updateUsedPrecalcFiles(); + string sCurrentPrecalcPathName = ""; + string sCurrentPrecalcIndexPathName = ""; + + int i; + for (i = 0; i < (int)vPrecalcFiles.size(); i++) + { + sCurrentPrecalcPathName = vPrecalcFiles[i]; + sCurrentPrecalcIndexPathName = sCurrentPrecalcPathName + ".index"; + + if (debug) printf("Debug: Removing precalc file: %s\n", sCurrentPrecalcPathName.c_str()); + + if (remove(sCurrentPrecalcPathName.c_str()) != 0) + if (debug) printf("Debug: Failed removing precalc file: %s\n", sCurrentPrecalcPathName.c_str()); + + if (debug) printf("Debug: Removing precalc index file: %s\n", sCurrentPrecalcIndexPathName.c_str()); + + if (remove(sCurrentPrecalcIndexPathName.c_str()) != 0) + if (debug) printf("Debug: Failed removing precalc index file: %s\n", sCurrentPrecalcIndexPathName.c_str()); + + } +} + +bool CChainWalkSet::FindInFile(uint64* pIndexE, unsigned char* pHash, int nHashLen) +{ + int gotPrecalcOnLine = -1; + char precalculationLine[255]; + sprintf(precalculationLine, "%s_%s#%d-%d_%d_%d:%s\n", m_sHashRoutineName.c_str(), m_sPlainCharsetName.c_str(), m_nPlainLenMin, m_nPlainLenMax, m_nRainbowTableIndex, m_nRainbowChainLen, HexToStr(pHash, nHashLen).c_str() ); + string precalcString(precalculationLine); + + string sCurrentPrecalcPathName = ""; + string sCurrentPrecalcIndexPathName = ""; + long unsigned int offset; + + int i; + for (i = 0; i < (int)vPrecalcFiles.size() && gotPrecalcOnLine == -1; i++) + { + sCurrentPrecalcPathName = vPrecalcFiles[i]; + sCurrentPrecalcIndexPathName = sCurrentPrecalcPathName + ".index"; + + offset = 0; + + vector precalcLines; + if (ReadLinesFromFile(sCurrentPrecalcIndexPathName.c_str(), precalcLines)) + { + int j; + for (j = 0; j < (int)precalcLines.size(); j++) + { + if (precalcString.compare(0, precalcString.size()-1, precalcLines[j]) == 0) + { + gotPrecalcOnLine = j; + break; + } + + // Parse + vector vPart; + if (SeperateString(precalcLines[j], "___:", vPart)) + { + // add to offset + offset += ((atoi(vPart[3].c_str())-1) * sizeof(uint64)); + } + else { + // corrupt file + printf("Corrupted precalculation file!\n"); + gotPrecalcOnLine = -1; + break; + } + } + } + } + + if (gotPrecalcOnLine > -1) + { + if (debug) printf("Debug: Reading pre calculations from file, line %d offset %lu\n", gotPrecalcOnLine, offset); + + FILE* fp = fopen(sCurrentPrecalcPathName.c_str(), "rb"); + + if (fp!=NULL) { + fseek(fp, offset, SEEK_SET); + + // We should do some verification here, for example by recalculating the middle chain, to catch corrupted files + if(fread(pIndexE, sizeof(uint64), (unsigned long)m_nRainbowChainLen-1, fp) != (unsigned long)m_nRainbowChainLen-1) + printf("File read error."); + fclose(fp); + } + else + printf("Cannot open precalculation file %s.\n", sCurrentPrecalcPathName.c_str()); + + //printf("\npIndexE[0]: %s\n", uint64tostr(pIndexE[0]).c_str()); + //printf("\npIndexE[nRainbowChainLen-2]: %s\n", uint64tostr(pIndexE[m_nRainbowChainLen-2]).c_str()); + + return true; + } + + return false; +} + +void CChainWalkSet::StoreToFile(uint64* pIndexE, unsigned char* pHash, int nHashLen) +{ + if (debug) printf("\nDebug: Storing precalc\n"); + + string sCurrentPrecalcPathName = CheckOrRotatePreCalcFile(); + string sCurrentPrecalcIndexPathName = sCurrentPrecalcPathName + ".index"; + + FILE* fp = fopen(sCurrentPrecalcPathName.c_str(), "ab"); + if(fp!=NULL) + { + if(fwrite(pIndexE, sizeof(uint64), (unsigned long)m_nRainbowChainLen-1, fp) != (unsigned long)m_nRainbowChainLen-1) + printf("File write error."); + else + { + FILE* file = fopen(sCurrentPrecalcIndexPathName.c_str(), "a"); + if (file!=NULL) + { + char precalculationLine[255]; + sprintf(precalculationLine, "%s_%s#%d-%d_%d_%d:%s\n", m_sHashRoutineName.c_str(), m_sPlainCharsetName.c_str(), m_nPlainLenMin, m_nPlainLenMax, m_nRainbowTableIndex, m_nRainbowChainLen, HexToStr(pHash, nHashLen).c_str() ); + fputs (precalculationLine, file); + fclose (file); + } + } + fclose(fp); + } + else + printf("Cannot open precalculation file %s\n", sCurrentPrecalcPathName.c_str()); +} + +uint64* CChainWalkSet::RequestWalk(unsigned char* pHash, int nHashLen, + string sHashRoutineName, + string sPlainCharsetName, int nPlainLenMin, int nPlainLenMax, + int nRainbowTableIndex, + int nRainbowChainLen, + bool& fNewlyGenerated, + bool setDebug, + string sPrecalc) +{ + debug = setDebug; + sPrecalcPathName = sPrecalc; + + if ( m_sHashRoutineName != sHashRoutineName + || m_sPlainCharsetName != sPlainCharsetName + || m_nPlainLenMin != nPlainLenMin + || m_nPlainLenMax != nPlainLenMax + || m_nRainbowTableIndex != nRainbowTableIndex + || m_nRainbowChainLen != nRainbowChainLen) + { + DiscardAll(); + + m_sHashRoutineName = sHashRoutineName; + m_sPlainCharsetName = sPlainCharsetName; + m_nPlainLenMin = nPlainLenMin; + m_nPlainLenMax = nPlainLenMax; + m_nRainbowTableIndex = nRainbowTableIndex; + m_nRainbowChainLen = nRainbowChainLen; + + ChainWalk cw; + memcpy(cw.Hash, pHash, nHashLen); + cw.pIndexE = new uint64[nRainbowChainLen - 1]; + m_lChainWalk.push_back(cw); + + // Only update this list when we search through another rainbow table + updateUsedPrecalcFiles(); + + if (!FindInFile(cw.pIndexE, pHash, nHashLen)) + fNewlyGenerated = true; + else + fNewlyGenerated = false; + return cw.pIndexE; + } + + list::iterator it; + for (it = m_lChainWalk.begin(); it != m_lChainWalk.end(); it++) + { + if (memcmp(it->Hash, pHash, nHashLen) == 0) + { + fNewlyGenerated = false; + return it->pIndexE; + } + } + + ChainWalk cw; + memcpy(cw.Hash, pHash, nHashLen); + cw.pIndexE = new uint64[nRainbowChainLen - 1]; + m_lChainWalk.push_back(cw); + + if (!FindInFile(cw.pIndexE, pHash, nHashLen)) + fNewlyGenerated = true; + else + fNewlyGenerated = false; + return cw.pIndexE; +} + +void CChainWalkSet::DiscardWalk(uint64* pIndexE) +{ + list::iterator it; + for (it = m_lChainWalk.begin(); it != m_lChainWalk.end(); it++) + { + if (it->pIndexE == pIndexE) + { + delete it->pIndexE; + m_lChainWalk.erase(it); + return; + } + } + + printf("debug: pIndexE not found\n"); +} diff --git a/Client Applications/rcracki_mt/ChainWalkSet.h b/Client Applications/rcracki_mt/ChainWalkSet.h index 7578007..f402dd8 100644 --- a/Client Applications/rcracki_mt/ChainWalkSet.h +++ b/Client Applications/rcracki_mt/ChainWalkSet.h @@ -1,77 +1,77 @@ -/* - * 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 _CHAINWALKSET_H -#define _CHAINWALKSET_H - -#include "Public.h" - -struct ChainWalk -{ - unsigned char Hash[MAX_HASH_LEN]; - //int nHashLen; // Implied - uint64* pIndexE; // mapStartPosIndexE, Len = nRainbowChainLen - 1 -}; - -class CChainWalkSet -{ -public: - CChainWalkSet(); - virtual ~CChainWalkSet(); - -private: - string m_sHashRoutineName; // Discard all if not match - string m_sPlainCharsetName; // Discard all if not match - int m_nPlainLenMin; // Discard all if not match - int m_nPlainLenMax; // Discard all if not match - int m_nRainbowTableIndex; // Discard all if not match - int m_nRainbowChainLen; // Discard all if not match - list m_lChainWalk; - bool debug; - string sPrecalcPathName; - int preCalcPart; - vector vPrecalcFiles; - -private: - void DiscardAll(); - bool FindInFile(uint64* pIndexE, unsigned char* pHash, int nHashLen); - string CheckOrRotatePreCalcFile(); - void updateUsedPrecalcFiles(); - -public: - uint64* RequestWalk(unsigned char* pHash, int nHashLen, - string sHashRoutineName, - string sPlainCharsetName, int nPlainLenMin, int nPlainLenMax, - int nRainbowTableIndex, - int nRainbowChainLen, - bool& fNewlyGenerated, - bool setDebug, - string sPrecalc); - void DiscardWalk(uint64* pIndexE); - void StoreToFile(uint64* pIndexE, unsigned char* pHash, int nHashLen); - void removePrecalcFiles(); -}; - -#endif +/* + * 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 _CHAINWALKSET_H +#define _CHAINWALKSET_H + +#include "Public.h" + +struct ChainWalk +{ + unsigned char Hash[MAX_HASH_LEN]; + //int nHashLen; // Implied + uint64* pIndexE; // mapStartPosIndexE, Len = nRainbowChainLen - 1 +}; + +class CChainWalkSet +{ +public: + CChainWalkSet(); + virtual ~CChainWalkSet(); + +private: + string m_sHashRoutineName; // Discard all if not match + string m_sPlainCharsetName; // Discard all if not match + int m_nPlainLenMin; // Discard all if not match + int m_nPlainLenMax; // Discard all if not match + int m_nRainbowTableIndex; // Discard all if not match + int m_nRainbowChainLen; // Discard all if not match + list m_lChainWalk; + bool debug; + string sPrecalcPathName; + int preCalcPart; + vector vPrecalcFiles; + +private: + void DiscardAll(); + bool FindInFile(uint64* pIndexE, unsigned char* pHash, int nHashLen); + string CheckOrRotatePreCalcFile(); + void updateUsedPrecalcFiles(); + +public: + uint64* RequestWalk(unsigned char* pHash, int nHashLen, + string sHashRoutineName, + string sPlainCharsetName, int nPlainLenMin, int nPlainLenMax, + int nRainbowTableIndex, + int nRainbowChainLen, + bool& fNewlyGenerated, + bool setDebug, + string sPrecalc); + void DiscardWalk(uint64* pIndexE); + void StoreToFile(uint64* pIndexE, unsigned char* pHash, int nHashLen); + void removePrecalcFiles(); +}; + +#endif diff --git a/Client Applications/rcracki_mt/ChangeLog.txt b/Client Applications/rcracki_mt/ChangeLog.txt index f22f28b..ecebd60 100644 --- a/Client Applications/rcracki_mt/ChangeLog.txt +++ b/Client Applications/rcracki_mt/ChangeLog.txt @@ -1,82 +1,82 @@ -[rcracki_mt ChangeLog] - -0.6.5.1 (25 Oct 2010, 15:50:10): -* rti2 fixes courtesy of PowerBlade - -0.6.5 (24 Oct 2010, 18:21:25): -* code changes to allow building via mingw and avoid VC++ -* linux thread priority set to nice value of 2 -* rti2 support -* replaced clock_t usage with gettimeofday -* add pre-calculation timing per feature request #3025688 from sourceforge -* fix bug #3050821 from sourceforge - missing break for non x86/x86_64 arch -* improve hash performance by moving off openssl to the local faster methods -* sha1 local implementation was *slower* than openssl for x86/x86_64 - -0.6.4 (05 Jul 2010, 03:12): -* add -m to allow users to limit memory usage - courtesy of uroskn -* fix memory code that made incorrect assumptions about the MemoryPool -* fix linux memory code - using only info.freeram is incorrect -* cleanup of the nested if/elif/else stuctures -* annotate x86 specific sections of code -* licensing review and GPLv2 compliance -* cleanup of unused items -* restructure Makefile -* cleanup memory leaks - -0.6.3 (21 Oct 2009, 21:05): -* Fixed x86_64 linux compilation -* Fixed x86_64 linux segmentation fault -* Fixed 64bit support in md4 code -* Added support for: FreeBSD, NetBSD, OpenBSD, and MacOSX - -0.6.2 (2 Jul 2009, 13:37): -* Fixed linux support (tty stuff and now actually compiles) -* Fixed precalculation code - -0.6.1 (14 May 2009, 22:12): -* bug fixed where the list of rainbow tables is doubled when you resume a session and you have default RT locations in your ini - -0.6 (14 May 2009, 20:47): -* Finding .rti files recursively -* Fixed memory allocation bugs (also trying to save appropriate amount of memory for chainwalksets... these can become really large with the new tables) -* Real pause/resume function, you can resume a session with -r -* Session support, use -s session_name. Combine this with -r to resume a session other then the default -* Ini file support, store some default values such as rainbow table directories. -* Tab separated results (stdout) -* Support pause during cracking and 'skip' during unicode correction for Linux -* A readme / 'manual' ! - -0.5 (16 Apr 2009, 22:47): -* Support for the old non-indexed .rt format, it should work with both type of tables in one run... I didn't test this feature thoroughly -* Using some other pieces of code for algorithms -* Support for .lst files from Cain as input (patch from James Dickson) - use for example -c LMNT.lst -* Fixed some bugs -* Dunno anymore, left this version lying around for too long... - -0.4 (oops, a second 0.4) (13 Dec 2008, 18:20): -* Improved file reading performance - -0.4 (27 Nov 2008, 00:09): -* Source included -* Memory usage down to about 50% (tnx sc00bz for pointing out the inefficiency, tnx jci for helping with the code) -* Works under Linux! (using pthreads now instead of Windows threads) -* Speed up: implemented MD4 reference implementation, not using OpenSSL for NTLM anymore (tnx Bitweasil for supplying 98% of the code) -* Speed up: using OpenSSL a lot faster (tnx jci for pointing that out) -* Probably some more small things i forgot - -0.3 (16 Nov 2008, 01:01): -* Improved command line argument parsing (order no longer matters) -* Option to write (temporary) output to a file, use -o pick_a_nice_filename.txt -* Option to pause, press 'P' to pause/unpause (Windows only) -* For pwdump searches: unicode correction is done when case correction fails - -0.2 (28 Oct 2008, 01:42): -* False alarm checking now also multi threaded -* Search one level of subdirectories for rainbow table files - -0.1 (27 Oct 2008, 00:14): -* Initial multithreaded version, using Windows threads. -* Using multiple threads for the pre-calculation part. -* Added a simple 'progress' message, so you can see how many hashes are being pre-calculated - +[rcracki_mt ChangeLog] + +0.6.5.1 (25 Oct 2010, 15:50:10): +* rti2 fixes courtesy of PowerBlade + +0.6.5 (24 Oct 2010, 18:21:25): +* code changes to allow building via mingw and avoid VC++ +* linux thread priority set to nice value of 2 +* rti2 support +* replaced clock_t usage with gettimeofday +* add pre-calculation timing per feature request #3025688 from sourceforge +* fix bug #3050821 from sourceforge - missing break for non x86/x86_64 arch +* improve hash performance by moving off openssl to the local faster methods +* sha1 local implementation was *slower* than openssl for x86/x86_64 + +0.6.4 (05 Jul 2010, 03:12): +* add -m to allow users to limit memory usage - courtesy of uroskn +* fix memory code that made incorrect assumptions about the MemoryPool +* fix linux memory code - using only info.freeram is incorrect +* cleanup of the nested if/elif/else stuctures +* annotate x86 specific sections of code +* licensing review and GPLv2 compliance +* cleanup of unused items +* restructure Makefile +* cleanup memory leaks + +0.6.3 (21 Oct 2009, 21:05): +* Fixed x86_64 linux compilation +* Fixed x86_64 linux segmentation fault +* Fixed 64bit support in md4 code +* Added support for: FreeBSD, NetBSD, OpenBSD, and MacOSX + +0.6.2 (2 Jul 2009, 13:37): +* Fixed linux support (tty stuff and now actually compiles) +* Fixed precalculation code + +0.6.1 (14 May 2009, 22:12): +* bug fixed where the list of rainbow tables is doubled when you resume a session and you have default RT locations in your ini + +0.6 (14 May 2009, 20:47): +* Finding .rti files recursively +* Fixed memory allocation bugs (also trying to save appropriate amount of memory for chainwalksets... these can become really large with the new tables) +* Real pause/resume function, you can resume a session with -r +* Session support, use -s session_name. Combine this with -r to resume a session other then the default +* Ini file support, store some default values such as rainbow table directories. +* Tab separated results (stdout) +* Support pause during cracking and 'skip' during unicode correction for Linux +* A readme / 'manual' ! + +0.5 (16 Apr 2009, 22:47): +* Support for the old non-indexed .rt format, it should work with both type of tables in one run... I didn't test this feature thoroughly +* Using some other pieces of code for algorithms +* Support for .lst files from Cain as input (patch from James Dickson) - use for example -c LMNT.lst +* Fixed some bugs +* Dunno anymore, left this version lying around for too long... + +0.4 (oops, a second 0.4) (13 Dec 2008, 18:20): +* Improved file reading performance + +0.4 (27 Nov 2008, 00:09): +* Source included +* Memory usage down to about 50% (tnx sc00bz for pointing out the inefficiency, tnx jci for helping with the code) +* Works under Linux! (using pthreads now instead of Windows threads) +* Speed up: implemented MD4 reference implementation, not using OpenSSL for NTLM anymore (tnx Bitweasil for supplying 98% of the code) +* Speed up: using OpenSSL a lot faster (tnx jci for pointing that out) +* Probably some more small things i forgot + +0.3 (16 Nov 2008, 01:01): +* Improved command line argument parsing (order no longer matters) +* Option to write (temporary) output to a file, use -o pick_a_nice_filename.txt +* Option to pause, press 'P' to pause/unpause (Windows only) +* For pwdump searches: unicode correction is done when case correction fails + +0.2 (28 Oct 2008, 01:42): +* False alarm checking now also multi threaded +* Search one level of subdirectories for rainbow table files + +0.1 (27 Oct 2008, 00:14): +* Initial multithreaded version, using Windows threads. +* Using multiple threads for the pre-calculation part. +* Added a simple 'progress' message, so you can see how many hashes are being pre-calculated + diff --git a/Client Applications/rcracki_mt/CrackEngine.cpp b/Client Applications/rcracki_mt/CrackEngine.cpp index d36ebbc..0343588 100644 --- a/Client Applications/rcracki_mt/CrackEngine.cpp +++ b/Client Applications/rcracki_mt/CrackEngine.cpp @@ -3,7 +3,7 @@ * RainbowCrack * * Copyright (C) Zhu Shuanglei - * Copyright Martin Westergaard Jørgensen + * Copyright 2009, 2010 Martin Westergaard Jørgensen * Copyright 2009, 2010 Daniël Niggebrugge * Copyright 2009, 2010 James Nobis * Copyright 2010 uroskn @@ -1044,11 +1044,16 @@ void CCrackEngine::SearchRainbowTable(string sPathName, CHashSet& hs) } static CMemoryPool mp(bytesForChainWalkSet, debug, maxMem); - RainbowChainO* pChain = (RainbowChainO*)mp.Allocate(nFileLen, nAllocatedSize); - #ifdef _WIN32 - if (debug) printf("Allocated %I64u bytes, filelen %lu\n", nAllocatedSize, (unsigned long)nFileLen); + RainbowChainO* pChain = NULL; + if(doRti2Format) { + pChain = (RainbowChainO*)mp.Allocate(pReader->GetChainsLeft() * 16, nAllocatedSize); + } else { + pChain = (RainbowChainO*)mp.Allocate(nFileLen, nAllocatedSize); + } + #if defined(_WIN32) && !defined(__GNUC__) + if (debug) printf("Allocated %I64 bytes, filelen %ld\n", nAllocatedSize, nFileLen); #else - if (debug) printf("Allocated %llu bytes, filelen %lu\n", nAllocatedSize, (unsigned long)nFileLen); + if (debug) printf("Allocated %llu bytes, filelen %ld\n", nAllocatedSize, nFileLen); #endif if (pChain != NULL) @@ -1064,13 +1069,15 @@ void CCrackEngine::SearchRainbowTable(string sPathName, CHashSet& hs) // Load table chunk if (debug) printf("reading...\n"); - unsigned int nDataRead = 0, nDataToRead = 0; + unsigned int nDataRead = 0; gettimeofday( &tv, NULL ); if ( doRti2Format ) { - nDataToRead = nAllocatedSize / 16; - nDataRead = nDataToRead; + nDataRead = nAllocatedSize / 16; + if(pReader->GetChainsLeft() <= 0) // No more data + break; pReader->ReadChains(nDataRead, pChain); + nDataRead *= 8; // Convert from chains read to bytes } else @@ -1086,6 +1093,10 @@ void CCrackEngine::SearchRainbowTable(string sPathName, CHashSet& hs) int nRainbowChainCountRead = nDataRead / 16; + if(doRti2Format) { + nRainbowChainCountRead = nDataRead / 8; + } + // Verify table chunk if (!fVerified) { @@ -1137,12 +1148,15 @@ void CCrackEngine::SearchRainbowTable(string sPathName, CHashSet& hs) if (!hs.AnyHashLeftWithLen(CChainWalkContext::GetHashLen())) break; +/* + // XXX eliminated by PB - check correctness // finished the current table if( doRti2Format && nDataToRead > (nDataRead / 8) ) { delete pReader; break; } +*/ } } else @@ -1162,21 +1176,21 @@ void CCrackEngine::SearchRainbowTable(string sPathName, CHashSet& hs) if(fIndex != NULL) { // File length check - unsigned int nFileLenIndex = GetFileLen(fIndex); + long nFileLenIndex = GetFileLen(fIndex); //unsigned int nRows = nFileLenIndex / 11; //unsigned int nSize = nRows * sizeof(IndexChain); //printf("Debug: 8\n"); if (nFileLenIndex % 11 != 0) - printf("index file length mismatch (%u bytes)\n", nFileLenIndex); + printf("index file length mismatch (%ld bytes)\n", nFileLenIndex); else { //printf("index nSize: %d\n", nSize); //pIndex = (IndexChain*)new unsigned char[nSize]; IndexChain *pIndex = (IndexChain*)mpIndex.Allocate(nFileLenIndex, nAllocatedSizeIndex); #ifdef _WIN32 - if (debug) printf("Debug: Allocated %I64u bytes for index with filelen %u\n", nAllocatedSizeIndex, nFileLenIndex); + if (debug) printf("Debug: Allocated %I64u bytes for index with filelen %ld\n", nAllocatedSizeIndex, nFileLenIndex); #else - if (debug) printf("Debug: Allocated %llu bytes for index with filelen %u\n", nAllocatedSizeIndex, nFileLenIndex); + if (debug) printf("Debug: Allocated %llu bytes for index with filelen %ld\n", nAllocatedSizeIndex, nFileLenIndex); #endif static CMemoryPool mp(bytesForChainWalkSet + nAllocatedSizeIndex, debug, maxMem); @@ -1187,7 +1201,7 @@ void CCrackEngine::SearchRainbowTable(string sPathName, CHashSet& hs) fseek(fIndex, 0, SEEK_SET); - while ( (unsigned long)ftell(fIndex) != nFileLenIndex ) // Index chunk read loop + while ( ftell(fIndex) != nFileLenIndex ) // Index chunk read loop { // Load index chunk #ifdef _WIN32 @@ -1230,7 +1244,7 @@ void CCrackEngine::SearchRainbowTable(string sPathName, CHashSet& hs) //fseek(file, 0, SEEK_SET); //bool fVerified = false; uint32 nProcessedChains = 0; - while (ftell(file) != nFileLen + while ( ftell(file) != nFileLen && nProcessedChains < nCoveredRainbowTableChains ) // Chunk read loop { // Load table chunk diff --git a/Client Applications/rcracki_mt/CrackEngine.h b/Client Applications/rcracki_mt/CrackEngine.h index a5bc6a6..7fdf459 100644 --- a/Client Applications/rcracki_mt/CrackEngine.h +++ b/Client Applications/rcracki_mt/CrackEngine.h @@ -1,98 +1,98 @@ -/* - * 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 - * Copyright 2010 uroskn - * - * 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 _CRACKENGINE_H -#define _CRACKENGINE_H - -#include "Public.h" -#include "HashSet.h" -#include "ChainWalkContext.h" -#include "MemoryPool.h" -#include "ChainWalkSet.h" -#include "rcrackiThread.h" -#ifdef _WIN32 -#include -#include -#endif -#include - -class CCrackEngine -{ -public: - CCrackEngine(); - virtual ~CCrackEngine(); - -private: - CChainWalkSet m_cws; - int maxThreads; - uint64 maxMem; - bool writeOutput; - bool resumeSession; - string outputFile; - string sSessionPathName; - string sProgressPathName; - string sPrecalcPathName; - //string sPrecalcIndexPathName; - bool debug; - bool keepPrecalcFiles; - - // Statistics - float m_fTotalDiskAccessTime; - float m_fTotalCryptanalysisTime; - float m_fTotalPrecalculationTime; - int m_nTotalChainWalkStep; - int m_nTotalFalseAlarm; - int m_nTotalChainWalkStepDueToFalseAlarm; - FILE *m_fChains; - -private: - void ResetStatistics(); - RainbowChain *BinarySearch(RainbowChain *pChain, int nChainCountRead, uint64 nIndex, IndexChain *pIndex, int nIndexSize, int nIndexStart); - int BinarySearchOld(RainbowChainO* pChain, int nRainbowChainCount, uint64 nIndex); - void GetChainIndexRangeWithSameEndpoint(RainbowChainO* pChain, - int nRainbowChainCount, - int nChainIndex, - int& nChainIndexFrom, - int& nChainIndexTo); - void SearchTableChunk(RainbowChain* pChain, int nRainbowChainLen, int nRainbowChainCount, CHashSet& hs, IndexChain *pIndex, int nIndexSize, int nChainStart); - void SearchTableChunkOld(RainbowChainO* pChain, int nRainbowChainLen, int nRainbowChainCount, CHashSet& hs); - //bool CheckAlarm(RainbowChain* pChain, int nGuessedPos, unsigned char* pHash, CHashSet& hs); - //bool CheckAlarmOld(RainbowChainO* pChain, int nGuessedPos, unsigned char* pHash, CHashSet& hs); - -public: - void SearchRainbowTable(string sPathName, CHashSet& hs); - void Run(vector vPathName, CHashSet& hs, int i_maxThreads, uint64 i_maxMem, bool resume, bool bDebug); - float GetStatTotalDiskAccessTime(); - float GetStatTotalCryptanalysisTime(); - float GetStatTotalPrecalculationTime(); - int GetStatTotalChainWalkStep(); - int GetStatTotalFalseAlarm(); - int GetStatTotalChainWalkStepDueToFalseAlarm(); - void setOutputFile(string sPathName); - void setSession(string sSessionPathName, string sProgressPathName, string sPrecalcPathName, bool keepPrecalc); -}; - -#endif +/* + * 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 + * Copyright 2010 uroskn + * + * 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 _CRACKENGINE_H +#define _CRACKENGINE_H + +#include "Public.h" +#include "HashSet.h" +#include "ChainWalkContext.h" +#include "MemoryPool.h" +#include "ChainWalkSet.h" +#include "rcrackiThread.h" +#ifdef _WIN32 +#include +#include +#endif +#include + +class CCrackEngine +{ +public: + CCrackEngine(); + virtual ~CCrackEngine(); + +private: + CChainWalkSet m_cws; + int maxThreads; + uint64 maxMem; + bool writeOutput; + bool resumeSession; + string outputFile; + string sSessionPathName; + string sProgressPathName; + string sPrecalcPathName; + //string sPrecalcIndexPathName; + bool debug; + bool keepPrecalcFiles; + + // Statistics + float m_fTotalDiskAccessTime; + float m_fTotalCryptanalysisTime; + float m_fTotalPrecalculationTime; + int m_nTotalChainWalkStep; + int m_nTotalFalseAlarm; + int m_nTotalChainWalkStepDueToFalseAlarm; + FILE *m_fChains; + +private: + void ResetStatistics(); + RainbowChain *BinarySearch(RainbowChain *pChain, int nChainCountRead, uint64 nIndex, IndexChain *pIndex, int nIndexSize, int nIndexStart); + int BinarySearchOld(RainbowChainO* pChain, int nRainbowChainCount, uint64 nIndex); + void GetChainIndexRangeWithSameEndpoint(RainbowChainO* pChain, + int nRainbowChainCount, + int nChainIndex, + int& nChainIndexFrom, + int& nChainIndexTo); + void SearchTableChunk(RainbowChain* pChain, int nRainbowChainLen, int nRainbowChainCount, CHashSet& hs, IndexChain *pIndex, int nIndexSize, int nChainStart); + void SearchTableChunkOld(RainbowChainO* pChain, int nRainbowChainLen, int nRainbowChainCount, CHashSet& hs); + //bool CheckAlarm(RainbowChain* pChain, int nGuessedPos, unsigned char* pHash, CHashSet& hs); + //bool CheckAlarmOld(RainbowChainO* pChain, int nGuessedPos, unsigned char* pHash, CHashSet& hs); + +public: + void SearchRainbowTable(string sPathName, CHashSet& hs); + void Run(vector vPathName, CHashSet& hs, int i_maxThreads, uint64 i_maxMem, bool resume, bool bDebug); + float GetStatTotalDiskAccessTime(); + float GetStatTotalCryptanalysisTime(); + float GetStatTotalPrecalculationTime(); + int GetStatTotalChainWalkStep(); + int GetStatTotalFalseAlarm(); + int GetStatTotalChainWalkStepDueToFalseAlarm(); + void setOutputFile(string sPathName); + void setSession(string sSessionPathName, string sProgressPathName, string sPrecalcPathName, bool keepPrecalc); +}; + +#endif diff --git a/Client Applications/rcracki_mt/HashAlgorithm.cpp b/Client Applications/rcracki_mt/HashAlgorithm.cpp index 4206340..4a4cbbb 100644 --- a/Client Applications/rcracki_mt/HashAlgorithm.cpp +++ b/Client Applications/rcracki_mt/HashAlgorithm.cpp @@ -3,7 +3,7 @@ * RainbowCrack * * Copyright (C) Zhu Shuanglei - * Copyright Martin Westergaard Jørgensen + * Copyright 2009, 2010 Martin Westergaard Jørgensen * Copyright 2009, 2010 Daniël Niggebrugge * Copyright 2009, 2010 James Nobis * diff --git a/Client Applications/rcracki_mt/HashAlgorithm.h b/Client Applications/rcracki_mt/HashAlgorithm.h index a6b77b5..401784f 100644 --- a/Client Applications/rcracki_mt/HashAlgorithm.h +++ b/Client Applications/rcracki_mt/HashAlgorithm.h @@ -1,64 +1,64 @@ -/* - * 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 +/* + * 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.h b/Client Applications/rcracki_mt/HashRoutine.h index 2d53125..eaa10ce 100644 --- a/Client Applications/rcracki_mt/HashRoutine.h +++ b/Client Applications/rcracki_mt/HashRoutine.h @@ -1,55 +1,55 @@ -/* - * 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 +/* + * 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/HashSet.h b/Client Applications/rcracki_mt/HashSet.h index d3f410a..f7f37b2 100644 --- a/Client Applications/rcracki_mt/HashSet.h +++ b/Client Applications/rcracki_mt/HashSet.h @@ -1,59 +1,59 @@ -/* - * 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 _HASHSET_H -#define _HASHSET_H - -#include "Public.h" - -class CHashSet -{ -public: - CHashSet(); - virtual ~CHashSet(); - -private: - vector m_vHash; - vector m_vFound; - vector m_vPlain; - vector m_vBinary; - -public: - void AddHash(string sHash); // lowercase, len % 2 == 0, MIN_HASH_LEN * 2 <= len <= MAX_HASH_LEN * 2 - bool AnyhashLeft(); - bool AnyHashLeftWithLen(int nLen); - void GetLeftHashWithLen(vector& vHash, int nLen); - - void SetPlain(string sHash, string sPlain, string sBinary); - bool GetPlain(string sHash, string& sPlain, string& sBinary); - - int GetStatHashFound(); - int GetStatHashTotal(); - - string GetHashInfo(int i); - void AddHashInfo(string sHash, bool found, string sPlain, string sBinary); -}; - -#endif +/* + * 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 _HASHSET_H +#define _HASHSET_H + +#include "Public.h" + +class CHashSet +{ +public: + CHashSet(); + virtual ~CHashSet(); + +private: + vector m_vHash; + vector m_vFound; + vector m_vPlain; + vector m_vBinary; + +public: + void AddHash(string sHash); // lowercase, len % 2 == 0, MIN_HASH_LEN * 2 <= len <= MAX_HASH_LEN * 2 + bool AnyhashLeft(); + bool AnyHashLeftWithLen(int nLen); + void GetLeftHashWithLen(vector& vHash, int nLen); + + void SetPlain(string sHash, string sPlain, string sBinary); + bool GetPlain(string sHash, string& sPlain, string& sBinary); + + int GetStatHashFound(); + int GetStatHashTotal(); + + string GetHashInfo(int i); + void AddHashInfo(string sHash, bool found, string sPlain, string sBinary); +}; + +#endif diff --git a/Client Applications/rcracki_mt/MemoryPool.cpp b/Client Applications/rcracki_mt/MemoryPool.cpp index 5c634c0..77a4eab 100644 --- a/Client Applications/rcracki_mt/MemoryPool.cpp +++ b/Client Applications/rcracki_mt/MemoryPool.cpp @@ -33,14 +33,14 @@ CMemoryPool::CMemoryPool(unsigned int bytesSaved, bool bDebug, uint64 maxMem) m_nMemSize = 0; debug = bDebug; - uint64 nAvailPhys = GetAvailPhysMemorySize(); + unsigned long nAvailPhys = GetAvailPhysMemorySize(); if ( debug ) { - #ifdef _WIN32 + #if defined(_WIN32) && !defined(__GNUC__) printf( "Debug: nAvailPhys: %I64u\n", nAvailPhys ); #else - printf( "Debug: nAvailPhys: %llu\n", nAvailPhys ); + printf( "Debug: nAvailPhys: %lu\n", nAvailPhys ); #endif printf( "Debug: bytesSaved: %d\n", bytesSaved ); } diff --git a/Client Applications/rcracki_mt/Public.cpp b/Client Applications/rcracki_mt/Public.cpp index 946c79d..941331b 100644 --- a/Client Applications/rcracki_mt/Public.cpp +++ b/Client Applications/rcracki_mt/Public.cpp @@ -202,7 +202,7 @@ bool boinc_ReadLinesFromFile(string sPathName, vector& vLine) if (file != NULL) { - unsigned int len = GetFileLen(file); + long len = GetFileLen(file); char* data = new char[len + 1]; fread(data, 1, len, file); data[len] = '\0'; @@ -242,7 +242,7 @@ bool ReadLinesFromFile(string sPathName, vector& vLine) FILE* file = fopen(sPathName.c_str(), "rb"); if (file != NULL) { - unsigned int len = GetFileLen(file); + long len = GetFileLen(file); char* data = new char[len + 1]; fread(data, 1, len, file); data[len] = '\0'; @@ -356,7 +356,7 @@ string HexToStr(const unsigned char* pData, int nLen) unsigned long GetAvailPhysMemorySize() { -#if defined(_WIN32) +#ifdef _WIN32 MEMORYSTATUS ms; GlobalMemoryStatus(&ms); return ms.dwAvailPhys; diff --git a/Client Applications/rcracki_mt/README.txt b/Client Applications/rcracki_mt/README.txt index 3719dd6..875cf56 100644 --- a/Client Applications/rcracki_mt/README.txt +++ b/Client Applications/rcracki_mt/README.txt @@ -1,171 +1,171 @@ -[rcracki_mt README] - -USAGE -================ -example: rcracki_mt -h 5d41402abc4b2a76b9719d911017c592 -t 4 -o save.txt C:\md5 - -Start rcracki_mt without any arguments to view usage information in short. This README describes the various -options in more detail. Many options can be set to a default value by editing rcracki_mt.ini. Command line -arguments get priority over settings in the ini file. - -INPUT ----------------- -rcracki_mt takes one hash on the command line (using -h) or an input file containing the hashes. rcracki_mt supports -three formats for the input file. Use one of the following options to specify the format followed by the filename: - --l: specify a list of hashes (one hash per line) --f: specify a pwdump file --c: specify a .lst file (format in which Cain stores hashes and results) - -SELECTING RAINBOW TABLES ----------------- -Any command line argument that is not an option will be interpreted as a directory to search for rainbow tables, -multiple directories can be specified. rcracki_mt recursively scans all specified directories for *.rti (indexed) -and *.rt (old/original) files. You can use .rt & .rti files at once, but this hasn't been tested thoroughly. - -You can set default locations to search for rainbow tables in rcracki_mt.ini. You need to use these in combination -with the command line argument -a [algorithm]. See the comments in the ini file for examples. - -SESSIONS & RESUMING ----------------- -Rcracki_mt has session support, which means that it stores its progress. This allows you to interrupt the session -and resume later on. This also allows sessions that stopped because of a crash (application or even system) to -resume. To use this feature, start rcracki_mt with all the options you'd like, then specify a session name with: - --s session_name: specify a session name - -Now during cracking, all your valuable precalculations are stored to disk, as well as progress (which files have -been checked) and cracked hashes. If you decide to interrupt the session (using CTRL+C), you can resume it using -the -r option. For example: - -rcracki_mt -r -s my_personal_hashes - -While resuming rcracki_mt you can/have to specify the less important options again, like number of threads and -showing debug information. Usually you will have these settings set to a default value in the .ini file anyway. -Session are deleted after the run is completed. You can choose to keep the precalculation work on disk, for example -if you want to reuse your session later on. Use the '-k' option to enable this feature. - -Rcracki_mt has a default session which gets overwritten every time you start a new job without specifying a session -name. It might be interesting to always keep precalculation work by enabling this feature in rcracki_mt.ini. But -pay attention, these precalculations can become quite large on disk. Currently there is a maximum of around 500 GB -of storage for these precalculations. You can always decide to manually remove the .precalc and .precalc.index -files from disk. Always remove both at the same time, you will screw up your results if you don't. A possible -'todo' for development is to do some verification before using stored precalculations. - -OPTIONAL ----------------- --t: Number of threads to use (for precalculation and false alarm checking) -Note: In Windows the crack threads run with lower priority. - --o: specify an output file to store found hashes in a colon (:) separated format. - Hashes are saved immediately when found. Especially useful if you have a large list of hashes. - --v: Show more information during cracking, for debugging purposes. Please use this flag if you want to show -output and report a bug. - - -EXTRA FEATURES ----------------- -You can pause a running rcracki_mt by using 'P'. It might not pause right away, it actually pauses after doing -precalculation or false alarm checking for one hash. Resume by pressing 'P' again. This pause option is different -from the session/resume feature, as this just pauses a running job, you don't stop rcracki_mt this way. - -If you are trying to crack a pwdump or Cain (.lst) file, containing both LM and NTLM hashes, rcracki_mt will try -and crack the LM hashes. The result will be an uppercase password, which rcracki_mt will then try to correct with -the right casing, using the NTLM hashes. If this fails it will try and perform Unicode correction, using a built-in -mapping. If you happen to have an LM hash coupled with the wrong NTLM hash, this attempt to perform Unicode -correction might take 'forever'. You can press 'S' to skip this step for the current hash. - - -HISTORY AND AUTHORS -================ -rcracki_mt originally started as a modification of a modification (rcracki) of the original RainbowCrack (rcrack). -These programs are all used to perform a rainbow table attack on password hashes, implementing Philippe Oechslin's -faster time-memory trade-off technique. - -Original rcrack code was written by Zhu Shuanglei . - -Martin Westergaard Jørgensen wrote rcracki (improved) to support the rainbow tables -generated by the distributed project www.freerainbowtables.com. These tables are perfected and indexed, making them -faster and smaller. Rcracki also supported hybrid tables. - -Daniël Niggebrugge further enhanced this version and made it multi threaded, creating rcracki_mt. More -features were added over time, making it less of an unofficial version with every release. - -James Nobis - improved *nix compatibility and 64-bit compatability and -continues work on the project. - - -SUPPORTED HASH ALGORITHMS -================ -Hash types supported by rcracki_mt are: LM, NTLM, MD2, MD4, MD5, DoubleMD5, SHA1, RIPEMD160, MSCACHE, MySQL323, -MySQLSHA1, PIX, LMCHALL, HALFLMCHALL, NTLMCHALL, ORACLE - -Actual indexed&perfected tables that were generated by the Free Rainbow Tables project: LM, MD5, NTL, FASTLM, -HALFLMCHALL, SHA1 - - -SUPPORTED PLATFORMS -================ -Rcracki_mt is released both as win32 binary and as source package. Rcracki_mt should work on any Microsoft Windows system, but is only tested on a 32 bit Windows XP. - -The source should work on Linux distributions. It has been tested on: -32-bit Ubuntu -32-bit Debian GNU/Linux -64-bit Debian GNU/Linux - -The source should also work on other platforms and has been tested on: -32-bit MacOSX - -32-bit FreeBSD -64-bit FreeBSD -32-bit NetBSD -32-bit OpenBSD - you must install and use eg++ from ports -64-bit OpenBSD - -Only compilation has been tested on: -64-bit MacOSX - -Please note that to compile under the BSDs you must use gmake. - -OpenBSD threading is a work in progress. - -'OPTIONAL' TODO -================ -- verification of an endpoint when restoring a chainwalkset from disk. -- read multiple chainwalksets from disk at once to try and speed up this process. -- read next table (part) from disk while doing cryptanalysis - - -LINKS -================ -rcracki_mt @ SourceForge: https://sourceforge.net/projects/rcracki/ -Original rcrack: http://www.antsight.com/zsl/rainbowcrack/ -Free Rainbow Tables: http://www.freerainbowtables.com/ -My personal blog: http://blog.distracted.nl/ -Download free rainbow tables: http://tbhost.eu/ -Download free rainbow tables (mirror): http://freerainbowtables.mirror.garr.it/mirrors/freerainbowtables/ - - -THANKS -================ -the_drag0n Writing part of this README - Patch to support Cain .lst files -Joao Inacio Supplying some faster algorithm implementations - - -FAQ -================ -Q: Why do I get this message all the time? "this table contains hashes with length 8 only" -A: You are probably trying to crack LM hashes. You have to split up the hash in 2 parts of 16 hex characters each. - -Q: rcracki_mt is so slow when I'm cracking 5000 hashes, why is that? -A: Rainbow table attacks are only useful for a certain amount of hashes, mainly because of the precalculations that -are needed for every hash you are cracking. At a certain point it is faster to brute force the same key space then -to try and use rainbow tables. Especially if you use a GPU enabled brute forcer, this limit might be reached very -soon. Play around with these to find you limits. - -Q: How can I speed up rcracki_mt? -A: This depends on quite some factors. If your jobs usually comprise of disk access time, you can try and speed up -your storage. For example by using RAID and/or by using solid state disks. If you are trying to crack many hashes -at the same time, you might be better off with buying a faster CPU. +[rcracki_mt README] + +USAGE +================ +example: rcracki_mt -h 5d41402abc4b2a76b9719d911017c592 -t 4 -o save.txt C:\md5 + +Start rcracki_mt without any arguments to view usage information in short. This README describes the various +options in more detail. Many options can be set to a default value by editing rcracki_mt.ini. Command line +arguments get priority over settings in the ini file. + +INPUT +---------------- +rcracki_mt takes one hash on the command line (using -h) or an input file containing the hashes. rcracki_mt supports +three formats for the input file. Use one of the following options to specify the format followed by the filename: + +-l: specify a list of hashes (one hash per line) +-f: specify a pwdump file +-c: specify a .lst file (format in which Cain stores hashes and results) + +SELECTING RAINBOW TABLES +---------------- +Any command line argument that is not an option will be interpreted as a directory to search for rainbow tables, +multiple directories can be specified. rcracki_mt recursively scans all specified directories for *.rti (indexed) +and *.rt (old/original) files. You can use .rt & .rti files at once, but this hasn't been tested thoroughly. + +You can set default locations to search for rainbow tables in rcracki_mt.ini. You need to use these in combination +with the command line argument -a [algorithm]. See the comments in the ini file for examples. + +SESSIONS & RESUMING +---------------- +Rcracki_mt has session support, which means that it stores its progress. This allows you to interrupt the session +and resume later on. This also allows sessions that stopped because of a crash (application or even system) to +resume. To use this feature, start rcracki_mt with all the options you'd like, then specify a session name with: + +-s session_name: specify a session name + +Now during cracking, all your valuable precalculations are stored to disk, as well as progress (which files have +been checked) and cracked hashes. If you decide to interrupt the session (using CTRL+C), you can resume it using +the -r option. For example: + +rcracki_mt -r -s my_personal_hashes + +While resuming rcracki_mt you can/have to specify the less important options again, like number of threads and +showing debug information. Usually you will have these settings set to a default value in the .ini file anyway. +Session are deleted after the run is completed. You can choose to keep the precalculation work on disk, for example +if you want to reuse your session later on. Use the '-k' option to enable this feature. + +Rcracki_mt has a default session which gets overwritten every time you start a new job without specifying a session +name. It might be interesting to always keep precalculation work by enabling this feature in rcracki_mt.ini. But +pay attention, these precalculations can become quite large on disk. Currently there is a maximum of around 500 GB +of storage for these precalculations. You can always decide to manually remove the .precalc and .precalc.index +files from disk. Always remove both at the same time, you will screw up your results if you don't. A possible +'todo' for development is to do some verification before using stored precalculations. + +OPTIONAL +---------------- +-t: Number of threads to use (for precalculation and false alarm checking) +Note: In Windows the crack threads run with lower priority. + +-o: specify an output file to store found hashes in a colon (:) separated format. + Hashes are saved immediately when found. Especially useful if you have a large list of hashes. + +-v: Show more information during cracking, for debugging purposes. Please use this flag if you want to show +output and report a bug. + + +EXTRA FEATURES +---------------- +You can pause a running rcracki_mt by using 'P'. It might not pause right away, it actually pauses after doing +precalculation or false alarm checking for one hash. Resume by pressing 'P' again. This pause option is different +from the session/resume feature, as this just pauses a running job, you don't stop rcracki_mt this way. + +If you are trying to crack a pwdump or Cain (.lst) file, containing both LM and NTLM hashes, rcracki_mt will try +and crack the LM hashes. The result will be an uppercase password, which rcracki_mt will then try to correct with +the right casing, using the NTLM hashes. If this fails it will try and perform Unicode correction, using a built-in +mapping. If you happen to have an LM hash coupled with the wrong NTLM hash, this attempt to perform Unicode +correction might take 'forever'. You can press 'S' to skip this step for the current hash. + + +HISTORY AND AUTHORS +================ +rcracki_mt originally started as a modification of a modification (rcracki) of the original RainbowCrack (rcrack). +These programs are all used to perform a rainbow table attack on password hashes, implementing Philippe Oechslin's +faster time-memory trade-off technique. + +Original rcrack code was written by Zhu Shuanglei . + +Martin Westergaard Jørgensen wrote rcracki (improved) to support the rainbow tables +generated by the distributed project www.freerainbowtables.com. These tables are perfected and indexed, making them +faster and smaller. Rcracki also supported hybrid tables. + +Daniël Niggebrugge further enhanced this version and made it multi threaded, creating rcracki_mt. More +features were added over time, making it less of an unofficial version with every release. + +James Nobis - improved *nix compatibility and 64-bit compatability and +continues work on the project. + + +SUPPORTED HASH ALGORITHMS +================ +Hash types supported by rcracki_mt are: LM, NTLM, MD2, MD4, MD5, DoubleMD5, SHA1, RIPEMD160, MSCACHE, MySQL323, +MySQLSHA1, PIX, LMCHALL, HALFLMCHALL, NTLMCHALL, ORACLE + +Actual indexed&perfected tables that were generated by the Free Rainbow Tables project: LM, MD5, NTL, FASTLM, +HALFLMCHALL, SHA1 + + +SUPPORTED PLATFORMS +================ +Rcracki_mt is released both as win32 binary and as source package. Rcracki_mt should work on any Microsoft Windows system, but is only tested on a 32 bit Windows XP. + +The source should work on Linux distributions. It has been tested on: +32-bit Ubuntu +32-bit Debian GNU/Linux +64-bit Debian GNU/Linux + +The source should also work on other platforms and has been tested on: +32-bit MacOSX + +32-bit FreeBSD +64-bit FreeBSD +32-bit NetBSD +32-bit OpenBSD - you must install and use eg++ from ports +64-bit OpenBSD + +Only compilation has been tested on: +64-bit MacOSX + +Please note that to compile under the BSDs you must use gmake. + +OpenBSD threading is a work in progress. + +'OPTIONAL' TODO +================ +- verification of an endpoint when restoring a chainwalkset from disk. +- read multiple chainwalksets from disk at once to try and speed up this process. +- read next table (part) from disk while doing cryptanalysis + + +LINKS +================ +rcracki_mt @ SourceForge: https://sourceforge.net/projects/rcracki/ +Original rcrack: http://www.antsight.com/zsl/rainbowcrack/ +Free Rainbow Tables: http://www.freerainbowtables.com/ +My personal blog: http://blog.distracted.nl/ +Download free rainbow tables: http://tbhost.eu/ +Download free rainbow tables (mirror): http://freerainbowtables.mirror.garr.it/mirrors/freerainbowtables/ + + +THANKS +================ +the_drag0n Writing part of this README + Patch to support Cain .lst files +Joao Inacio Supplying some faster algorithm implementations + + +FAQ +================ +Q: Why do I get this message all the time? "this table contains hashes with length 8 only" +A: You are probably trying to crack LM hashes. You have to split up the hash in 2 parts of 16 hex characters each. + +Q: rcracki_mt is so slow when I'm cracking 5000 hashes, why is that? +A: Rainbow table attacks are only useful for a certain amount of hashes, mainly because of the precalculations that +are needed for every hash you are cracking. At a certain point it is faster to brute force the same key space then +to try and use rainbow tables. Especially if you use a GPU enabled brute forcer, this limit might be reached very +soon. Play around with these to find you limits. + +Q: How can I speed up rcracki_mt? +A: This depends on quite some factors. If your jobs usually comprise of disk access time, you can try and speed up +your storage. For example by using RAID and/or by using solid state disks. If you are trying to crack many hashes +at the same time, you might be better off with buying a faster CPU. diff --git a/Client Applications/rcracki_mt/RTI2Reader.cpp b/Client Applications/rcracki_mt/RTI2Reader.cpp index abd8550..b1d5f96 100644 --- a/Client Applications/rcracki_mt/RTI2Reader.cpp +++ b/Client Applications/rcracki_mt/RTI2Reader.cpp @@ -48,7 +48,11 @@ RTI2Reader::RTI2Reader(string Filename) long len = GetFileLen(pFileIndex); fseek(pFileIndex, 0, SEEK_SET); - m_pIndex = new unsigned char[len]; + m_pIndex = new (nothrow) unsigned char[len]; + if(m_pIndex == NULL) { + printf("Error allocating %ld MB memory for index in RTI2Reader::RTI2Reader()", len / (1024 * 1024)); + exit(-2); + } if(fread(m_pIndex, 1, len, pFileIndex) != (unsigned long)len) { printf("Error while reading index file"); diff --git a/Client Applications/rcracki_mt/RTI2Reader.h b/Client Applications/rcracki_mt/RTI2Reader.h index 3545035..e0f5ed4 100644 --- a/Client Applications/rcracki_mt/RTI2Reader.h +++ b/Client Applications/rcracki_mt/RTI2Reader.h @@ -59,7 +59,7 @@ private: public: RTI2Reader(string Filename); ~RTI2Reader(void); - int ReadChains(unsigned int &numChains, RainbowChainO *pData); + int ReadChains(uint32 &numChains, RainbowChainO *pData); unsigned int GetChainsLeft(); static RTI2Header *GetHeader() { return m_pHeader; } }; diff --git a/Client Applications/rcracki_mt/lm2ntlm.h b/Client Applications/rcracki_mt/lm2ntlm.h index 6a423f5..3a44334 100644 --- a/Client Applications/rcracki_mt/lm2ntlm.h +++ b/Client Applications/rcracki_mt/lm2ntlm.h @@ -1,80 +1,80 @@ -/* - * rcracki_mt is a multithreaded implementation and fork of the original - * RainbowCrack - * - * 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 . - */ - -#include -#include -#include -#ifdef _WIN32 - #include -#endif -//#include "openssl/md4.h" -#include -#include "signal.h" -#include "Public.h" -#include "md4.h" - -using namespace std; - -class LM2NTLMcorrector -{ -public: - LM2NTLMcorrector(); - -private: - map > m_mapChar; - uint64 progressCurrentCombination; - uint64 totalCurrentCombination; - uint64 counterOverall; - unsigned char NTLMHash[16]; - clock_t startClock; - int countCombinations; - int countTotalCombinations; - int counter; - clock_t previousClock; - unsigned char currentCharmap[16][128]; - bool aborting; - string sBinary; - -private: - bool checkNTLMPassword(unsigned char* pLMPassword, int nLMPasswordLen, string& sNTLMPassword); - bool startCorrecting(string sLMPassword, string& sNTLMPassword, unsigned char* pLMPassword); - void printString(unsigned char* muteThis, int length); - void setupCombinationAtPositions(int length, unsigned char* pMuteMe, unsigned char* pTempMute, int* jAtPos, bool* fullAtPos, int* sizeAtPos); - bool checkPermutations(int length, unsigned char* pTempMute, int* jAtPos, int* sizeAtPos, unsigned char* pLMPassword, string& sNTLMPassword); - - int calculateTotalCombinations(int length, int setSize); - int factorial (int num); - - bool parseHexPassword(string hexPassword, string& sPlain); - bool NormalizeHexString(string& sHash); - void ParseHash(string sHash, unsigned char* pHash, int& nHashLen); - string ByteToStr(const unsigned char* pData, int nLen); - void addToMapW(unsigned char key, unsigned char value1, unsigned char value2); - void fillMapW(); - void checkAbort(); - void writeEndStats(); -public: - bool LMPasswordCorrectUnicode(string hexPassword, unsigned char* NTLMHash, string& sNTLMPassword); - string getBinary(); -}; - +/* + * rcracki_mt is a multithreaded implementation and fork of the original + * RainbowCrack + * + * 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 . + */ + +#include +#include +#include +#ifdef _WIN32 + #include +#endif +//#include "openssl/md4.h" +#include +#include "signal.h" +#include "Public.h" +#include "md4.h" + +using namespace std; + +class LM2NTLMcorrector +{ +public: + LM2NTLMcorrector(); + +private: + map > m_mapChar; + uint64 progressCurrentCombination; + uint64 totalCurrentCombination; + uint64 counterOverall; + unsigned char NTLMHash[16]; + clock_t startClock; + int countCombinations; + int countTotalCombinations; + int counter; + clock_t previousClock; + unsigned char currentCharmap[16][128]; + bool aborting; + string sBinary; + +private: + bool checkNTLMPassword(unsigned char* pLMPassword, int nLMPasswordLen, string& sNTLMPassword); + bool startCorrecting(string sLMPassword, string& sNTLMPassword, unsigned char* pLMPassword); + void printString(unsigned char* muteThis, int length); + void setupCombinationAtPositions(int length, unsigned char* pMuteMe, unsigned char* pTempMute, int* jAtPos, bool* fullAtPos, int* sizeAtPos); + bool checkPermutations(int length, unsigned char* pTempMute, int* jAtPos, int* sizeAtPos, unsigned char* pLMPassword, string& sNTLMPassword); + + int calculateTotalCombinations(int length, int setSize); + int factorial (int num); + + bool parseHexPassword(string hexPassword, string& sPlain); + bool NormalizeHexString(string& sHash); + void ParseHash(string sHash, unsigned char* pHash, int& nHashLen); + string ByteToStr(const unsigned char* pData, int nLen); + void addToMapW(unsigned char key, unsigned char value1, unsigned char value2); + void fillMapW(); + void checkAbort(); + void writeEndStats(); +public: + bool LMPasswordCorrectUnicode(string hexPassword, unsigned char* NTLMHash, string& sNTLMPassword); + string getBinary(); +}; + diff --git a/Client Applications/rcracki_mt/md4.h b/Client Applications/rcracki_mt/md4.h index 91753cb..aeb3822 100644 --- a/Client Applications/rcracki_mt/md4.h +++ b/Client Applications/rcracki_mt/md4.h @@ -1,35 +1,35 @@ -/* - * 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 */ +/* + * 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 */ diff --git a/Client Applications/rcracki_mt/rcrackiThread.h b/Client Applications/rcracki_mt/rcrackiThread.h index 37fa289..a53cac2 100644 --- a/Client Applications/rcracki_mt/rcrackiThread.h +++ b/Client Applications/rcracki_mt/rcrackiThread.h @@ -1,85 +1,85 @@ -/* - * rcracki_mt is a multithreaded implementation and fork of the original - * RainbowCrack - * - * 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 . - */ - -#ifdef _WIN32 - #pragma once -#endif - -#include "ChainWalkContext.h" -#include "Public.h" -#include "HashSet.h" -//#include -#include - -class rcrackiThread -{ -private: - unsigned char* t_TargetHash; - int t_nPos; - int t_nRainbowChainLen; - CChainWalkContext t_cwc; - vector t_vStartPosIndexE; - int t_ID; - int t_count; - uint64* t_pStartPosIndexE; - int t_nChainWalkStep; - bool falseAlarmChecker; - bool falseAlarmCheckerO; - vector t_pChainsFound; - vector t_pChainsFoundO; - vector t_nGuessedPoss; - unsigned char* t_pHash; - bool foundHash; - int t_nChainWalkStepDueToFalseAlarm; - int t_nFalseAlarm; - string t_Hash; - string t_Plain; - string t_Binary; - -public: - rcrackiThread(unsigned char* TargetHash, int thread_id, int nRainbowChainLen, int thread_count, uint64* pStartPosIndexE); - rcrackiThread(unsigned char* pHash, bool oldFormat = false); - rcrackiThread(void); - ~rcrackiThread(void); - - //void SetWork(unsigned char* TargetHash, int nPos, int nRainbowChainLen); - //static unsigned __stdcall rcrackiThread::rcrackiThreadStaticEntryPoint(void * pThis); - static void * rcrackiThreadStaticEntryPointPthread(void * pThis); - int GetIndexCount(); - int GetChainWalkStep(); - uint64 GetIndex(int nPos); - bool FoundHash(); - void AddAlarmCheck(RainbowChain* pChain, int nGuessedPos); - void AddAlarmCheckO(RainbowChainO* pChain, int nGuessedPos); - int GetChainWalkStepDueToFalseAlarm(); - int GetnFalseAlarm(); - string GetHash(); - string GetPlain(); - string GetBinary(); - -private: - void rcrackiThreadEntryPoint(); - void PreCalculate(); - void CheckAlarm(); - void CheckAlarmO(); -}; +/* + * rcracki_mt is a multithreaded implementation and fork of the original + * RainbowCrack + * + * 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 . + */ + +#ifdef _WIN32 + #pragma once +#endif + +#include "ChainWalkContext.h" +#include "Public.h" +#include "HashSet.h" +//#include +#include + +class rcrackiThread +{ +private: + unsigned char* t_TargetHash; + int t_nPos; + int t_nRainbowChainLen; + CChainWalkContext t_cwc; + vector t_vStartPosIndexE; + int t_ID; + int t_count; + uint64* t_pStartPosIndexE; + int t_nChainWalkStep; + bool falseAlarmChecker; + bool falseAlarmCheckerO; + vector t_pChainsFound; + vector t_pChainsFoundO; + vector t_nGuessedPoss; + unsigned char* t_pHash; + bool foundHash; + int t_nChainWalkStepDueToFalseAlarm; + int t_nFalseAlarm; + string t_Hash; + string t_Plain; + string t_Binary; + +public: + rcrackiThread(unsigned char* TargetHash, int thread_id, int nRainbowChainLen, int thread_count, uint64* pStartPosIndexE); + rcrackiThread(unsigned char* pHash, bool oldFormat = false); + rcrackiThread(void); + ~rcrackiThread(void); + + //void SetWork(unsigned char* TargetHash, int nPos, int nRainbowChainLen); + //static unsigned __stdcall rcrackiThread::rcrackiThreadStaticEntryPoint(void * pThis); + static void * rcrackiThreadStaticEntryPointPthread(void * pThis); + int GetIndexCount(); + int GetChainWalkStep(); + uint64 GetIndex(int nPos); + bool FoundHash(); + void AddAlarmCheck(RainbowChain* pChain, int nGuessedPos); + void AddAlarmCheckO(RainbowChainO* pChain, int nGuessedPos); + int GetChainWalkStepDueToFalseAlarm(); + int GetnFalseAlarm(); + string GetHash(); + string GetPlain(); + string GetBinary(); + +private: + void rcrackiThreadEntryPoint(); + void PreCalculate(); + void CheckAlarm(); + void CheckAlarmO(); +}; diff --git a/Client Applications/rcracki_mt/rcracki_mt.ini b/Client Applications/rcracki_mt/rcracki_mt.ini index 27ab17e..17edb0a 100644 --- a/Client Applications/rcracki_mt/rcracki_mt.ini +++ b/Client Applications/rcracki_mt/rcracki_mt.ini @@ -1,33 +1,33 @@ -# Default settings for rcracki_mt -# Command line arguments override these defaults - -# Specify default amount of threads -Threads=1 - -# Set a default file to store temporary results. -# Set AlwaysStoreResultsToFile=1 or use -o to actually store results. -DefaultResultsFile=e:\default_rcracki_results.txt - -# This option requires DefaultResultsFile to be set to a file -#AlwaysStoreResultsToFile=1 - -# Set some default file locations to search for rainbow tables. -# You need to use these in combination with the command line argument -a [algorithm] -# Or you can set a default algorithm here with 'DefaultAlgorithm'. -# Algorithm is the name you use as specifier after 'DefaultRainbowTablesPath.' -# You can specify multiple lines per algorithm, one path/directory per line. -# Any locations you specify on the command line will be added to the list as well. -# For Windows users: locations in this file with a different case -# as on the command line are treated as separate locations (run through twice) -#DefaultRainbowTablePath.MD5=X:\RTI\MD5 -#DefaultRainbowTablePath.NTLM=X:\RTI\NTLM\ntlm_loweralpha-space#1-9_* - -# This option requires at least one 'DefaultRainbowTablePath.[algorithm]' to be set -#DefaultAlgorithm=MD5 - -# Always show debugging infomation (command line option -v) -# AlwaysDebug=1 - -# Always keep precalculation files after cracking, don't remove them. -# These files are saved by session name. So you can store precalculations over multiple jobs. +# Default settings for rcracki_mt +# Command line arguments override these defaults + +# Specify default amount of threads +Threads=1 + +# Set a default file to store temporary results. +# Set AlwaysStoreResultsToFile=1 or use -o to actually store results. +DefaultResultsFile=e:\default_rcracki_results.txt + +# This option requires DefaultResultsFile to be set to a file +#AlwaysStoreResultsToFile=1 + +# Set some default file locations to search for rainbow tables. +# You need to use these in combination with the command line argument -a [algorithm] +# Or you can set a default algorithm here with 'DefaultAlgorithm'. +# Algorithm is the name you use as specifier after 'DefaultRainbowTablesPath.' +# You can specify multiple lines per algorithm, one path/directory per line. +# Any locations you specify on the command line will be added to the list as well. +# For Windows users: locations in this file with a different case +# as on the command line are treated as separate locations (run through twice) +#DefaultRainbowTablePath.MD5=X:\RTI\MD5 +#DefaultRainbowTablePath.NTLM=X:\RTI\NTLM\ntlm_loweralpha-space#1-9_* + +# This option requires at least one 'DefaultRainbowTablePath.[algorithm]' to be set +#DefaultAlgorithm=MD5 + +# Always show debugging infomation (command line option -v) +# AlwaysDebug=1 + +# Always keep precalculation files after cracking, don't remove them. +# These files are saved by session name. So you can store precalculations over multiple jobs. #AlwaysKeepPrecalcFiles=1 \ No newline at end of file diff --git a/Client Applications/rcracki_mt/rcracki_mt.sln b/Client Applications/rcracki_mt/rcracki_mt.sln deleted file mode 100644 index 41e564e..0000000 --- a/Client Applications/rcracki_mt/rcracki_mt.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rcracki_mt", "rcracki_mt.vcproj", "{966DA4B4-E13C-449D-9A93-303C6FEA25C4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {966DA4B4-E13C-449D-9A93-303C6FEA25C4}.Debug|Win32.ActiveCfg = Debug|Win32 - {966DA4B4-E13C-449D-9A93-303C6FEA25C4}.Debug|Win32.Build.0 = Debug|Win32 - {966DA4B4-E13C-449D-9A93-303C6FEA25C4}.Release|Win32.ActiveCfg = Release|Win32 - {966DA4B4-E13C-449D-9A93-303C6FEA25C4}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Client Applications/rcracki_mt/rcracki_mt.suo b/Client Applications/rcracki_mt/rcracki_mt.suo deleted file mode 100644 index 7159e21..0000000 Binary files a/Client Applications/rcracki_mt/rcracki_mt.suo and /dev/null differ diff --git a/Client Applications/rcracki_mt/rcracki_mt.vcproj b/Client Applications/rcracki_mt/rcracki_mt.vcproj deleted file mode 100644 index b377639..0000000 --- a/Client Applications/rcracki_mt/rcracki_mt.vcproj +++ /dev/null @@ -1,327 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Client Applications/rcracki_mt/sha1.h b/Client Applications/rcracki_mt/sha1.h index 231077b..4e27063 100644 --- a/Client Applications/rcracki_mt/sha1.h +++ b/Client Applications/rcracki_mt/sha1.h @@ -1,33 +1,33 @@ -/* - * rcracki_mt is a multithreaded implementation and fork of the original - * RainbowCrack - * - * 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 SHA1_H -#define SHA1_H - -#include "global.h" - -#define SHA1_DIGEST_LENGTH 20 - -void SHA1_NEW( unsigned char * pData, int length, unsigned char * pDigest); - -#endif /* !SHA1_H */ +/* + * rcracki_mt is a multithreaded implementation and fork of the original + * RainbowCrack + * + * 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 SHA1_H +#define SHA1_H + +#include "global.h" + +#define SHA1_DIGEST_LENGTH 20 + +void SHA1_NEW( unsigned char * pData, int length, unsigned char * pDigest); + +#endif /* !SHA1_H */ diff --git a/Client Applications/rti2rto/Makefile b/Client Applications/rti2rto/Makefile index f9ca133..2494a84 100644 --- a/Client Applications/rti2rto/Makefile +++ b/Client Applications/rti2rto/Makefile @@ -1,7 +1,7 @@ SHELL = /bin/sh CC = g++ OPTIMIZATION = -O3 -INCLUDES = -I../../Common/rt\ api -I../../Server\ Applications/rsearchi +INCLUDES = -I../../Common/rt\ api CFLAGS = -Wall -ansi $(INCLUDES) $(OPTIMIZATION) -c $(DEBUG) LFLAGS = -Wall -ansi $(INCLUDES) $(OPTIMIZATION) $(DEBUG) LIBS = diff --git a/Client Applications/rti2rto/rti2rto.cpp b/Client Applications/rti2rto/rti2rto.cpp index e69ed18..ba7f163 100644 --- a/Client Applications/rti2rto/rti2rto.cpp +++ b/Client Applications/rti2rto/rti2rto.cpp @@ -87,6 +87,7 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, string sType) sFileName = sPathName.substr(nIndex + 1); else sFileName = sPathName; + // Info printf("%s:\n", sFileName.c_str()); FILE *fResult = fopen(sResultFileName.c_str(), "wb"); @@ -98,7 +99,6 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, string sType) static CMemoryPool mp; unsigned int nAllocatedSize; BaseRTReader *reader = NULL; - if(sType == "RTI2") reader = (BaseRTReader*)new RTI2Reader(sFileName); else if(sType == "RTI") @@ -108,15 +108,27 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, string sType) printf("Invalid table type '%s'", sType.c_str()); return ; } - - RainbowChainCP* pChain = (RainbowChainCP*)mp.Allocate(reader->GetChainsLeft() * sizeof(RainbowChainCP), nAllocatedSize); + int size = reader->GetChainsLeft() * sizeof(RainbowChain); +#ifdef _MEMORYDEBUG + printf("Starting allocation of %i bytes\n", size); +#endif + RainbowChain* pChain = (RainbowChain*)mp.Allocate(size, nAllocatedSize); +#ifdef _MEMORYDEBUG + printf("Finished. Got %i bytes\n", nAllocatedSize); +#endif if (pChain != NULL) { - nAllocatedSize = nAllocatedSize / sizeof(RainbowChainCP) * sizeof(RainbowChainCP); // Round to boundary - unsigned int nChains = nAllocatedSize / sizeof(RainbowChainCP); + nAllocatedSize = nAllocatedSize / sizeof(RainbowChain) * sizeof(RainbowChain); // Round to boundary + unsigned int nChains = nAllocatedSize / sizeof(RainbowChain); while(reader->GetChainsLeft() > 0) { +#ifdef _MEMORYDEBUG + printf("Grabbing %i chains from file\n", nChains); +#endif reader->ReadChains(nChains, pChain); +#ifdef _MEMORYDEBUG + printf("Recieved %i chains from file\n", nChains); +#endif for(uint32 i = 0; i < nChains; i++) { fwrite(&pChain[i], 1, 16, fResult); diff --git a/Client Applications/rti2rto/rti2rto.sln b/Client Applications/rti2rto/rti2rto.sln deleted file mode 100644 index a8000e5..0000000 --- a/Client Applications/rti2rto/rti2rto.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rti2rto", "rti2rto.vcproj", "{E0FBC06A-C902-4468-A614-CBF9F591AA7C}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E0FBC06A-C902-4468-A614-CBF9F591AA7C}.Debug|Win32.ActiveCfg = Debug|Win32 - {E0FBC06A-C902-4468-A614-CBF9F591AA7C}.Debug|Win32.Build.0 = Debug|Win32 - {E0FBC06A-C902-4468-A614-CBF9F591AA7C}.Release|Win32.ActiveCfg = Release|Win32 - {E0FBC06A-C902-4468-A614-CBF9F591AA7C}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Client Applications/rti2rto/rti2rto.suo b/Client Applications/rti2rto/rti2rto.suo deleted file mode 100644 index 023dd88..0000000 Binary files a/Client Applications/rti2rto/rti2rto.suo and /dev/null differ diff --git a/Client Applications/rti2rto/rti2rto.vcproj b/Client Applications/rti2rto/rti2rto.vcproj deleted file mode 100644 index 2dc3546..0000000 --- a/Client Applications/rti2rto/rti2rto.vcproj +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Client Applications/win_build/clientapps.sln b/Client Applications/win_build/clientapps.sln new file mode 100644 index 0000000..df922d7 --- /dev/null +++ b/Client Applications/win_build/clientapps.sln @@ -0,0 +1,32 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "converti2", "..\converti2\converti2.vcxproj", "{066FD6F1-5990-47AD-B095-7AE0029CF5AE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rcracki_mt", "..\rcracki_mt\rcracki_mt.vcxproj", "{966DA4B4-E13C-449D-9A93-303C6FEA25C4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rti2rto", "..\rti2rto\rti2rto.vcxproj", "{E0FBC06A-C902-4468-A614-CBF9F591AA7C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {066FD6F1-5990-47AD-B095-7AE0029CF5AE}.Debug|Win32.ActiveCfg = Debug|Win32 + {066FD6F1-5990-47AD-B095-7AE0029CF5AE}.Debug|Win32.Build.0 = Debug|Win32 + {066FD6F1-5990-47AD-B095-7AE0029CF5AE}.Release|Win32.ActiveCfg = Release|Win32 + {066FD6F1-5990-47AD-B095-7AE0029CF5AE}.Release|Win32.Build.0 = Release|Win32 + {966DA4B4-E13C-449D-9A93-303C6FEA25C4}.Debug|Win32.ActiveCfg = Debug|Win32 + {966DA4B4-E13C-449D-9A93-303C6FEA25C4}.Debug|Win32.Build.0 = Debug|Win32 + {966DA4B4-E13C-449D-9A93-303C6FEA25C4}.Release|Win32.ActiveCfg = Release|Win32 + {966DA4B4-E13C-449D-9A93-303C6FEA25C4}.Release|Win32.Build.0 = Release|Win32 + {E0FBC06A-C902-4468-A614-CBF9F591AA7C}.Debug|Win32.ActiveCfg = Debug|Win32 + {E0FBC06A-C902-4468-A614-CBF9F591AA7C}.Debug|Win32.Build.0 = Debug|Win32 + {E0FBC06A-C902-4468-A614-CBF9F591AA7C}.Release|Win32.ActiveCfg = Release|Win32 + {E0FBC06A-C902-4468-A614-CBF9F591AA7C}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Client Applications/win_build/clientapps.suo b/Client Applications/win_build/clientapps.suo new file mode 100644 index 0000000..6791d07 Binary files /dev/null and b/Client Applications/win_build/clientapps.suo differ diff --git a/Common/rt api/BaseRTReader.h b/Common/rt api/BaseRTReader.h index 66f2f10..a9923cf 100644 --- a/Common/rt api/BaseRTReader.h +++ b/Common/rt api/BaseRTReader.h @@ -37,9 +37,10 @@ using namespace std; class BaseRTReader { public: - virtual int ReadChains(unsigned int &numChains, RainbowChainCP *pData) = 0; - virtual unsigned int GetChainsLeft() = 0; + virtual int ReadChains(UINT4 &numChains, RainbowChain *pData) = 0; + virtual UINT4 GetChainsLeft() = 0; + virtual ~BaseRTReader() { }; }; #endif diff --git a/Common/rt api/MemoryPool.cpp b/Common/rt api/MemoryPool.cpp index 053db7a..a674507 100644 --- a/Common/rt api/MemoryPool.cpp +++ b/Common/rt api/MemoryPool.cpp @@ -45,8 +45,10 @@ CMemoryPool::CMemoryPool() CMemoryPool::~CMemoryPool() { - if (m_pMem != NULL) - { + if (m_pMem != NULL) { +#ifdef _MEMORYDEBUG + printf("Freeing %i bytes of memory\n", m_nMemSize); +#endif delete [] m_pMem; m_pMem = NULL; m_nMemSize = 0; @@ -55,21 +57,23 @@ CMemoryPool::~CMemoryPool() unsigned char* CMemoryPool::Allocate(unsigned int nFileLen, unsigned int& nAllocatedSize) { - if (nFileLen <= m_nMemSize) - { + if (nFileLen <= m_nMemSize) { nAllocatedSize = nFileLen; return m_pMem; } unsigned int nTargetSize; - if (nFileLen < m_nMemMax) + if (nFileLen < m_nMemMax) { nTargetSize = nFileLen; - else + } + else { nTargetSize = m_nMemMax; - + } // Free existing memory - if (m_pMem != NULL) - { + if (m_pMem != NULL) { +#ifdef _MEMORYDEBUG + printf("Freeing %i bytes of memory\n", m_nMemSize); +#endif delete [] m_pMem; m_pMem = NULL; m_nMemSize = 0; @@ -77,22 +81,29 @@ unsigned char* CMemoryPool::Allocate(unsigned int nFileLen, unsigned int& nAlloc // Allocate new memory //printf("allocating %u bytes memory\n", nTargetSize); + // m_pMem = new unsigned char[nTargetSize]; +#ifdef _MEMORYDEBUG + printf("Allocating %i bytes of memory - ", nTargetSize); +#endif + m_pMem = new (nothrow) unsigned char[nTargetSize]; - while (m_pMem == NULL && nTargetSize >= 512 * 1024 * 1024 ) - { - nTargetSize -= 16 * 1024 * 1024; - m_pMem = new (nothrow) unsigned char[nTargetSize]; + while (m_pMem == NULL && nTargetSize >= 512 * 1024 * 1024 ) { +#ifdef _MEMORYDEBUG + printf("failed!\n"); + printf("Allocating %i bytes of memory (backup) - ", nTargetSize); +#endif + nTargetSize -= 16 * 1024 * 1024; + m_pMem = new (nothrow) unsigned char[nTargetSize]; } - - if (m_pMem != NULL) - { + if (m_pMem != NULL) { +#ifdef _MEMORYDEBUG + printf("success!\n"); +#endif m_nMemSize = nTargetSize; nAllocatedSize = nTargetSize; return m_pMem; } - else - { - m_nMemSize = 0; + else { nAllocatedSize = 0; return NULL; } diff --git a/Common/rt api/Public.cpp b/Common/rt api/Public.cpp index 6cd0482..b42c954 100644 --- a/Common/rt api/Public.cpp +++ b/Common/rt api/Public.cpp @@ -209,6 +209,39 @@ bool GetHybridCharsets(string sCharset, vector& vCharset) bool boinc_ReadLinesFromFile(string sPathName, vector& vLine) { vLine.clear(); +#ifdef 0 + vLine.push_back("byte = []"); + vLine.push_back("alpha = [ABCDEFGHIJKLMNOPQRSTUVWXYZ]"); + vLine.push_back("alpha-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ ]"); + vLine.push_back("alpha-numeric = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]"); + vLine.push_back("alpha-numeric-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ]"); + vLine.push_back("alpha-numeric-symbol14 = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D]"); + vLine.push_back("alpha-numeric-symbol14-space= [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x20]"); + vLine.push_back("all = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F]"); + vLine.push_back("all-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F\x20]"); + vLine.push_back("alpha-numeric-symbol32-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F\x20]"); + vLine.push_back("lm-frt-cp437 = [\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2A\x2B\x2C\x2D\x2E\x2F\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x5B\x5C\x5D\x5E\x5F\x60\x7B\x7C\x7D\x7E\x80\x8E\x8F\x90\x92\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA5\xE0\xE1\xE2\xE3\xE4\xE6\xE7\xE8\xE9\xEA\xEB\xEE]"); + vLine.push_back("lm-frt-cp850 = [\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2A\x2B\x2C\x2D\x2E\x2F\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x5B\x5C\x5D\x5E\x5F\x60\x7B\x7C\x7D\x7E\x80\x8E\x8F\x90\x92\x99\x9A\x9C\x9D\x9F\xA5\xB5\xB6\xB7\xBD\xBE\xC7\xCF\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xDE\xE0\xE1\xE2\xE3\xE5\xE6\xE8\xE9\xEA\xEB\xED\xEF]"); + vLine.push_back("lm-frt-cp437-850 = [\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2A\x2B\x2C\x2D\x2E\x2F\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x5B\x5C\x5D\x5E\x5F\x60\x7B\x7C\x7D\x7E\x80\x8E\x8F\x90\x92\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA5\xB5\xB6\xB7\xBD\xBE\xC7\xCF\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xDE\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xED\xEE\xEF]"); + vLine.push_back("numeric = [0123456789]"); + vLine.push_back("numeric-space = [0123456789 ]"); + vLine.push_back("loweralpha = [abcdefghijklmnopqrstuvwxyz]"); + vLine.push_back("loweralpha-space = [abcdefghijklmnopqrstuvwxyz ]"); + vLine.push_back("loweralpha-numeric = [abcdefghijklmnopqrstuvwxyz0123456789]"); + vLine.push_back("loweralpha-numeric-space = [abcdefghijklmnopqrstuvwxyz0123456789 ]"); + vLine.push_back("loweralpha-numeric-symbol14 = [abcdefghijklmnopqrstuvwxyz0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D]"); + vLine.push_back("loweralpha-numeric-all = [abcdefghijklmnopqrstuvwxyz0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F]"); + vLine.push_back("loweralpha-numeric-symbol32-space= [abcdefghijklmnopqrstuvwxyz0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F\x20]"); + vLine.push_back("mixalpha = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]"); + vLine.push_back("mixalpha-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ]"); + vLine.push_back("mixalpha-numeric = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]"); + vLine.push_back("mixalpha-numeric-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ]"); + vLine.push_back("mixalpha-numeric-symbol14 = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D]"); + vLine.push_back("mixalpha-numeric-all = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F]"); + vLine.push_back("mixalpha-numeric-symbol32-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F\x20]"); + vLine.push_back("mixalpha-numeric-all-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F\x20]"); +#endif + char input_path[512]; boinc_resolve_filename(sPathName.c_str(), input_path, sizeof(input_path)); FILE *file = boinc_fopen(input_path, "rb"); diff --git a/Common/rt api/RTI2Reader.cpp b/Common/rt api/RTI2Reader.cpp index 6fb0cb9..ad7db3d 100644 --- a/Common/rt api/RTI2Reader.cpp +++ b/Common/rt api/RTI2Reader.cpp @@ -47,7 +47,11 @@ RTI2Reader::RTI2Reader(string Filename) long len = GetFileLen(pFileIndex); fseek(pFileIndex, 0, SEEK_SET); - m_pIndex = new unsigned char[len]; + m_pIndex = new (nothrow) unsigned char[len]; + if(m_pIndex == NULL) { + printf("Error allocating %ld MB memory for index in RTI2Reader::RTI2Reader()", len / (1024 * 1024)); + exit(-2); + } if(fread(m_pIndex, 1, len, pFileIndex) != (unsigned long)len) { printf("Error while reading index file"); @@ -66,7 +70,7 @@ RTI2Reader::RTI2Reader(string Filename) fseek(m_pFile, 0, SEEK_SET); if(len % m_chainsizebytes > 0) { - printf("Invalid filesize %ld\n", len); + printf("Invalid filesize %lu\n", len); return; } @@ -86,7 +90,7 @@ unsigned int RTI2Reader::GetChainsLeft() return len / m_chainsizebytes - m_chainPosition; } -int RTI2Reader::ReadChains(unsigned int &numChains, RainbowChainCP *pData) +int RTI2Reader::ReadChains(unsigned int &numChains, RainbowChain *pData) { if(strncmp(m_pHeader->header, "RTI2", 4) != 0) { diff --git a/Common/rt api/RTI2Reader.h b/Common/rt api/RTI2Reader.h index 902344a..db3d446 100644 --- a/Common/rt api/RTI2Reader.h +++ b/Common/rt api/RTI2Reader.h @@ -59,7 +59,7 @@ private: public: RTI2Reader(string Filename); ~RTI2Reader(void); - int ReadChains(unsigned int &numChains, RainbowChainCP *pData); + int ReadChains(uint32 &numChains, RainbowChain *pData); unsigned int GetChainsLeft(); static RTI2Header *GetHeader() { return m_pHeader; } }; diff --git a/Common/rt api/RTIReader.cpp b/Common/rt api/RTIReader.cpp index 1a97786..374b062 100644 --- a/Common/rt api/RTIReader.cpp +++ b/Common/rt api/RTIReader.cpp @@ -21,19 +21,34 @@ RTIReader::RTIReader(string Filename) long nFileLen = GetFileLen(m_pFile); unsigned int nTotalChainCount = nFileLen / 8; if (nFileLen % 8 != 0) - printf("file length mismatch (%ld bytes)\n", nFileLen); + printf("file length mismatch (%lu bytes)\n", nFileLen); else { // File length check if (nIndexFileLen % 11 != 0) - printf("index file length mismatch (%ld bytes)\n", nIndexFileLen); + printf("index file length mismatch (%lu bytes)\n", nIndexFileLen); else { - m_pIndex = new IndexChain[nIndexFileLen / 11]; + if(m_pIndex != NULL) { + delete m_pIndex; + m_pIndex = NULL; + } +#ifdef _MEMORYDEBUG + printf("Allocating %u MB memory for RTIReader::m_pIndex", nIndexFileLen / 11 / (1024 * 1024)); +#endif + m_pIndex = new (nothrow) IndexChain[nIndexFileLen / 11]; + if(m_pIndex == NULL) { + printf("\nFailed allocating %ld MB memory.\n", nIndexFileLen / 11 / (1024 * 1024)); + exit(-2); + } +#ifdef _MEMORYDEBUG + printf(" - success!\n"); +#endif memset(m_pIndex, 0x00, sizeof(IndexChain) * (nIndexFileLen / 11)); fseek(pFileIndex, 0, SEEK_SET); - int nRows; - for(nRows = 0; (nRows * 11) < nIndexFileLen; nRows++) + //int nRead = 0; + uint32 nRows; + for(nRows = 0; (nRows * 11) < (uint32)nIndexFileLen; nRows++) { if(fread(&m_pIndex[nRows].nPrefix, 5, 1, pFileIndex) != 1) break; if(fread(&m_pIndex[nRows].nFirstChain, 4, 1, pFileIndex) != 1) break; @@ -59,7 +74,7 @@ RTIReader::RTIReader(string Filename) } if(m_pIndex[m_nIndexSize - 1].nFirstChain + m_pIndex[m_nIndexSize - 1].nChainCount > nTotalChainCount) // +1 is not needed here { - printf("Corrupted index detected: The index is covering more than the file\n"); + printf("Corrupted index detected: The index is covering more than the file (%i chains of %i chains)\n", m_pIndex[m_nIndexSize - 1].nFirstChain + m_pIndex[m_nIndexSize - 1].nChainCount, nTotalChainCount); exit(-1); } @@ -75,13 +90,13 @@ RTIReader::RTIReader(string Filename) } -int RTIReader::ReadChains(unsigned int &numChains, RainbowChainCP *pData) +int RTIReader::ReadChains(unsigned int &numChains, RainbowChain *pData) { // We HAVE to reset the data to 0x00's or we will get in trouble - memset(pData, 0x00, sizeof(RainbowChainCP) * numChains); + memset(pData, 0x00, sizeof(RainbowChain) * numChains); unsigned int readChains = 0; unsigned int chainsleft = GetChainsLeft(); - for(unsigned int i = 0; i < m_nIndexSize; i++) + for(UINT4 i = 0; i < m_nIndexSize; i++) { if(m_chainPosition + readChains > m_pIndex[i].nFirstChain + m_pIndex[i].nChainCount) // We found the matching index continue; @@ -97,15 +112,17 @@ int RTIReader::ReadChains(unsigned int &numChains, RainbowChainCP *pData) } if(readChains == numChains) break; } - if(readChains != numChains) numChains = readChains; // Update how many chains we read + if(readChains != numChains) { + numChains = readChains; // Update how many chains we read + } m_chainPosition += readChains; + printf("Chain position is now %u\n", m_chainPosition); return 0; } -unsigned int RTIReader::GetChainsLeft() -{ - int len = GetFileLen(m_pFile) / 8 - m_chainPosition; - return len; +UINT4 RTIReader::GetChainsLeft() +{ + return (GetFileLen(m_pFile) / 8) - m_chainPosition; } RTIReader::~RTIReader(void) diff --git a/Common/rt api/RTIReader.h b/Common/rt api/RTIReader.h index 6d53e80..775ff0a 100644 --- a/Common/rt api/RTIReader.h +++ b/Common/rt api/RTIReader.h @@ -20,7 +20,7 @@ public: RTIReader(string Filename); ~RTIReader(void); - int ReadChains(unsigned int &numChains, RainbowChainCP *pData); + int ReadChains(unsigned int &numChains, RainbowChain *pData); unsigned int GetChainsLeft(); }; diff --git a/Common/rt api/RTReader.cpp b/Common/rt api/RTReader.cpp index b0de54e..7fec667 100644 --- a/Common/rt api/RTReader.cpp +++ b/Common/rt api/RTReader.cpp @@ -9,14 +9,14 @@ RTReader::~RTReader(void) { } -int RTReader::ReadChains(unsigned int &numChains, RainbowChainCP *pData) +int RTReader::ReadChains(unsigned int &numChains, RainbowChain *pData) { unsigned int numRead = fread(pData, 1, 16 * numChains, m_pFile); numChains = numRead / 16; + m_chainPosition += numChains; return 0; } -unsigned int RTReader::GetChainsLeft() +UINT4 RTReader::GetChainsLeft() { - unsigned int len = GetFileLen(m_pFile); - return len / 16 - m_chainPosition; + return (GetFileLen(m_pFile) / 16) - m_chainPosition; } diff --git a/Common/rt api/RTReader.h b/Common/rt api/RTReader.h index 3d189c3..d78261b 100644 --- a/Common/rt api/RTReader.h +++ b/Common/rt api/RTReader.h @@ -18,7 +18,7 @@ private: public: RTReader(string Filename); ~RTReader(void); - int ReadChains(unsigned int &numChains, RainbowChainCP *pData); + int ReadChains(unsigned int &numChains, RainbowChain *pData); unsigned int GetChainsLeft(); }; diff --git a/Common/rt api/des_enc.c b/Common/rt api/des_enc.c index a2dd913..f2c99b7 100644 --- a/Common/rt api/des_enc.c +++ b/Common/rt api/des_enc.c @@ -60,9 +60,11 @@ */ #include "des_locl.h" -#include "spr.h" +//#include "spr.h" extern const DES_LONG des_SPtrans[8][64]; + + void des_encrypt1(DES_LONG *data, des_key_schedule ks, int enc) { register DES_LONG l,r,t,u; diff --git a/Common/rt api/ecb_enc.c b/Common/rt api/ecb_enc.c index 4a6093d..63d209a 100644 --- a/Common/rt api/ecb_enc.c +++ b/Common/rt api/ecb_enc.c @@ -51,11 +51,13 @@ #include #include "des_locl.h" -#include "spr.h" +//#include "spr.h" /* char *libdes_version="libdes v 3.24 - 20-Apr-1996 - eay"; */ /* wrong */ /* char *DES_version="DES part of SSLeay 0.6.4 30-Aug-1996"; */ +extern const DES_LONG des_SPtrans[8][64]; + char *des_options(void) { static int init=1; diff --git a/Common/rt api/md4.h b/Common/rt api/md4.h index 249ebcd..f83aa1a 100644 --- a/Common/rt api/md4.h +++ b/Common/rt api/md4.h @@ -3,6 +3,9 @@ #include "global.h" + +#define MD4_DIGEST_LENGTH 16 + //Main function void MD4_NEW( unsigned char * buf, int len, unsigned char * pDigest); diff --git a/Common/rt api/sk.h b/Common/rt api/sk.h index 209dca6..b91473a 100644 --- a/Common/rt api/sk.h +++ b/Common/rt api/sk.h @@ -47,7 +47,6 @@ * copied and put under another distribution licence * [including the GNU Public Licence.] */ - static const DES_LONG des_skb[8][64]={ { /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ diff --git a/Common/rt api/spr.h b/Common/rt api/spr.h index 4fd00b6..187cd26 100644 --- a/Common/rt api/spr.h +++ b/Common/rt api/spr.h @@ -59,6 +59,9 @@ * [including the GNU Public Licence.] */ +#ifndef __SPR_H__ +#define __SPR_H__ + const DES_LONG des_SPtrans[8][64]={ { /* nibble 0 */ @@ -205,3 +208,5 @@ const DES_LONG des_SPtrans[8][64]={ 0x00000080L, 0x20820000L, 0x00820080L, 0x00000000L, 0x20000000L, 0x20800080L, 0x00020000L, 0x00820080L, }}; + +#endif \ No newline at end of file