0
我是一个挂钩的新手。我正在寻找一个可以隐藏文件的python程序,或者通过使用win API hooking
筛选结果来过滤结果来阻止它。我已经读过,还有另外一种方法来实现它,使用文件系统过滤驱动程序,或使用内核模式API挂钩,其中我从here获得了这个想法。如何通过挂钩kernel32.dll来制作文件过滤器
无论如何,我是蟒蛇的家伙,所以我希望它是在Python中,寻找我得到了PyBox。这是我可以将某个DLL注入应用程序然后运行它的地方。
这里是做到这一点的代码:
if kernel32.CreateProcessA(self.exe,
None,
None,
None,
None,
creation_flags,
None,
None,
byref(startupinfo),
byref(process_information)):
self.pid = process_information.dwProcessId
self.tid = process_information.dwThreadId
self.h_process = process_information.hProcess
self.h_thread = process_information.hThread
print "Process successfully launched with PID %d." % self.pid
return True
else:
print "Process could not be launched!"
raise WinError()
return False
这处于挂起模式,然后创建过程:注入DLL后
def resume(self):
if (kernel32.ResumeThread(self.h_thread) == 0):
print "Process could note be resumed!"
raise WinError()
return False
else:
print "Process resumed."
return True
此功能恢复的过程。我想知道两件事:
- 为什么不能如果我可以阻止进程而不是恢复它。这将阻止应用程序运行。但我应该调用kernel32的哪个函数?
- 我如何能实现
ntQueryDirectoryfile function
或zwQueryDirectoryfile function
这里,这样我可以一个过滤器添加到文件,而不是阻止它。那么DLL会对过滤器产生什么影响?