From c36429e805f6934bffa4b7724c6284a4e85e47b1 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 11 Mar 2024 19:36:36 -0500 Subject: [PATCH] Feature: Use the newly added f_random_array_shuffle() in tacocat. The send() packet now automatically randomizes the header structure using f_random_array_shuffle(). --- sources/c/tacocat/main/common/print.c | 1 + sources/c/tacocat/main/common/print.h | 1 + sources/c/tacocat/main/send.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/sources/c/tacocat/main/common/print.c b/sources/c/tacocat/main/common/print.c index 664e5e6..183a257 100644 --- a/sources/c/tacocat/main/common/print.c +++ b/sources/c/tacocat/main/common/print.c @@ -22,6 +22,7 @@ extern "C" { "f_network_from_ip_name", "f_network_from_ip_string", "f_network_is_ip_address", + "f_random_array_shuffle", "f_socket_accept", "f_socket_bind", "f_socket_close", diff --git a/sources/c/tacocat/main/common/print.h b/sources/c/tacocat/main/common/print.h index f275829..d1556a1 100644 --- a/sources/c/tacocat/main/common/print.h +++ b/sources/c/tacocat/main/common/print.h @@ -55,6 +55,7 @@ extern "C" { kt_tacocat_f_f_network_from_ip_name_e, kt_tacocat_f_f_network_from_ip_string_e, kt_tacocat_f_f_network_is_ip_address_e, + kt_tacocat_f_f_random_array_shuffle_e, kt_tacocat_f_f_socket_accept_e, kt_tacocat_f_f_socket_bind_e, kt_tacocat_f_f_socket_close_e, diff --git a/sources/c/tacocat/main/send.c b/sources/c/tacocat/main/send.c index 03d02d2..9f98e2f 100644 --- a/sources/c/tacocat/main/send.c +++ b/sources/c/tacocat/main/send.c @@ -204,6 +204,12 @@ extern "C" { macro_kt_send_process_handle_error_exit_1(main, fl_fss_payload_header_map, kt_tacocat_send_build_s, set->network, set->status, set->name, set->step); + set->write_state.cache->used = 0; + + set->status = f_random_array_shuffle(0, set->headers.used, sizeof(f_string_map_t), set->write_state.cache, (void *) set->headers.array); + + macro_kt_send_process_handle_error_exit_1(main, f_random_array_shuffle, kt_tacocat_send_build_s, set->network, set->status, set->name, set->step); + set->step = kt_tacocat_socket_step_send_header_e; } -- 1.8.3.1