Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <windows.h>
- #include <cutil.h>
- #define verh 2
- #define verl 1
- #define DWORD unsigned int
- #define MAXpasswords 199
- #define THREADS 128
- unsigned long BLOKS = 20 ;
- #define lrot32(X,Y) (((X)<<Y)|((X)>>(32-Y)))
- #define rrot32(X,Y) (((X)>>Y)|((X)<<(32-Y)))
- #define H_new 1
- #define H_bad 0
- #define H_find 5
- #define Ldata (32768*8)
- #define Cdata MAXpasswords*4+1
- #define Thdata 6 //length data returned from Nvidia
- #define hesh_md5 0
- #define hesh_md5sp 1
- struct PassBrutStruct{
- char name[27];
- char finded;
- char hash[32];
- unsigned int HASH[4];
- unsigned int salt[8];
- unsigned char csalt[33];
- char password[32];
- char coment[128];
- };
- union PD {
- DWORD d[Ldata];
- unsigned char b[Ldata*4];
- };
- union PDword {
- DWORD d;
- unsigned char b[4];
- };
- // -----------
- char password[32];
- char * pb;
- PassBrutStruct Pass[MAXpasswords];
- int PassCount;
- PD values;
- DWORD comp[Cdata];
- DWORD salt[Cdata];
- DWORD data[Thdata];
- DWORD * dvalues;
- DWORD * dcom;
- DWORD * ddata;
- DWORD * dsalt;
- int hesh_type;
- PDword gdata[16];
- //------------
- unsigned char bufr[20000000];
- int nDataLen ;
- unsigned char String[10000];
- unsigned long StringPos;
- char CharsetName[256];
- char CharSet[256];
- unsigned long CharSetLen;
- //---------------------------------------------
- bool HexStrToInt_(char * s,unsigned long * d)
- {
- for (int i=0;i<8;i++){
- *d=*d<<4;
- if ((s[i]>='0')&(s[i]<='9')) *d|=0x0+(s[i]-'0');else
- if ((s[i]>='a')&(s[i]<='f')) *d|=0xa+(s[i]-'a');else
- if ((s[i]>='A')&(s[i]<='F')) *d|=0xa+(s[i]-'A');else return false;
- }
- return true;
- }
- //---------------------------------------------
- // namber of PassBrutStruct
- bool HashToDword(DWORD N)
- {
- int nb=0;
- unsigned long tmp;
- char s[8];
- for (int H=0;H<2;H++){
- for (int i=0;i<8;i++) {s[i]=Pass[N].hash[nb++];}
- if (HexStrToInt_((char *)&s,&tmp)!=false) Pass[N].HASH[H]=tmp; else return false;
- }
- return true;
- }
- void hash_print(DWORD b8)
- {
- DWORD D=b8;
- for (int H=0;H<4;H++)
- {
- char b1 = D & 0xf; D>>=4;
- char b2 = D & 0xf; D>>=4;
- b1<10 ? b1+='0' : b1+='a'-10;
- b2<10 ? b2+='0' : b2+='a'-10;
- printf("%c%c",b2,b1);
- }
- }
- void hash_to_string(DWORD b8,char * p)
- {
- DWORD D=b8;
- char i=0;
- for (int H=0;H<4;H++)
- {
- char b1 = D & 0xf; D>>=4;
- char b2 = D & 0xf; D>>=4;
- b1<10 ? b1+='0' : b1+='a'-10;
- b2<10 ? b2+='0' : b2+='a'-10;
- p[i]=b2;i++;p[i]=b1;i++;
- }
- }
- char GetNumIn(char c)
- {
- int i=0;
- int f=0;
- while (i<CharSetLen)
- {
- if (CharSet[i]==c) { f=i; break;}
- i++;
- }
- return f;
- }
- int StringrCopy0(LPTSTR s1, LPTSTR s2)
- {
- int i=0;
- while (s2[i]!=0) {s1[i] = s2[i]; i++; }
- s1[i]=0;
- return i;
- }
- int StringrCopyI0(LPTSTR s1, LPTSTR s2, int Pos)
- {
- int i=0;
- while (s2[i+Pos]!=0) {s1[i] = s2[i+Pos]; i++; }
- s1[i]=0;
- return i;
- }
- int GetPosition(char s1, LPTSTR s2 , int Pos)
- {
- int i=0;
- int Count = 0;
- int Last = 0;
- while (s2[i]!=0)
- {
- if (s2[i] == s1)
- {
- Pos--;
- Count++;
- Last=i;
- if (Pos == 0) { return Last; }
- };
- i++;
- }
- if (Count==0) return -1; else return Last;
- }
- int StringrCopy (LPTSTR s1, LPTSTR s2 ,int From, int Count)
- {
- int i=0;
- while (Count>0) {s1[i] = s2[i+From]; i++; Count--; }
- s1[i+1]=0;
- return i;
- }
- bool CmpString (LPTSTR s1, LPTSTR s2)
- {
- int i=0;
- while (s1[i]!=0) { if (s1[i]!=s2[i]) return false; i++; }
- if ((s2[i]==' ')|(s2[i]=='=')|(s2[i]==9)) {return true;} else {return false;}
- }
- int GetString(LPTSTR s1, LPTSTR s2)
- {
- int i=StringPos;
- while ( i < nDataLen)
- {
- if ((s1[i+1] == (char)0x0A)&&(s1[i] == (char)0x0D)) {
- int retl = i - StringPos ;
- StringrCopy( s2 , (char *)&s1[StringPos] ,0,retl);
- StringPos = StringPos + (retl + 2);
- s2[retl] = 0;
- return retl;
- }
- if (s1[i] == 0) {
- int retl = i - StringPos ;
- StringrCopy( s2 , (char *)&s1[StringPos] ,0,retl);
- StringPos = StringPos + (retl + 2);
- s2[retl] = 0;
- return retl;
- }
- if (s1[i] == (char)0x0A) {
- int retl = i - StringPos ;
- StringrCopy( s2 , (char *)&s1[StringPos] ,0,retl);
- StringPos = StringPos + (retl + 1);
- s2[retl] = 0;
- return retl;
- }
- i++;
- }
- return -1;
- }
- //GetCmdLineInteger(argc, (const char**) argv, 's', &size_Start);
- void GetCmdLineInteger(int count,const char** s1,char s2, int * ret )
- {
- char str[256];
- if (count > 1) for (int i = 1; i < count; i++)
- if ((s1[i][0]==s2)&&(s1[i][1]=='='))
- {
- StringrCopy0(str,(LPTSTR)&s1[i][2]);
- sscanf_s(str, "%d", ret);
- }
- }
- // md5.h ---------------------------------------------
- // 0..9,a..z - 3 low
- //
- // const for GPU
- __constant__ unsigned long nVCharSetLen;
- __constant__ unsigned char nVCharSet[255];
- __constant__ DWORD compd[MAXpasswords*4+1];
- __global__ static void My_Sql(DWORD * values, DWORD * retd , DWORD dcount)//,DWORD * compd
- {
- //__shared__
- DWORD data[6];
- DWORD tid =(threadIdx.x << 2) + (blockIdx.x << 2)*THREADS;
- data[0]=values[tid+0];
- data[1]=(data[0] >> 8 ) & 0xff;
- data[2]=(data[0] >> 16) & 0xff;
- data[3]=(data[0] >> 24) & 0xff;
- data[0]&=0xff;
- data[4]=values[tid+1];
- data[5]=(data[4] >> 8 ) & 0xff;;
- DWORD lens =(data[4] >> 24 ) & 0xff;;
- data[4]&=0xff;
- if (lens==0) {retd[0]=1;return;}
- DWORD pcount=dcount; // PASSWORD count
- DWORD col=(95*95*lens*lens);
- DWORD f1 = 0x50305735;
- DWORD f2 = 0x12345671;
- DWORD fadd = 7;
- if (data[5]!=0){
- f1 = f1 ^ ((( (f1 & 0x3f) + fadd ) * data[5] ) + (f1 << 8));
- f2 = f2 + ((f2 << 8) ^ f1 );
- fadd = fadd + data[5];}
- if (data[4]!=0){
- f1 = f1 ^ ((( (f1 & 0x3f) + fadd ) * data[4] ) + (f1 << 8));
- f2 = f2 + ((f2 << 8) ^ f1 );
- fadd = fadd + data[4];}
- if (data[3]!=0){
- f1 = f1 ^ ((( (f1 & 0x3f) + fadd ) * data[3] ) + (f1 << 8));
- f2 = f2 + ((f2 << 8) ^ f1 );
- fadd = fadd + data[3];}
- if (data[2]!=0){
- f1 = f1 ^ ((( (f1 & 0x3f) + fadd ) * data[2] ) + (f1 << 8));
- f2 = f2 + ((f2 << 8) ^ f1 );
- fadd = fadd + data[2];}
- if (data[1]!=0){
- f1 = f1 ^ ((( (f1 & 0x3f) + fadd ) * data[1] ) + (f1 << 8));
- f2 = f2 + ((f2 << 8) ^ f1 );
- fadd = fadd + data[1];}
- if (data[0]!=0){
- f1 = f1 ^ ((( (f1 & 0x3f) + fadd ) * data[0] ) + (f1 << 8));
- f2 = f2 + ((f2 << 8) ^ f1 );
- fadd = fadd + data[0];}
- for (DWORD dd4 = 0; dd4<lens; dd4++){
- DWORD ddd4 = nVCharSet[dd4];
- DWORD f41 = f1 ^ ((( (f1 & 0x3f) + fadd ) * ddd4 ) + (f1 << 8));
- DWORD f42 = f2 + ((f2 << 8) ^ f41 );
- DWORD fadd4 = fadd + ddd4;
- for ( DWORD i=0;i<pcount;i++){
- DWORD step = (f41 & 0x3f) + fadd4;
- DWORD stepa = (f41 << 8);
- DWORD xor2 = (f42 << 8) ^ f41;
- for (DWORD dd3 = 0; dd3 < lens; dd3++) {//, xor1 += step
- DWORD ddd3 = nVCharSet[dd3];
- DWORD xor1 = step*ddd3 + stepa;
- DWORD tmp2 = f42 + (xor1 ^ xor2);
- DWORD tmp1 = f41 ^ xor1;
- DWORD tmp3 = (compd[(i*4)+2] - tmp2) ^ (tmp2 << 8);
- DWORD div = (tmp1 & 0x3f) + fadd4 + ddd3;
- DWORD diff = ((tmp3 ^ tmp1) - (tmp1 << 8)) & 0x7fffffff;
- if (diff > (div << 7)) continue;
- if (diff % div != 0) continue;
- DWORD ddd2 = diff / div;
- if (ddd2 < '!' || ddd2 > '~') continue;
- div = (tmp3 & 0x3f) + fadd4 + ddd3 + ddd2;
- diff = ((compd[(i*4)+0] ^ tmp3) - (tmp3 << 8)) & 0x7fffffff;
- if (diff > (div << 7)) continue;
- if (diff % div != 0) continue;
- DWORD dd1 = diff / div;
- if (dd1 < '!' || dd1 > '~') continue;
- retd[1]=dd1 | (ddd2 <<8) | (ddd3 <<16) | (ddd4 <<24) ;
- retd[2]=(data[1]<<8 ) | (data[2] <<16) | (data[3] <<24) | (data[0]);
- retd[3]= data[4] | (data[5]<<8 );
- retd[4]=5;
- retd[5]=i;
- return;
- }}}
- retd[0]=col;return;
- }
- DWORD hash[4];
- unsigned char shash[256];
- void pen_mysql(unsigned char * data)
- {
- DWORD f1 = 0x50305735;
- DWORD f2 = 0x12345671;
- DWORD fadd = 7;
- for (;*data;data++)
- {
- f1 = f1 ^ ((( (f1 & 0x3f) + fadd ) * *data ) + (f1 << 8));
- f2 = f2 + ((f2 << 8) ^ f1 );
- fadd = fadd + *data;
- }
- hash[0]= f1 & 0x7fffffff;
- hash[1]= f2 & 0x7fffffff;
- }
- char size;
- char sizeold;
- // ---------------------------------------------------
- // ----------------- main ----------------------------
- // ---------------------------------------------------
- int main(int argc, char** argv)
- {
- LONG dwVersion = GetVersion();
- int dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
- int dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
- printf("MySql(64) V%d.%.2d Win:v%d.%.2d\n",verh,verl,dwWindowsMajorVersion,dwWindowsMinorVersion);
- int deviceCount;
- cudaGetDeviceCount(&deviceCount);
- if (deviceCount == 0)
- {
- printf("There is no device supporting CUDA\n");
- return(0);
- }
- cudaDeviceProp deviceProp;
- cudaGetDeviceProperties(&deviceProp, 0);
- printf("CudaV%d.%.2d %s, Processors: %d Clock rate: %.3f Mg.\n",
- deviceProp.major,
- deviceProp.minor,
- deviceProp.name,
- deviceProp.multiProcessorCount*8,
- (float)deviceProp.clockRate/1000000.0);
- BLOKS=20;
- GetCmdLineInteger(argc, (const char**) argv, 'b',(int *)&BLOKS);
- BLOKS=(BLOKS >> 3)*8;
- if (BLOKS < 10) BLOKS=10;
- if (BLOKS > 512) BLOKS=512;
- __int64 pTIME,pasTIME;
- GetSystemTimeAsFileTime((FILETIME *)&pTIME);
- int size_Start=4;
- int size_End=10;
- GetCmdLineInteger(argc, (const char**) argv, 's', &size_Start);
- GetCmdLineInteger(argc, (const char**) argv, 'e', &size_End);
- size_End++;
- if (size_Start<4) size_Start=4;
- if (size_Start>size_End-1) size_Start=size_End-1;
- if (size_End>11) { printf("Sorry short version.\n"); return(0);}
- //---- Get Char Set -----------------------
- for (int i=0;i<sizeof(bufr);i++) bufr[i]=0;
- CharSetLen = 0;
- CharsetName[0] = 0;
- if (argc > 1) for (int i = 1; i < argc; i++)
- if ((argv[i][0]=='c')&(argv[i][1]=='=')) StringrCopyI0(CharsetName, argv[i],2 );
- if (CharsetName[0] == 0) StringrCopy0(CharsetName,"loweralpha-numeric");
- HANDLE file = NULL;// fopen_s(&file,"charset.txt", "r");
- file = CreateFileA("charset.txt",GENERIC_READ,0,0,OPEN_EXISTING,0,0);
- if (file != NULL)
- {
- ReadFile(file,bufr,sizeof(bufr),(LPDWORD)&nDataLen,0);
- CloseHandle(file);
- StringPos = 0;
- while ( GetString((char *)&bufr[0],(char *)&String)>=0 )
- {
- if (String[0]!='#')
- {
- if (CmpString(CharsetName,(char *)&String))
- {
- int FirstPos = GetPosition('[',(char *)&String,1);
- int LastPos = GetPosition(']',(char *)&String,0xff);
- if ((FirstPos<LastPos)&(FirstPos!=-1)&(LastPos!=-1))
- {
- CharSetLen = StringrCopy(CharSet,(char *)&String,FirstPos+1,LastPos-FirstPos-1);
- }
- }
- }
- }
- }
- if (CharSetLen==0) CharSetLen = StringrCopy0(CharSet,"asdfghjklqwertyuiopzxcvbnm1234567890");
- printf("CharSet %s = %s \n",CharsetName,CharSet);
- //---- Get Char Set ------------------- end --
- DWORD Nthread = (BLOKS*THREADS);
- char Filename[512]="mysqlpas.txt";
- if (argc!=0)
- for (int i=1;i<argc;i++)
- {
- pb=argv[i];
- if ((pb[0]=='f')&(pb[1]=='='))
- { int i1=0;while ((pb[i1]!=0)&(pb[i1]!='"')) { Filename[i1]=pb[i1+2];i1++;} Filename[i1]=0; }
- }
- for (int i=0;i<sizeof(bufr);i++) bufr[i]=0;
- int FileLength;
- HANDLE FilePas=CreateFileA(Filename,GENERIC_READ,0,0,OPEN_EXISTING,0,0);
- if (FilePas==INVALID_HANDLE_VALUE) {
- printf("There is no %s file.\n",Filename);
- return(0);
- }
- ReadFile(FilePas,bufr,sizeof(bufr),(LPDWORD)&FileLength,0);
- for (int i=0;i<sizeof(bufr);i++) if (bufr[i]==0xa) bufr[i]=0;
- for (int i=0;i<sizeof(bufr);i++) if (bufr[i]==0xd) bufr[i]=0;
- DWORD PassCount=0;
- int pos=0;
- while (pos<FileLength) {
- int posl=0;
- int next=0;
- while (bufr[pos+posl]!=0) {
- if ((bufr[pos+posl]==':')&(posl<16)&(next!=5)) {
- for(int i=0;i<posl;i++) Pass[PassCount].name[i]=bufr[pos+i]; Pass[PassCount].name[posl]=0;
- posl++;
- for(int i=0;i<16;i++) Pass[PassCount].hash[i]=bufr[pos+posl+i];
- next=5;PassCount++;
- }
- if ((posl==15)&(next!=5)) {
- for(int i=0;i<16;i++) Pass[PassCount].hash[i]=bufr[pos+i];
- next=5;if (MAXpasswords>PassCount) PassCount++; else break;
- }
- posl++;
- }
- if (next!=0)
- if (HashToDword(PassCount-1)!=false)
- {
- if (((Pass[PassCount-1].HASH[0]&0x80000000)==0 ) && ((Pass[PassCount-1].HASH[1]&0x80000000)==0 ))
- Pass[PassCount-1].finded=H_new;
- else
- PassCount--;
- }else
- PassCount--;
- pos+=(posl+1);
- }
- CloseHandle(FilePas);
- //printf("Weit \n");
- DWORD PassCountr=0;
- for (int i=0;i<PassCount;i++)
- {
- comp[i*4+0]=Pass[i].HASH[0];
- comp[i*4+1]=Pass[i].HASH[1];
- DWORD mlb = (comp[i*4+1] - comp[i*4+0]);
- mlb = comp[i*4+1] - ((mlb << 8) ^ comp[i*4+0]);
- mlb = comp[i*4+1] - ((mlb << 8) ^ comp[i*4+0]);
- mlb = comp[i*4+1] - ((mlb << 8) ^ comp[i*4+0]);
- comp[i*4+2] = mlb & 0x7fffffff;
- comp[i*4+0]&=0x7fffffff;
- comp[i*4+1]&=0x7fffffff;
- PassCountr++;
- }
- DWORD TIME=GetTickCount();
- if (PassCountr==0) {
- printf("There is no MySql hash \n");
- return(0);
- }
- DWORD f1 = 0x50305735;
- DWORD f2 = 0x12345671;
- DWORD fadd = 7;
- for (DWORD cc1='!';cc1<='~';cc1++)
- {
- DWORD f21 = f1 ^ ((( (f1 & 0x3f) + fadd ) * cc1 ) + (f1 << 8));
- DWORD f22 = f2 + ((f2 << 8) ^ f21 );
- for (int i=0;i<PassCountr;i++)
- {
- if ((comp[i*4+0]==f21)&(comp[i*4+1]==f22))
- {
- printf( "password %c \n", cc1);
- for (int i=data[5];i<PassCountr;i++)
- {
- comp[i*4+0]=comp[(i+1)*4+0];
- comp[i*4+1]=comp[(i+1)*4+1];
- comp[i*4+2]=comp[(i+1)*4+2];
- }
- PassCountr--;
- }
- }
- }
- for (DWORD cc1='!';cc1<='~';cc1++)
- {
- DWORD f21 = f1 ^ ((( (f1 & 0x3f) + fadd ) * cc1 ) + (f1 << 8));
- DWORD f22 = f2 + ((f2 << 8) ^ f21 );
- DWORD fadd2 = fadd + cc1;
- for (DWORD cc2='!';cc2<='~';cc2++)
- {
- DWORD f31 = f21 ^ ((( (f21 & 0x3f) + fadd2 ) * cc2 ) + (f21 << 8));
- DWORD f32 = f22 + ((f22 << 8) ^ f31 );
- for (DWORD i=0;i<PassCountr;i++)
- {
- if ((comp[i*4+0]==(f31&0x7fffffff))&(comp[i*4+1]==(f32&0x7fffffff)))
- {
- printf( "password %c%c \n", cc1,cc2);
- if (i<(PassCountr-1))
- for (int ii=i;ii<PassCountr;ii++)
- {
- comp[ii*4+0]=comp[(ii+1)*4+0];
- comp[ii*4+1]=comp[(ii+1)*4+1];
- comp[ii*4+2]=comp[(ii+1)*4+2];
- }
- PassCountr--;
- }
- if (i>=PassCountr) break;
- }
- }}
- for (DWORD cc1='!';cc1<='~';cc1++)
- {
- DWORD f21 = f1 ^ ((( (f1 & 0x3f) + fadd ) * cc1 ) + (f1 << 8));
- DWORD f22 = f2 + ((f2 << 8) ^ f21 );
- DWORD fadd2 = fadd + cc1;
- for (DWORD cc2='!';cc2<='~';cc2++)
- {
- DWORD f31 = f21 ^ ((( (f21 & 0x3f) + fadd2 ) * cc2 ) + (f21 << 8));
- DWORD f32 = f22 + ((f22 << 8) ^ f31 );
- DWORD fadd3 = fadd2 + cc2;
- for (DWORD cc3='!';cc3<='~';cc3++)
- {
- DWORD f41 = f31 ^ ((( (f31 & 0x3f) + fadd3 ) * cc3 ) + (f31 << 8));
- DWORD f42 = f32 + ((f32 << 8) ^ f41 );
- for (DWORD i=0;i<PassCountr;i++)
- {
- if ((comp[i*4+0]==(f41&0x7fffffff))&(comp[i*4+1]==(f42&0x7fffffff)))
- {
- printf( "password %c%c%c \n", cc1,cc2,cc3);
- for (int i=data[5];i<PassCountr;i++)
- {
- comp[i*4+0]=comp[(i+1)*4+0];
- comp[i*4+1]=comp[(i+1)*4+1];
- comp[i*4+2]=comp[(i+1)*4+2];
- }
- PassCountr--;
- }
- }
- }}}
- HANDLE OutPas=INVALID_HANDLE_VALUE;
- for (int i=1;i<argc;i++)
- {
- pb=argv[i];
- if ((pb[0]=='o')&(pb[1]=='='))
- {
- int i1=0;while ((pb[i1]!=0)&(pb[i1]!='"')) { Filename[i1]=pb[i1+2];i1++;} Filename[i1]=0;
- OutPas=CreateFileA(Filename,GENERIC_WRITE,FILE_SHARE_READ,0,OPEN_ALWAYS,0,0);
- int I=0; SetFilePointer(OutPas,I,(PLONG)&I,FILE_END);
- }
- }
- printf( "Start with %d passwords \n", PassCountr);
- CUDA_SAFE_CALL(cudaMalloc((void**)&dvalues, sizeof(DWORD) * Ldata));
- CUDA_SAFE_CALL(cudaMalloc((void**)&dcom, sizeof(DWORD) * Cdata));
- CUDA_SAFE_CALL(cudaMalloc((void**)&ddata, sizeof(DWORD) * Thdata));
- CUDA_SAFE_CALL(cudaMemcpyToSymbol(compd, comp, sizeof(DWORD) * Cdata ));
- CUDA_SAFE_CALL(cudaMemcpyToSymbol(nVCharSetLen, &CharSetLen, 4 ));
- CUDA_SAFE_CALL(cudaMemcpyToSymbol(nVCharSet, CharSet, CharSetLen ));
- //--------------------------
- DWORD f; // time
- bool founded=false;
- size=size_Start;
- sizeold=size;
- char c3,c4,c5,c6,c7,c8;
- c3=c4=c5=c6=c7=c8=0;
- //---- SET Plan -----------------------
- int Rest = 0;
- if (argc > 1) for (int i = 1; i < argc; i++)
- if ((argv[i][0]=='r')&(argv[i][1]=='=')) Rest = StringrCopyI0((char *)&String, argv[i], 2 );
- if ((Rest!=0)&&(Rest<size_End))
- {
- printf( "Restart from ????%s \n", (char *)&String[4]);
- if (Rest>4) c3=GetNumIn(String[4]);
- if (Rest>5) c4=GetNumIn(String[5]);
- if (Rest>6) c5=GetNumIn(String[6]);
- if (Rest>7) c6=GetNumIn(String[7]);
- if (Rest>8) c7=GetNumIn(String[8]);
- if (Rest>9) c8=GetNumIn(String[9]);
- size = Rest;
- sizeold=size;
- }
- //---- SET Plan ------------------- end --
- for(int i = 0; i < Ldata; i++) values.d[i] = 0;
- __int64 fsr=0;
- char fsrc=0;
- int fv=0;
- while (true) {
- if (!founded)
- {
- for(int i = 0; i < Nthread; i++)
- {
- values.b[(i*16)+7]=CharSetLen;
- if (size>4) values.b[(i*16)+0]=CharSet[c3];
- if (size>5) values.b[(i*16)+1]=CharSet[c4];
- if (size>6) values.b[(i*16)+2]=CharSet[c5];
- if (size>7) values.b[(i*16)+3]=CharSet[c6];
- if (size>8) values.b[(i*16)+4]=CharSet[c7];
- if (size>9) values.b[(i*16)+5]=CharSet[c8];
- c3++; if (c3>=CharSetLen) { if (size< 6) {size++;break;}
- c3=0;c4++; if (c4>=CharSetLen) { if (size< 7) {size++;break;}
- c4=0;c5++; if (c5>=CharSetLen) { if (size< 8) {size++;break;}
- c5=0;c6++; if (c6>=CharSetLen) { if (size< 9) {size++;break;}
- c6=0;c7++; if (c7>=CharSetLen) { if (size<10) {size++;break;}
- c7=0;c8++; if (c8>=CharSetLen) { size++;break;
- }}}}}}
- }
- }
- CUDA_SAFE_CALL(cudaMemcpy(dvalues, values.d, sizeof(DWORD) * Ldata, cudaMemcpyHostToDevice));
- data[4]=0;data[0]=0;
- CUDA_SAFE_CALL(cudaMemcpy(ddata, data, sizeof(DWORD) * Thdata , cudaMemcpyHostToDevice));
- My_Sql<<<BLOKS,THREADS>>>(dvalues,ddata,PassCountr);
- cudaMemcpy(data, ddata, sizeof(DWORD) * Thdata , cudaMemcpyDeviceToHost);
- if ((data[4]==0)&(data[0]==0)){
- printf("X.Z. nVidia driver fall down \n");
- CUDA_SAFE_CALL(cudaFree(dvalues));
- CUDA_SAFE_CALL(cudaFree(dcom));
- CUDA_SAFE_CALL(cudaFree(ddata));
- return(0);
- }
- DWORD tTIME=GetTickCount();
- TIME= tTIME-TIME;
- if (TIME!=0) f =((((__int64)Nthread*(__int64)(data[0]))/ TIME)) /1000;
- TIME= tTIME;
- if (fsrc==16)
- {
- fv=fsr / fsrc;
- fsr=0;fsrc=0;
- }
- fsrc++;
- fsr+=f;
- switch (sizeold)
- {
- case 4 :printf( "???? ");break;
- case 5 :printf( "????%c ",values.b[0]);break;
- case 6 :printf( "????%c%c ",values.b[0],values.b[1]);break;
- case 7 :printf( "????%c%c%c ",values.b[0],values.b[1],values.b[2]);break;
- case 8 :printf( "????%c%c%c%c ",values.b[0],values.b[1],values.b[2],values.b[3]);break;
- case 9 :printf( "????%c%c%c%c%c ",values.b[0],values.b[1],values.b[2],values.b[3],values.b[4]);break;
- case 10:printf( "????%c%c%c%c%c%c ",values.b[0],values.b[1],values.b[2],values.b[3],values.b[4],values.b[5]);break;
- }
- GetSystemTimeAsFileTime((FILETIME *)&pasTIME);
- DWORD s = (pasTIME - pTIME)/10000000;
- DWORD m = s / 60; s%=60;
- DWORD a = m / 60; m%=60;
- printf( "Speed = %d mln.pas/sec Time: %d.%.2d.%.2d \r", fv ,a,m,s );
- if (data[4]==5)
- {
- printf( "\a : ");
- pb=(char *)&data[1]+(sizeold-1);
- for (int i=0;i<sizeold;i++){password[i]=*pb;pb--; }
- password[sizeold]=0;
- printf( "%.8x%.8x : %s \n",comp[data[5]*4+0],comp[data[5]*4+1], password);
- if (OutPas!=INVALID_HANDLE_VALUE)
- {
- char OutPasS[32];
- int IB=StringrCopy0(OutPasS,(LPTSTR)&password);
- OutPasS[IB]=0xd;OutPasS[IB+1]=0xa;IB+=2;
- WriteFile(OutPas,OutPasS,IB,(LPDWORD)&IB,0);
- }
- if (PassCountr!=data[5]) {
- for (int i=data[5];i<PassCountr;i++)
- {
- comp[i*4+0]=comp[(i+1)*4+0];
- comp[i*4+1]=comp[(i+1)*4+1];
- comp[i*4+2]=comp[(i+1)*4+2];
- }
- }
- PassCountr--;
- CUDA_SAFE_CALL(cudaMemcpyToSymbol(compd, comp, sizeof(DWORD) * Cdata ));
- founded=true;
- } else
- {
- founded=false;
- if (sizeold!=size)
- {
- sizeold=size;
- c3=c4=c5=c6=c7=c8=0;
- }
- }
- if ((size==size_End)|(PassCountr==0)) break;
- } //while true
- // 2..5 full char ---------------------------------- end
- printf( "\n\a all checked :{", &data[1]);
- CUDA_SAFE_CALL(cudaFree(dvalues));
- CUDA_SAFE_CALL(cudaFree(dcom));
- CUDA_SAFE_CALL(cudaFree(ddata));
- CUDA_SAFE_CALL(cudaFree(dsalt));
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement