library/src/utility/BP-StringUtilities.cc
char * BP_GenPHPGadgetEncodeBufferAsImplodingSScanf(unsigned char * buff, size_t buff_size, P_BP_LINKL tq)
{

	// ensure we have a buffer and a buffer size
	if(!buff || !buff_size)
		return NULL;

	// set tail queue allocator here
	P_BP_LINKL tq_in = BP_CreateLinkL("intq", BP_FALSE);

	// out buffer
	char *out_buff = NULL;

	// add the front part of the string
	tq_strdup(tq_in, "implode(sscanf(", BPLN);


	// creates a set of chr(val).'A' values, randomly selected.
	BP_GenPHPGadgetEncodeBufferAsDotJoinedChars(buff, buff_size, tq_in);

	// add trailing parenthesis
	tq_strdup(tq_in, ", \"%[^\\n]\"))", BPLN);

	// flatten the tailqueue to create string
	BP_LinkLFlattenJoinStringElements(tq_in);

	// duplicate the generated flat buffer on the passed tq
	// and store it as the return buffer.
	if(tq)
		out_buff = tq_strdup(tq, (char *) tq_in->flat_buff, BPLN);
	else
		out_buff = bpstrdup((char *) tq_in->flat_buff);

	// destroy the inner linkl
	BP_DestroyLinkL(tq_in, BP_TRUE);

	// return the packed buffer
	return out_buff;

}
// encodes a buffer by using an imploding array of chr(dec)
encodes a buffer by using an imploding array of chr(dec)
encodes a buffer by using an imploding array of chr ( dec )
char * BP_GenPHPGadgetEncodeBufferAsImplodingSScanf(unsigned char * buff, size_t buff_size, P_BP_LINKL tq)
{
	if(!buff || !buff_size)
		return NULL;
	P_BP_LINKL tq_in = BP_CreateLinkL("intq", BP_FALSE);
	char *out_buff = NULL;
	tq_strdup(tq_in, "implode(sscanf(", BPLN);
	BP_GenPHPGadgetEncodeBufferAsDotJoinedChars(buff, buff_size, tq_in);
	tq_strdup(tq_in, ", \"%[^\\n]\"))", BPLN);
	BP_LinkLFlattenJoinStringElements(tq_in);
	if(tq)
		out_buff = tq_strdup(tq, (char *) tq_in->flat_buff, BPLN);
	else
		out_buff = bpstrdup((char *) tq_in->flat_buff);
	BP_DestroyLinkL(tq_in, BP_TRUE);
	return out_buff;
}
char * BP_GenPHPGadgetEncodeBufferAsImplodingSScanf ( unsigned char * buff , size_t buff_size , P_BP_LINKL tq ) { if ( ! buff || ! buff_size ) return NULL ; P_BP_LINKL tq_in = BP_CreateLinkL ( " " , BP_FALSE ) ; char * out_buff = NULL ; tq_strdup ( tq_in , " " , BPLN ) ; BP_GenPHPGadgetEncodeBufferAsDotJoinedChars ( buff , buff_size , tq_in ) ; tq_strdup ( tq_in , " \" \\ \" " , BPLN ) ; BP_LinkLFlattenJoinStringElements ( tq_in ) ; if ( tq ) out_buff = tq_strdup ( tq , ( char * ) tq_in -> flat_buff , BPLN ) ; else out_buff = bpstrdup ( ( char * ) tq_in -> flat_buff ) ; BP_DestroyLinkL ( tq_in , BP_TRUE ) ; return out_buff ; }
encodes a buffer by using an imploding array of chr(dec)
encodes a buffer by using an imploding array of chr ( dec )
// ensure we have a buffer and a buffer size // set tail queue allocator here // out buffer // add the front part of the string // creates a set of chr(val).'A' values, randomly selected. // add trailing parenthesis // flatten the tailqueue to create string // duplicate the generated flat buffer on the passed tq // and store it as the return buffer. // destroy the inner linkl // return the packed buffer