library/src/exploitation/BP-LinuxExploitation.cc
// Creates a C styled exploit buffer given a name, id, and length
Creates a C styled exploit buffer given a name, id, and length
Creates a C styled exploit buffer given a name id and length
char * ExploitCreateBuffer_C(char * name, char *id, int size){
	char *exploitBuffer = (char *) bpmalloc(10000);
	memset(exploitBuffer, 0x00, 10000);
	char *sizeBuff = (char *) bpmalloc(100);
	memset(sizeBuff, 0x00, 100);
	snprintf(sizeBuff, 99, "%i", size);
	strncat(exploitBuffer, "\tchar *", 7);
	strncat(exploitBuffer, name, 255);
	strncat(exploitBuffer, " = (char *) bpmalloc(", 19);
	strncat(exploitBuffer, sizeBuff, 15);
	strncat(exploitBuffer, "+1);\n", 5);
	strncat(exploitBuffer, "\tFILE *", 7);
	strncat(exploitBuffer, name, 255);
	strncat(exploitBuffer, "File = fopen(\"./payload", 24);
	strncat(exploitBuffer, id, 10);
	strncat(exploitBuffer, ".bin", 4);
	strncat(exploitBuffer, "\", \"r\");\n", 10);
	strncat(exploitBuffer, "\tfread(", 7);
	strncat(exploitBuffer, name, 255);
	strncat(exploitBuffer, ", 1, ", 5);
	strncat(exploitBuffer, sizeBuff, 255);
	strncat(exploitBuffer, ", ", 3);
	strncat(exploitBuffer, name, 255);
	strncat(exploitBuffer, "File);\n", 7); 
	strncat(exploitBuffer, "\tint ", 6);
	strncat(exploitBuffer, name, 255);
	strncat(exploitBuffer, "Size", 4);
	strncat(exploitBuffer, " = ", 5);
	strncat(exploitBuffer, sizeBuff, 255);
	strncat(exploitBuffer, ";", 1);
	return exploitBuffer;
}
char * ExploitCreateBuffer_C ( char * name , char * id , int size ) { char * exploitBuffer = ( char * ) bpmalloc ( 10000 ) ; memset ( exploitBuffer , 0x00 , 10000 ) ; char * sizeBuff = ( char * ) bpmalloc ( 100 ) ; memset ( sizeBuff , 0x00 , 100 ) ; snprintf ( sizeBuff , 99 , " " , size ) ; strncat ( exploitBuffer , " \t " , 7 ) ; strncat ( exploitBuffer , name , 255 ) ; strncat ( exploitBuffer , " " , 19 ) ; strncat ( exploitBuffer , sizeBuff , 15 ) ; strncat ( exploitBuffer , " \n " , 5 ) ; strncat ( exploitBuffer , " \t " , 7 ) ; strncat ( exploitBuffer , name , 255 ) ; strncat ( exploitBuffer , " \" " , 24 ) ; strncat ( exploitBuffer , id , 10 ) ; strncat ( exploitBuffer , " " , 4 ) ; strncat ( exploitBuffer , " \" \" \" \n " , 10 ) ; strncat ( exploitBuffer , " \t " , 7 ) ; strncat ( exploitBuffer , name , 255 ) ; strncat ( exploitBuffer , " " , 5 ) ; strncat ( exploitBuffer , sizeBuff , 255 ) ; strncat ( exploitBuffer , " " , 3 ) ; strncat ( exploitBuffer , name , 255 ) ; strncat ( exploitBuffer , " \n " , 7 ) ; strncat ( exploitBuffer , " \t " , 6 ) ; strncat ( exploitBuffer , name , 255 ) ; strncat ( exploitBuffer , " " , 4 ) ; strncat ( exploitBuffer , " " , 5 ) ; strncat ( exploitBuffer , sizeBuff , 255 ) ; strncat ( exploitBuffer , " " , 1 ) ; return exploitBuffer ; }
Creates a C styled exploit buffer given a name, id, and length
Creates a C styled exploit buffer given a name id and length
// size buffer used to inject into files // create buffer to hold our payload // open payload file // now fread // now set length variable 