在我的pintool中,我使用PIN API检查NtReadFile()和NtCreateFile()系统调用:
def generate(size, score)
init_ones = score.floor
init_zeroes = size - score.ceil
i = rand([init_ones, init_zeroes].min + 1)
num_ones = init_ones - i
num_halves = 2 * (i + score % 1)
num_zeroes = init_zeroes - i
[ *[1]*num_ones, *[0.5]*num_halves, *[0]*num_zeroes ].shuffle
end
generate(6, 3.5)
# => [0.5, 1, 0, 0.5, 0.5, 1]
但是输出似乎被许多意外的额外拦截所污染,我想过滤掉。
问题是,PIN_AddSyscallEntryFunction()
PIN_AddSyscallExitFunction()
函数不允许您访问从派生系统调用的位置(调用站点)推论到的信息,即使在条目中也是如此。在执行系统调用之前检查SYSCALL_ENTRY_CALLBACK
(指令指针的地址)的值,我发现我已经离开了调用站点(超出了我正在检测的映像的地址范围),尽管系统调用是在这张图片中制作的)。
我还尝试使用REG_EIP
处的INS_IsSyscall()
来检查指令并检查其地址,但似乎也为时已晚(超出图像的低位和高位地址范围)
从我正在检测的映像开始仅检测系统调用的正确过程是什么?