-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathpayload.c
More file actions
36 lines (29 loc) · 739 Bytes
/
Copy pathpayload.c
File metadata and controls
36 lines (29 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#ifndef PAGE_SIZE
#define PAGE_SIZE 0x1000
#endif
extern void decrypt_and_call(void *);
extern void decrypt_rodata(void);
void _encrypt_hello(void) __attribute__((aligned(PAGE_SIZE)));
void _encrypt_main(void) __attribute__((aligned(PAGE_SIZE)));
int main(void) __attribute__((aligned(PAGE_SIZE)));
const char *encrypted_strings_marker = "_marker_" ; //用于标记加密 .rodata 节,则hello world字符串会被加密
void _encrypt_hello(void)
{
puts("Hello world.");
}
void _encrypt_main(void)
{
decrypt_and_call(_encrypt_hello);
}
int main(void)
{
decrypt_rodata();
decrypt_and_call(_encrypt_main);
return 0;
}