2024-02-14 10:37:05 +00:00
|
|
|
#ifndef WOODY_H
|
2024-03-19 16:20:11 +00:00
|
|
|
#define WOODY_H
|
2024-02-14 10:37:05 +00:00
|
|
|
|
|
|
|
#include "../ft_printf/includes/ft_printf.h"
|
2024-03-19 16:20:11 +00:00
|
|
|
#include <stdbool.h>
|
2024-02-14 10:37:05 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <elf.h>
|
2024-02-21 12:13:17 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2024-02-23 13:17:23 +00:00
|
|
|
#define JUMP "\xe9"
|
2024-02-14 10:37:05 +00:00
|
|
|
|
2024-03-21 14:44:29 +00:00
|
|
|
typedef struct payload
|
|
|
|
{
|
|
|
|
char *payload;
|
|
|
|
size_t len;
|
|
|
|
} t_payload;
|
|
|
|
|
2024-04-15 04:17:31 +00:00
|
|
|
typedef struct elf_content
|
2024-02-14 10:37:05 +00:00
|
|
|
{
|
|
|
|
long unsigned int file_size;
|
2024-03-19 16:20:11 +00:00
|
|
|
char *file_path;
|
|
|
|
char *file;
|
|
|
|
Elf64_Ehdr *Ehdr;
|
|
|
|
Elf64_Phdr *Phdr;
|
|
|
|
Elf64_Shdr *Shdr;
|
|
|
|
char *extra_data;
|
2024-04-15 04:17:31 +00:00
|
|
|
} t_elf_content;
|
2024-02-14 10:37:05 +00:00
|
|
|
|
|
|
|
// utils.c
|
2024-03-19 16:20:11 +00:00
|
|
|
void *fetch(char *file, unsigned long file_size, unsigned long offset_to_data, unsigned long supposed_data_size);
|
|
|
|
int ft_put_error(char *str);
|
2024-02-14 10:37:05 +00:00
|
|
|
|
|
|
|
// woody.c
|
2024-04-15 04:17:31 +00:00
|
|
|
int prepare_injection(t_elf_content *woody);
|
2024-02-21 12:54:33 +00:00
|
|
|
|
|
|
|
// encrypt.c
|
2024-03-19 16:20:11 +00:00
|
|
|
void encrypt(char *file, unsigned long int offset, unsigned long int size);
|
2024-02-14 10:37:05 +00:00
|
|
|
|
2024-04-15 04:17:31 +00:00
|
|
|
#endif
|
|
|
|
|