__int64 sub_20217()
{
__int64 (__fastcall
*
CreateToolhelp32Snapshot)(signed __int64, _QWORD);
/
/
rbx
__int64 (__fastcall
*
Process32First)(__int64,
int
*
);
/
/
r13
void (__fastcall
*
CloseHandle)(__int64);
/
/
r15
__int64 (
*
GetCurrentProcessId)(void);
/
/
r12
__int64 process;
/
/
rdi
bool
v5;
/
/
si
__int64 handle;
/
/
rax
__int64 v7;
/
/
r14
int
v9;
/
/
eax
__int64 (__fastcall
*
Process32Next_1)(__int64,
int
*
);
/
/
rbx
__int64 (__fastcall
*
OpenProcess_1)(signed __int64, _QWORD);
/
/
r13
__int64 address;
/
/
rbx
int
v13;
/
/
eax
int
*
v14;
/
/
rdx
_BYTE
*
v15;
/
/
rbx
int
*
lpBuffer;
/
/
[rsp
+
48h
] [rbp
-
2B0h
]
int
v17;
/
/
[rsp
+
58h
] [rbp
-
2A0h
]
__int64 v18;
/
/
[rsp
+
60h
] [rbp
-
298h
]
int
v19;
/
/
[rsp
+
68h
] [rbp
-
290h
]
int
v20;
/
/
[rsp
+
80h
] [rbp
-
278h
]
int
v21;
/
/
[rsp
+
88h
] [rbp
-
270h
]
__int64 Process32Next;
/
/
[rsp
+
300h
] [rbp
+
8h
]
__int64 OpenProcess;
/
/
[rsp
+
308h
] [rbp
+
10h
]
__int64 (__fastcall
*
VirtualQueryEx)(__int64, __int64,
int
*
*
, signed __int64);
/
/
[rsp
+
310h
] [rbp
+
18h
]
CreateToolhelp32Snapshot
=
(__int64 (__fastcall
*
)(signed __int64, _QWORD))sub_20563(
0xF88DDF46
);
OpenProcess
=
sub_20563(
0xFD0B55A7
);
VirtualQueryEx
=
(__int64 (__fastcall
*
)(__int64, __int64,
int
*
*
, signed __int64))sub_20563(
0x242E6FF
);
Process32First
=
(__int64 (__fastcall
*
)(__int64,
int
*
))sub_20563(
0x3F347695
);
Process32Next
=
sub_20563(
-
1813961927
);
CloseHandle
=
(void (__fastcall
*
)(__int64))sub_20563(
0x1CA655F1
);
GetCurrentProcessId
=
(__int64 (
*
)(void))sub_20563(
55981281
);
process
=
0i64
;
v20
=
0x238
;
v5
=
0
;
handle
=
CreateToolhelp32Snapshot(
2i64
,
0i64
);
v7
=
handle;
if
( handle
=
=
-
1
)
return
0xFFFFFFFFi64
;
v9
=
Process32First(handle, &v20);
Process32Next_1
=
(__int64 (__fastcall
*
)(__int64,
int
*
))Process32Next;
OpenProcess_1
=
(__int64 (__fastcall
*
)(signed __int64, _QWORD))OpenProcess;
while
( v9 )
{
if
( v21
=
=
(unsigned
int
)GetCurrentProcessId() )
{
process
=
OpenProcess_1(
0x2000000i64
,
0i64
);
if
( process )
{
address
=
0i64
;
while
(
1
)
{
do
{
if
( !VirtualQueryEx(process, address, &lpBuffer,
48i64
) )
{
Process32Next_1
=
(__int64 (__fastcall
*
)(__int64,
int
*
))Process32Next;
OpenProcess_1
=
(__int64 (__fastcall
*
)(signed __int64, _QWORD))OpenProcess;
goto LABEL_20;
}
address
=
(__int64)lpBuffer
+
v18;
}
while
( v19 !
=
4096
|| v17 !
=
64
);
v13
=
GetCurrentProcessId();
v14
=
lpBuffer;
if
( v21
=
=
v13 )
v5
=
sub_2062F(
*
lpBuffer);
if
( v5 )
break
;
*
(_BYTE
*
)v14
=
'm'
;
/
/
第一层判断,kctf头
*
((_BYTE
*
)v14
+
1
)
=
'j'
;
*
((_BYTE
*
)v14
+
2
)
=
')'
;
*
((_BYTE
*
)v14
+
3
)
=
0
;
*
((_BYTE
*
)v14
+
67
)
=
'1'
;
*
((_BYTE
*
)v14
+
68
)
=
'2'
;
*
((_BYTE
*
)v14
+
69
)
=
'0'
;
}
v15
=
v14
+
1
;
if
( sub_20AA3((__int64)(v14
+
1
)) )
/
/
所有判断,都在这里呗 传入kctf后面的字符串
{
*
(v15
-
4
)
=
'i'
;
/
/
正确答案!!!!!!
*
(v15
-
3
)
=
'o'
;
*
(v15
-
2
)
=
' '
;
*
(v15
-
1
)
=
0
;
v15[
63
]
=
'1'
;
v15[
64
]
=
'1'
;
}
else
{
*
(v15
-
4
)
=
'm'
;
*
(v15
-
3
)
=
'j'
;
*
(v15
-
2
)
=
')'
;
*
(v15
-
1
)
=
0
;
v15[
63
]
=
'1'
;
v15[
64
]
=
'2'
;
}
v15[
65
]
=
'0'
;
break
;
}
}
LABEL_20:
v9
=
Process32Next_1(v7, &v20);
}
CloseHandle(v7);
return
((__int64 (__fastcall
*
)(__int64))CloseHandle)(process);
}