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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
| void __noreturn child()
{
__int64 v0; // rax
__int64 v1; // rax
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rbx
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rbx
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
__int64 size; // rbx
__int64 ptr; // rax
__int64 v16; // rax
__int64 v17; // rax
__int64 v18; // rax
__int64 v19; // rbx
__int64 v20; // rax
__int64 v21; // rax
__int64 v22; // rax
ptrace(PTRACE_TRACEME, 0LL, 0LL, 0LL);
raise(0x12);
v0 = strlen(logo);
my_syscall(0x1234LL, (__int64)logo, v0, 0LL);
my_syscall(0x9811LL, (__int64)get_sym, 0LL, 0LL);
my_syscall(0x9824LL, 30LL, 0LL, 0LL); // alarm(30)
while ( 1 )
{
v1 = my_syscall(0x9811LL, (__int64)get_string, 2LL, 0LL);
my_syscall(0x9811LL, printf_ptr, v1, 0LL); // printf(">> ")
choice_number = my_syscall(0x9811LL, (__int64)get_int, 0LL, 0LL);
if ( choice_number == 0x33 ) // SHOW
{
v12 = my_syscall(0x9811LL, (__int64)get_string, 0xDLL, 0LL);
my_syscall(0x9811LL, printf_ptr, v12, 5LL);// printf("idx: ")
idx = my_syscall(0x9811LL, (__int64)get_int, 0LL, 0LL);
if ( (unsigned int)idx > 4 || !my_syscall(0x9811LL, (__int64)get_ptr_pool, idx, 0LL) )
goto bad;
v13 = my_syscall(0x9811LL, (__int64)get_string, 9LL, 0LL);
my_syscall(0x9811LL, printf_ptr, v13, 0LL);// printf("content: ")
size = my_syscall(0x9811LL, (__int64)get_size_pool, idx, 0LL);
ptr = my_syscall(0x9811LL, (__int64)get_ptr_pool, idx, 0LL);
my_syscall(0x1234LL, ptr, size, 0LL);
}
else if ( (unsigned __int64)choice_number > 0x33 )
{
if ( choice_number == 0x44 ) // EDIT
{
v16 = my_syscall(0x9811LL, (__int64)get_string, 0xDLL, 0LL);
my_syscall(0x9811LL, printf_ptr, v16, 5LL);// printf("idx: ")
idx = my_syscall(0x9811LL, (__int64)get_int, 0LL, 0LL);
if ( (unsigned int)idx > 4 || !my_syscall(0x9811LL, (__int64)get_ptr_pool, idx, 0LL) )
goto bad;
v18 = my_syscall(0x9811LL, (__int64)get_string, 9LL, 0LL);
my_syscall(0x9811LL, printf_ptr, v18, 0LL);// printf("content: ")
v19 = my_syscall(0x9811LL, (__int64)get_size_pool, idx, 0LL);
v20 = my_syscall(0x9811LL, (__int64)get_ptr_pool, idx, 0LL);
my_syscall(0x1231LL, v20, v19, 0LL);
}
else
{
if ( choice_number == 0x55 ) // EXIT
{
v21 = my_syscall(0x9811LL, (__int64)get_string, 0xBLL, 0LL);
my_syscall(0x9811LL, printf_ptr, v21, 0LL);// printf("bye!\n")
exit(0);
}
what:
v22 = my_syscall(0x9811LL, (__int64)get_string, 0xCLL, 0LL);
my_syscall(0x9811LL, printf_ptr, v22, 0LL);// printf("what?\n")
}
}
else if ( choice_number == 0x11 )
{
idx = my_syscall(0x9811LL, (__int64)find_idx, 0LL, 0LL);
if ( (unsigned int)idx > 4 )
goto bad;
if ( my_syscall(0x9811LL, (__int64)get_ptr_pool, idx, 0LL) )
goto bad;
v2 = my_syscall(0x9811LL, (__int64)get_string, 5LL, 0LL);
my_syscall(0x9811LL, printf_ptr, v2, 5LL);// printf("size: ")
malloc_size = my_syscall(0x9811LL, (__int64)get_int, 0LL, 0LL);
if ( malloc_size <= 0 )
goto bad;
if ( malloc_size > 0x28 )
goto bad;
v3 = my_syscall(0x9811LL, malloc_ptr, malloc_size, 0LL);
my_syscall(0x9811LL, (__int64)set_ptr_pool, idx, v3);
v4 = my_syscall(0x9811LL, (__int64)get_string, 9LL, 0LL);
my_syscall(0x9811LL, printf_ptr, v4, 0LL);// printf("content: ")
v5 = malloc_size;
v6 = my_syscall(0x9811LL, (__int64)get_ptr_pool, idx, 0LL);
my_syscall(0x1231LL, v6, v5, 0LL); // read(ptr, size)
v7 = my_syscall(0x9811LL, (__int64)get_ptr_pool, idx, 0LL);
if ( my_syscall(0x9811LL, (__int64)check_DEADBEEF, v7, 0LL) )
goto bad;
my_syscall(0x9811LL, (__int64)set_size_pool, idx, malloc_size);
v8 = my_syscall(0x9811LL, (__int64)get_ptr_pool, idx, 0LL) & 0xFFF;
v9 = my_syscall(0x9811LL, (__int64)get_string, 7LL, 0LL);
my_syscall(0x9811LL, printf_ptr, v9, v8); // printf("addr: %p\n", ptr_pool[idx] & 0xFFF)
}
else
{
if ( choice_number != 0x22 )
goto what;
v10 = my_syscall(0x9811LL, (__int64)get_string, 0xDLL, 0LL);
my_syscall(0x9811LL, printf_ptr, v10, 5LL);// printf("idx: ")
idx = my_syscall(0x9811LL, (__int64)get_int, 0LL, 0LL);
if ( (unsigned int)idx <= 4 && my_syscall(0x9811LL, (__int64)get_ptr_pool, idx, 0LL) )
{
v11 = my_syscall(0x9811LL, (__int64)get_ptr_pool, idx, 0LL);
my_syscall(0x9811LL, free_ptr, v11, 0LL);// free(ptr_pool[idx])
my_syscall(0x9811LL, (__int64)set_ptr_pool, idx, 0LL);// ptr_pool[idx] = 0
}
else
{
bad:
v17 = my_syscall(0x9811LL, (__int64)get_string, 3LL, 0LL);
my_syscall(0x1234LL, v17, 4LL, 0LL); // print("???\n")
}
}
}
}
|