library/src/exploitation/WebExploitation/BlindSQLiDetection/BP-WebExploitationBlindSQLiDetection.cc
// Generates a completed union select string suitable for use in blind
// sqli testing.  All strings must be null terminated.
Generates a completed union select string suitable for use in blind
sqli testing.  All strings must be null terminated.
Generates a completed union select string suitable for use in blind sqli testing . All strings must be null terminated .
char * BP_WebExploitationBlindSQLiCreateExploitStr(char *test_front, char ** test_positions, char *test_tail)
{
	if(!test_front || !test_positions || !test_tail)
	{
		return NULL;
	}
	if(!test_positions[0])
		return NULL;
	size_t i = 0;
	char *middle_part = NULL;
	size_t middle_str_len = 0;
	for(; test_positions[i]; i++)
	{
		middle_str_len += bpstrlen(test_positions[i]) + 5;
	}
	if(!middle_str_len)
		return NULL;
	middle_part = (char *) bpcalloc(middle_str_len + bpstrlen(test_front) + bpstrlen(test_tail) + 10, 1);
	strncat(middle_part, test_front, 1024);
	for(i = 0; test_positions[i]; i++)
	{
		strncat(middle_part, test_positions[i], 512);
		strcat(middle_part, ",");
	}
	if(middle_part[bpstrlen(middle_part)-1] == ',')
		middle_part[bpstrlen(middle_part)-1] = '\0';
	strncat(middle_part, test_tail, 1024);
	return middle_part;
}
char * BP_WebExploitationBlindSQLiCreateExploitStr ( char * test_front , char * * test_positions , char * test_tail ) { if ( ! test_front || ! test_positions || ! test_tail ) { return NULL ; } if ( ! test_positions [ 0 ] ) return NULL ; size_t i = 0 ; char * middle_part = NULL ; size_t middle_str_len = 0 ; for ( ; test_positions [ i ] ; i ++ ) { middle_str_len += bpstrlen ( test_positions [ i ] ) + 5 ; } if ( ! middle_str_len ) return NULL ; middle_part = ( char * ) bpcalloc ( middle_str_len + bpstrlen ( test_front ) + bpstrlen ( test_tail ) + 10 , 1 ) ; strncat ( middle_part , test_front , 1024 ) ; for ( i = 0 ; test_positions [ i ] ; i ++ ) { strncat ( middle_part , test_positions [ i ] , 512 ) ; strcat ( middle_part , " " ) ; } if ( middle_part [ bpstrlen ( middle_part ) - 1 ] == ' ' ) middle_part [ bpstrlen ( middle_part ) - 1 ] = ' \0 ' ; strncat ( middle_part , test_tail , 1024 ) ; return middle_part ; }
Generates a completed union select string suitable for use in blind
sqli testing.
Generates a completed union select string suitable for use in blind sqli testing .
// all pointers must be set to continue // must have at least one position // loop iterator // middle part of the union select string (the variable positions) // size of the middle string (grows) // calculate total length of positions // calculate position length // calculate middle string length // populate middle string // truncate along border to remove comma // add the tail // return the fixed up string