woody-woodpacker/inc/woody.h

52 lines
942 B
C
Raw Permalink Normal View History

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 {
2024-09-06 13:02:02 +00:00
int (*encrypt)(t_map, void *, Elf64_Phdr);
int (*gen_key)(void **);
2024-09-06 19:26:35 +00:00
char *algo_name;
2024-09-03 20:14:18 +00:00
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-09-06 13:02:02 +00:00
t_payload64 get_debug_payload64(void);
int gen_key_xor(void **key);
int encrypt_xor(t_map file, void *key_ptr, Elf64_Phdr load_segment);
t_payload64 get_xor_payload64(void);
2024-08-27 08:43:56 +00:00
#endif