library/src/exploitation/WebExploitation/BP-WebExploitTestResultAnalysis.cc
// Returns an analysis index set which contains the matches for the given
// format tests.
Returns an analysis index set which contains the matches for the given
format tests.
Returns an analysis index set which contains the matches for the given format tests .
P_BP_WEB_ANALYSIS_RESULT_INDEX_SET BP_WebAssessmentRunTests(P_BP_WEB_ASSESSMENT assessment, BP_FMT_ERR_TESTS * tests, size_t testCount)
{
	if(!assessment || !tests || !testCount)
		return NULL;
	P_BP_WEB_ANALYSIS_RESULT_INDEX_SET indexSet = (P_BP_WEB_ANALYSIS_RESULT_INDEX_SET) bpcalloc(sizeof(BP_WEB_ANALYSIS_RESULT_INDEX_SET), 1);
	if(!indexSet)
		return NULL;
	char *pageData = assessment->session->page->page_data;
	size_t pageSize = assessment->session->page->page_data_size;
	size_t x = 0;
	size_t i = 0;
	for(i = 0; i < testCount-1; i++)
	{
		if(i == 146)
		{
		}
		if(BP_TestMatchSet(pageData, pageSize, &tests[i]) == true)
		{
			indexSet->matchCount++;
			indexSet->matchIndexes = (size_t *) bprealloc(indexSet->matchIndexes, sizeof(size_t) * indexSet->matchCount);
			indexSet->matchIndexes[indexSet->matchCount-1] = i;
		}
	}
	if(indexSet->matchCount == 0)
	{
		bpfree(indexSet);
		return NULL;
	}
	return indexSet;
}
P_BP_WEB_ANALYSIS_RESULT_INDEX_SET BP_WebAssessmentRunTests ( P_BP_WEB_ASSESSMENT assessment , BP_FMT_ERR_TESTS * tests , size_t testCount ) { if ( ! assessment || ! tests || ! testCount ) return NULL ; P_BP_WEB_ANALYSIS_RESULT_INDEX_SET indexSet = ( P_BP_WEB_ANALYSIS_RESULT_INDEX_SET ) bpcalloc ( sizeof ( BP_WEB_ANALYSIS_RESULT_INDEX_SET ) , 1 ) ; if ( ! indexSet ) return NULL ; char * pageData = assessment -> session -> page -> page_data ; size_t pageSize = assessment -> session -> page -> page_data_size ; size_t x = 0 ; size_t i = 0 ; for ( i = 0 ; i < testCount - 1 ; i ++ ) { if ( i == 146 ) { } if ( BP_TestMatchSet ( pageData , pageSize , & tests [ i ] ) == true ) { indexSet -> matchCount ++ ; indexSet -> matchIndexes = ( size_t * ) bprealloc ( indexSet -> matchIndexes , sizeof ( size_t ) * indexSet -> matchCount ) ; indexSet -> matchIndexes [ indexSet -> matchCount - 1 ] = i ; } } if ( indexSet -> matchCount == 0 ) { bpfree ( indexSet ) ; return NULL ; } return indexSet ; }
Returns an analysis index set which contains the matches for the given
format tests.
Returns an analysis index set which contains the matches for the given format tests .
// Null checks // create new index set // save page data pointer // save page size pointer // tmp for validation of algorithm, remove when done validating // Walk tests and create linked list element when matched //	asm("int3"); // set the actual match index to the position in the array which the // match was found. // check if we've made matches, if not, destroy // if we have matches, we can return them