library/src/exploitation/WebExploitation/BP-WebExploitationExploitRequestSets.cc
// Simple routine to substitute anchor variables by position.
Simple routine to substitute anchor variables by position.
Simple routine to substitute anchor variables by position .
P_BP_WEB_EXPLOIT_REQUEST_SET BP_GenWebExploitRequestSetBySubstitutingAnchorVar
(
		P_BP_HTML_ANCHOR_LIST                        anchor,
		BP_WEB_EXPLOIT_REQUEST_SET_VAR_LOOKUP        lookup_type,
		char *                                       lookup_name,
		size_t                                       lookup_index,
		char *                                       substitution_value,
		P_BP_LINKL                                   tq
)
{
	if(!tq)
		return NULL;
	if(!anchor)
		return NULL;
	if(!anchor->vars)
		return NULL;
	char * generated_string = HTMLGenerateAnchorSubstitutionString
	(
		anchor,
		anchor->vars,
		lookup_name,
		lookup_name,
		substitution_value,
		BP_FALSE,
		NULL
	);
	if(!generated_string)
		return NULL;
	P_BP_WEB_EXPLOIT_REQUEST_SET req_set = NULL;
	if(tq)
	{
		req_set           = (P_BP_WEB_EXPLOIT_REQUEST_SET) tq_calloc(tq, sizeof(BP_WEB_EXPLOIT_REQUEST_SET), 1, BPLN);
		req_set->get_str  = tq_strdup(tq, generated_string, BPLN);
	}
	else
	{
		req_set           = (P_BP_WEB_EXPLOIT_REQUEST_SET) bpcalloc(sizeof(BP_WEB_EXPLOIT_REQUEST_SET), 1);
		req_set->get_str  = bpstrdup(generated_string);
	}
	return req_set;
}
P_BP_WEB_EXPLOIT_REQUEST_SET BP_GenWebExploitRequestSetBySubstitutingAnchorVar ( P_BP_HTML_ANCHOR_LIST anchor , BP_WEB_EXPLOIT_REQUEST_SET_VAR_LOOKUP lookup_type , char * lookup_name , size_t lookup_index , char * substitution_value , P_BP_LINKL tq ) { if ( ! tq ) return NULL ; if ( ! anchor ) return NULL ; if ( ! anchor -> vars ) return NULL ; char * generated_string = HTMLGenerateAnchorSubstitutionString ( anchor , anchor -> vars , lookup_name , lookup_name , substitution_value , BP_FALSE , NULL ) ; if ( ! generated_string ) return NULL ; P_BP_WEB_EXPLOIT_REQUEST_SET req_set = NULL ; if ( tq ) { req_set = ( P_BP_WEB_EXPLOIT_REQUEST_SET ) tq_calloc ( tq , sizeof ( BP_WEB_EXPLOIT_REQUEST_SET ) , 1 , BPLN ) ; req_set -> get_str = tq_strdup ( tq , generated_string , BPLN ) ; } else { req_set = ( P_BP_WEB_EXPLOIT_REQUEST_SET ) bpcalloc ( sizeof ( BP_WEB_EXPLOIT_REQUEST_SET ) , 1 ) ; req_set -> get_str = bpstrdup ( generated_string ) ; } return req_set ; }
Simple routine to substitute anchor variables by position.
Simple routine to substitute anchor variables by position .
// ensure we have a tail queue allocator // ensure we have an anchor // ensure we have anchor vars to search through // create the string (always generate without tailqueue, it's destroyed below // exit if we can't generate the string // generate the request set // return the generated request set