2024-08-27 08:43:56 +00:00
|
|
|
#ifndef WOODY_H
|
|
|
|
# define WOODY_H
|
|
|
|
|
2024-08-27 09:43:26 +00:00
|
|
|
# include "ft_printf.h"
|
2024-08-30 13:10:07 +00:00
|
|
|
# include <stdio.h>
|
|
|
|
# include <fcntl.h>
|
|
|
|
# include <sys/mman.h>
|
|
|
|
# include <elf.h>
|
|
|
|
|
|
|
|
# define RET_ERR 1
|
|
|
|
# define RET_OK 0
|
|
|
|
|
2024-09-03 20:14:18 +00:00
|
|
|
# define PL_XOR 0
|
|
|
|
# define PL_RSA 1
|
|
|
|
# define PL_DEBUG 2
|
|
|
|
|
2024-08-30 13:10:07 +00:00
|
|
|
typedef struct s_map {
|
|
|
|
void *data;
|
|
|
|
off_t size;
|
|
|
|
} t_map;
|
2024-08-27 09:43:26 +00:00
|
|
|
|
2024-09-03 20:14:18 +00:00
|
|
|
typedef struct s_payload64 {
|
|
|
|
int (*encrypt)(t_map, Elf64_Phdr);
|
|
|
|
size_t jump_offset;
|
|
|
|
size_t woody_offset;
|
|
|
|
size_t load_ptr_offset;
|
|
|
|
size_t load_size_offset;
|
|
|
|
size_t private_key_offset;
|
|
|
|
size_t len;
|
|
|
|
unsigned char *data;
|
|
|
|
} t_payload64;
|
|
|
|
|
2024-08-27 09:43:26 +00:00
|
|
|
int woody_woodpacker(char *path);
|
2024-08-27 08:43:56 +00:00
|
|
|
|
2024-08-30 13:10:07 +00:00
|
|
|
|
|
|
|
void *fetch(t_map map, size_t offset, size_t len);
|
|
|
|
|
|
|
|
int wdy_error(char *str);
|
|
|
|
int wdy_perror(char *path);
|
|
|
|
|
|
|
|
int check_ident(t_map file);
|
|
|
|
|
2024-08-27 08:43:56 +00:00
|
|
|
#endif
|