woody-woodpacker/inc/woody.h

52 lines
942 B
C

#ifndef WOODY_H
# define WOODY_H
# include "ft_printf.h"
# include <stdio.h>
# include <fcntl.h>
# include <sys/mman.h>
# include <elf.h>
# define RET_ERR 1
# define RET_OK 0
# define PL_XOR 0
# define PL_RSA 1
# define PL_DEBUG 2
typedef struct s_map {
void *data;
off_t size;
} t_map;
typedef struct s_payload64 {
int (*encrypt)(t_map, void *, Elf64_Phdr);
int (*gen_key)(void **);
char *algo_name;
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;
int woody_woodpacker(char *path);
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);
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);
#endif