我已經寫了一個if
語句,比較兩個hex
值,但是這個if
表示值爲!=
,即使它們是==
! 。我可以看到它們是平等的,因爲我用printf
打印它們的值!使用if語句比較兩個十六進制值
uint64_t sys_call_table_offset = 0xc033e7f4;
uint64_t sys_call_func_ptr;
uint64_t syscall_func_ptr[15] = { 0xc0107c30,//0->2
0xc0152ea0,//1->3
0xc0152fe0,//2->4
0xc0152220,//3->5
0xc0107d40,//4->11
0xc0151750,//5->12
0xc0132300,//6->23
0xc012dae0,//7->24
0xc01303a0,//8->37
0xc0165230,//9->54
0xc02086d0,//10->102
0xc0107c80,//11->120
0xc0165cb0,//12->141
0xc0124e50,//13->167
0xc0165e70,//14->220
};
int sys_num[15]={2,3,4,5,11,12,23,24,37,54,102,120,141,167,220};
int i;
for(i = 0 ; i<15 ; i++)
{
vmi_read_32_va(vmi,sys_call_table_offset + (sys_num[i] * 0x4) , 0, &sys_call_func_ptr);
printf("sys_call_ptr = %x",sys_call_func_ptr);
printf(" sys_call_ptr = %x i=%d \n",syscall_func_ptr[i],i);
if(syscall_func_ptr[i]!= sys_call_func_ptr)
printf("Detected hooked system call!\n");
}
這是printf的輸出:
sys_call_ptr = c0107c30 sys_call_ptr = c0107c30 i=0
Detected hooked system call!
sys_call_ptr = c0152ea0 sys_call_ptr = c0152ea0 i=1
Detected hooked system call!
sys_call_ptr = c0152fe0 sys_call_ptr = c0152fe0 i=2
Detected hooked system call!
sys_call_ptr = c0152220 sys_call_ptr = c0152220 i=3
Detected hooked system call!
sys_call_ptr = c0107d40 sys_call_ptr = c0107d40 i=4
Detected hooked system call!
sys_call_ptr = c0151750 sys_call_ptr = c0151750 i=5
Detected hooked system call!
sys_call_ptr = c0135b20 sys_call_ptr = c0132300 i=6
Detected hooked system call!
sys_call_ptr = c0135f30 sys_call_ptr = c012dae0 i=7
Detected hooked system call!
sys_call_ptr = c01303a0 sys_call_ptr = c01303a0 i=8
Detected hooked system call!
sys_call_ptr = c0165230 sys_call_ptr = c0165230 i=9
Detected hooked system call!
sys_call_ptr = c0209580 sys_call_ptr = c02086d0 i=10
Detected hooked system call!
sys_call_ptr = c0107c80 sys_call_ptr = c0107c80 i=11
Detected hooked system call!
sys_call_ptr = c0165cb0 sys_call_ptr = c0165cb0 i=12
Detected hooked system call!
sys_call_ptr = c0124e50 sys_call_ptr = c0124e50 i=13
Detected hooked system call!
sys_call_ptr = c0165e70 sys_call_ptr = c0165e70 i=14
Detected hooked system call!
我改變的變量類型'uint32_t',現在它工作正常。 – Mjina