library/src/exploitation/WebExploitation/BP-WebExploitationExploitRequestSets.cc
// updates the database with http return/connect status set
updates the database with http return/connect status set
updates the database with http return / connect status set
size_t BP_WebExploitationRequestUpdateHTTPStatus(P_BP_MYSQL_SESSION db_handle, size_t record_id, size_t http_status, size_t http_connect_status)
{
	if(!db_handle)
		return ERR_FAILURE;
	if(!db_handle->system_hreg)
		return ERR_FAILURE;
	BP_HASH_TABLE_ENTER_CRITICAL_SECTION(db_handle->system_hreg);
	BP_MySQLSemLock(db_handle);
	 MYSQL_STMT * stmt = BP_MySQLPrepareQuery(db_handle, "UPDATE http_request_log SET http_status_code = ?, http_connect_code = ? WHERE id = ?");
	 if(!stmt)
	 {
		 printf("\n [+] Could not prepare statement in BP_WebExploitationRequestUpdateHTTPStatus.");
		 BP_MySQLSemUnlock(db_handle);
		 BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(db_handle->system_hreg, ERR_FAILURE);
	 }
	 MYSQL_BIND * params = (MYSQL_BIND *) bpcalloc(sizeof(MYSQL_BIND)*4, 1);
	 params[0].buffer_type= MYSQL_TYPE_LONG;
	 params[0].buffer = (char *) & http_status;
	 params[0].is_null= 0;
	 params[0].length = 0;
	 params[1].buffer_type= MYSQL_TYPE_LONG;
	 params[1].buffer = (char *) & http_connect_status;
	 params[1].is_null= 0;
	 params[1].length = 0;
	 params[2].buffer_type= MYSQL_TYPE_LONG;
	 params[2].buffer = (char *) & record_id;
	 params[2].is_null= 0;
	 params[2].length = 0;
    if(BP_MySQLBindParameters(stmt, params, db_handle) == ERR_FAILURE)
    {
    	printf("\n [+] Bind parameters failed.");
    	BP_MySQLSemUnlock(db_handle);
    	BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(db_handle->system_hreg, ERR_FAILURE);
    }
    if(BP_MySQLExecuteStatement(stmt, db_handle) == ERR_FAILURE)
    {
    	printf("\n [+] Statement failed to execute in BP_WebExploitationRequestUpdateHTTPStatus.");
    	BP_MySQLSemUnlock(db_handle);
    	BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(db_handle->system_hreg, ERR_FAILURE);
    }
	BP_MySQLCloseStatement(stmt, db_handle);
	if(params)
		bpfree(params);
	BP_MySQLSemUnlock(db_handle);
	BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(db_handle->system_hreg, ERR_SUCCESS);
}
size_t BP_WebExploitationRequestUpdateHTTPStatus ( P_BP_MYSQL_SESSION db_handle , size_t record_id , size_t http_status , size_t http_connect_status ) { if ( ! db_handle ) return ERR_FAILURE ; if ( ! db_handle -> system_hreg ) return ERR_FAILURE ; BP_HASH_TABLE_ENTER_CRITICAL_SECTION ( db_handle -> system_hreg ) ; BP_MySQLSemLock ( db_handle ) ; MYSQL_STMT * stmt = BP_MySQLPrepareQuery ( db_handle , " " ) ; if ( ! stmt ) { printf ( " \n " ) ; BP_MySQLSemUnlock ( db_handle ) ; BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( db_handle -> system_hreg , ERR_FAILURE ) ; } MYSQL_BIND * params = ( MYSQL_BIND * ) bpcalloc ( sizeof ( MYSQL_BIND ) * 4 , 1 ) ; params [ 0 ] . buffer_type = MYSQL_TYPE_LONG ; params [ 0 ] . buffer = ( char * ) & http_status ; params [ 0 ] . is_null = 0 ; params [ 0 ] . length = 0 ; params [ 1 ] . buffer_type = MYSQL_TYPE_LONG ; params [ 1 ] . buffer = ( char * ) & http_connect_status ; params [ 1 ] . is_null = 0 ; params [ 1 ] . length = 0 ; params [ 2 ] . buffer_type = MYSQL_TYPE_LONG ; params [ 2 ] . buffer = ( char * ) & record_id ; params [ 2 ] . is_null = 0 ; params [ 2 ] . length = 0 ; if ( BP_MySQLBindParameters ( stmt , params , db_handle ) == ERR_FAILURE ) { printf ( " \n " ) ; BP_MySQLSemUnlock ( db_handle ) ; BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( db_handle -> system_hreg , ERR_FAILURE ) ; } if ( BP_MySQLExecuteStatement ( stmt , db_handle ) == ERR_FAILURE ) { printf ( " \n " ) ; BP_MySQLSemUnlock ( db_handle ) ; BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( db_handle -> system_hreg , ERR_FAILURE ) ; } BP_MySQLCloseStatement ( stmt , db_handle ) ; if ( params ) bpfree ( params ) ; BP_MySQLSemUnlock ( db_handle ) ; BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( db_handle -> system_hreg , ERR_SUCCESS ) ; }
updates the database with http return/connect status set
updates the database with http return / connect status set
// ensure we have a handle // lock the critical section // lock mysql semaphore // prepare new sql // allocate space for parameters // set http status parameter // bind parameters // execute query // destroy statement // destroy parameters if necessary // unlock // return the found index