diff --git a/includes/woody.h b/includes/woody.h index 7aa98d7..6ec0516 100644 --- a/includes/woody.h +++ b/includes/woody.h @@ -22,7 +22,7 @@ typedef struct payload size_t len; } t_payload; -typedef struct efl_content +typedef struct elf_content { long unsigned int file_size; char *file_path; @@ -31,14 +31,14 @@ typedef struct efl_content Elf64_Phdr *Phdr; Elf64_Shdr *Shdr; char *extra_data; -} t_efl_content; +} t_elf_content; // utils.c void *fetch(char *file, unsigned long file_size, unsigned long offset_to_data, unsigned long supposed_data_size); int ft_put_error(char *str); // woody.c -int prepare_injection(t_efl_content *woody); +int prepare_injection(t_elf_content *woody); // encrypt.c void encrypt(char *file, unsigned long int offset, unsigned long int size); diff --git a/srcs/main.c b/srcs/main.c index 143a099..0e42de8 100644 --- a/srcs/main.c +++ b/srcs/main.c @@ -1,6 +1,6 @@ #include "../includes/woody.h" -int get_elf_file(t_efl_content *woody) +int get_elf_file(t_elf_content *woody) { int fd; off_t off; @@ -32,7 +32,7 @@ int get_elf_file(t_efl_content *woody) int main(int ac, char **av) { - t_efl_content woody; + t_elf_content woody; if (ac != 2) { return ft_put_error("Woody_woodpacker take 1 argument\n"); diff --git a/srcs/woody.c b/srcs/woody.c index dc73446..da52764 100644 --- a/srcs/woody.c +++ b/srcs/woody.c @@ -27,7 +27,7 @@ int save_elf(char *path, char *file, unsigned long int size) return EXIT_SUCCESS; } -int get_load_segment(t_efl_content *woody, int start, bool executable) +int get_load_segment(t_elf_content *woody, int start, bool executable) { for (int i = start; i < woody->Ehdr->e_phnum; i++) { @@ -45,7 +45,7 @@ int get_load_segment(t_efl_content *woody, int start, bool executable) return -1; } -void offset_sections(t_efl_content *woody, unsigned int from, unsigned int offset_ammount) +void offset_sections(t_elf_content *woody, unsigned int from, unsigned int offset_ammount) { for (int i = 0; i < woody->Ehdr->e_phnum; i++) { @@ -59,7 +59,7 @@ void offset_sections(t_efl_content *woody, unsigned int from, unsigned int offse } } -size_t create_codecave(t_efl_content *woody, Elf64_Phdr *load_segment, t_payload *payload) +size_t create_codecave(t_elf_content *woody, Elf64_Phdr *load_segment, t_payload *payload) { const unsigned int page_size = 4096; // getpagesize(); not authorized unsigned int padding_size = ((payload->len / page_size) + 1) * page_size; @@ -98,7 +98,7 @@ t_payload *get_payload() return payload; } -int insert_payload(t_efl_content *woody, t_payload *payload, size_t payload_position) +int insert_payload(t_elf_content *woody, t_payload *payload, size_t payload_position) { char *ptr = ft_strnstr_nullterminated(payload->payload, JUMP, payload->len); if (ptr) @@ -119,7 +119,7 @@ int insert_payload(t_efl_content *woody, t_payload *payload, size_t payload_posi return EXIT_FAILURE; } -void inject(t_efl_content *woody) +void inject(t_elf_content *woody) { t_payload *payload = get_payload(); @@ -149,7 +149,7 @@ void inject(t_efl_content *woody) printf("New entry = %ld (%lx)\n", woody->Ehdr->e_entry, woody->Ehdr->e_entry); } -int get_elf_sections(t_efl_content *woody) +int get_elf_sections(t_elf_content *woody) { woody->Ehdr = (Elf64_Ehdr *)fetch(woody->file, woody->file_size, 0, sizeof(Elf64_Ehdr)); if (!woody->Ehdr || !elf_magic_numbers(woody->file) || woody->Ehdr->e_ident[EI_CLASS] != ELFCLASS64) @@ -197,7 +197,7 @@ int get_elf_sections(t_efl_content *woody) return EXIT_SUCCESS; } -int prepare_injection(t_efl_content *woody) +int prepare_injection(t_elf_content *woody) { int elf_statut = get_elf_sections(woody); if (elf_statut)