merge
This commit is contained in:
commit
9b39864ee8
|
@ -18,7 +18,8 @@ void ft_lstdelone(t_list *lst, void (*del)(void *))
|
||||||
return ;
|
return ;
|
||||||
if (del)
|
if (del)
|
||||||
{
|
{
|
||||||
free(lst);
|
|
||||||
del(lst->content);
|
del(lst->content);
|
||||||
|
free(lst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
nasm -f elf64 -o print.o print.s && ld -o print print.o && nasm -f bin -o payload print.s && hexdump -v -e '"\\\x\" 1/1 "%02x"' payload
|
|
@ -51,3 +51,4 @@ int prepare_injection(t_elf_content *woody);
|
||||||
void encrypt(char *file, unsigned long int offset, unsigned long int size);
|
void encrypt(char *file, unsigned long int offset, unsigned long int size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -43,3 +43,4 @@ int main(int ac, char **av)
|
||||||
return ret;
|
return ret;
|
||||||
return prepare_injection(&woody);
|
return prepare_injection(&woody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include "../includes/woody.h"
|
#include "../includes/woody.h"
|
||||||
|
|
||||||
|
|
||||||
int elf_magic_numbers(char *str)
|
int elf_magic_numbers(char *str)
|
||||||
{
|
{
|
||||||
return (!ft_strncmp(str, ELFMAG, SELFMAG));
|
return (!ft_strncmp(str, ELFMAG, SELFMAG));
|
||||||
|
@ -109,7 +108,7 @@ int insert_payload(t_elf_content *woody, t_payload *payload, size_t payload_posi
|
||||||
int32_t woody_index = ptr_woody - payload->payload;
|
int32_t woody_index = ptr_woody - payload->payload;
|
||||||
|
|
||||||
int32_t jmp_index = ptr_jmp - payload->payload;
|
int32_t jmp_index = ptr_jmp - payload->payload;
|
||||||
int32_t jump_value = (payload_position - woody->Ehdr->e_entry + jmp_index - 1) * -1;
|
int32_t jump_value = ((payload_position + jmp_index + 5) - woody->Ehdr->e_entry) * -1; // 5 = JUMP SIZE (OPCODE + 4 bytes operand)
|
||||||
ft_memcpy(&payload->payload[jmp_index + 1], &jump_value, sizeof(jump_value));
|
ft_memcpy(&payload->payload[jmp_index + 1], &jump_value, sizeof(jump_value));
|
||||||
|
|
||||||
int64_t text_index = ptr_text_section - payload->payload;
|
int64_t text_index = ptr_text_section - payload->payload;
|
||||||
|
@ -207,6 +206,7 @@ int get_elf_sections(t_elf_content *woody)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,3 +226,4 @@ int prepare_injection(t_elf_content *woody)
|
||||||
free(woody_file);
|
free(woody_file);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue