library/src/exploitation/WebExploitation/BP-WebExploitation.cc
// Creates a full list of assessments provided an anchor list,
// in the case of an encountered anchor which is not HTTP, the baseURL parameter is
// prefixed to the new assessment, which is useful for relative anchors.  If the
// anchor contains a prefix of http(s):// this will not be used.
Creates a full list of assessments provided an anchor list,
in the case of an encountered anchor which is not HTTP, the baseURL parameter is
prefixed to the new assessment, which is useful for relative anchors.  If the
anchor contains a prefix of http(s):// this will not be used.
Creates a full list of assessments provided an anchor list in the case of an encountered anchor which is not HTTP the baseURL parameter is prefixed to the new assessment which is useful for relative anchors . If the anchor contains a prefix of http ( s ) : // this will not be used .
P_BP_WEB_ASSESSMENT BP_CreateWebAssessmentsFromAnchors(P_BP_WEB_ASSESSMENT appendList, char *baseURL, P_BP_HTML_ANCHOR_LIST anchors) {
	if (!anchors || !baseURL)
		return NULL;
	size_t firstIndicator = 0;
	P_BP_WEB_ASSESSMENT outList = NULL;
	P_BP_WEB_ASSESSMENT genElement = NULL;
	if (appendList != NULL)
		outList = appendList;
	char baseStr[4096];
	for (anchors = anchors->first; anchors; anchors = anchors->next) {
		if (anchors->href == NULL)
			continue;
		memset(&baseStr, 0x00, sizeof(baseStr));
		if (anchors->proto == BP_ANCHOR_PROTO_HTTP || anchors->proto == BP_ANCHOR_PROTO_HTTPS)
		{
			snprintf(baseStr, 4000, "%s", anchors->relativePath);
		}
		else
		{
			snprintf(baseStr, 4000, "%s%s", baseURL, anchors->href);
		}
		genElement = BP_CreateWebAssessment(baseStr, NULL, NULL, true, true, true);
		if (firstIndicator > 0)
		{
			BP_AppendWebAssessmentList(outList, genElement);
		}
		else
		{
			if (outList == NULL)
				outList = genElement;
		}
		if (outList)
			firstIndicator = 1;
	}
	if (outList == NULL)
		return NULL;
	return outList->first;
}
P_BP_WEB_ASSESSMENT BP_CreateWebAssessmentsFromAnchors ( P_BP_WEB_ASSESSMENT appendList , char * baseURL , P_BP_HTML_ANCHOR_LIST anchors ) { if ( ! anchors || ! baseURL ) return NULL ; size_t firstIndicator = 0 ; P_BP_WEB_ASSESSMENT outList = NULL ; P_BP_WEB_ASSESSMENT genElement = NULL ; if ( appendList != NULL ) outList = appendList ; char baseStr [ 4096 ] ; for ( anchors = anchors -> first ; anchors ; anchors = anchors -> next ) { if ( anchors -> href == NULL ) continue ; memset ( & baseStr , 0x00 , sizeof ( baseStr ) ) ; if ( anchors -> proto == BP_ANCHOR_PROTO_HTTP || anchors -> proto == BP_ANCHOR_PROTO_HTTPS ) { snprintf ( baseStr , 4000 , " " , anchors -> relativePath ) ; } else { snprintf ( baseStr , 4000 , " " , baseURL , anchors -> href ) ; } genElement = BP_CreateWebAssessment ( baseStr , NULL , NULL , true , true , true ) ; if ( firstIndicator > 0 ) { BP_AppendWebAssessmentList ( outList , genElement ) ; } else { if ( outList == NULL ) outList = genElement ; } if ( outList ) firstIndicator = 1 ; } if ( outList == NULL ) return NULL ; return outList -> first ; }
Creates a full list of assessments provided an anchor list,
in the case of an encountered anchor which is not HTTP, the baseURL parameter is
prefixed to the new assessment, which is useful for relative anchors.
Creates a full list of assessments provided an anchor list in the case of an encountered anchor which is not HTTP the baseURL parameter is prefixed to the new assessment which is useful for relative anchors .
// cannot have null anchors or baseURL // Indicates if the loop is appending or not // create 4096 bytes of stack space for our builder buff // walk anchor list and create assessments around it // zero out base buffer // If the protocol is not 0, then its offsite (change later) // Session and Extraction are Null (safe to use stackbuff, as its bpstrdup'd) // append list to outlist // set as first if we are at the first position // ONLY NECESSARY IF A NULL APPEND WAS PASSED. // only increment first, if we could generate a element // based on anchor properties. // set outlist pointer // return first pointer