可靠地监视/跟踪/记录 Windows 7 上的用户文件访问
我需要跟踪用户访问(创建、打开、读取)的所有文件,并记录这些操作,以便在单独的应用程序中进行进一步处理。我已经调查和搜索了实现此目的的可能方法(尽可能简单)并提出了以下解决方案:
Hook kernel32.dll 并拦截所有 文件特定功能,例如 CreateFileA、OpenFile 等。我以为 修改IAT并提供 包装函数。我还是会转发 对原始函数的调用, 但报告哪些文件在哪里 何时访问我的应用程序。 这听起来很容易实现,但我 怀疑它能完美地工作 Windows 7 在我看来是新的 安全限制阻止 通过修改成功挂钩 导入地址表。也许有人 更了解:)
编写一个文件系统微过滤器并 使回调函数报告 关于文件访问。因为我还没有 在我没有写之前写了一个迷你过滤器 知道这是否可行 方法。我相信发展一个 微型过滤器需要更多的努力。 也许有人可以指出一些 写作教程等资源 简单的文件系统微过滤器。
我知道 Microsoft 的 Detour 库,但在现阶段我想避免使用它,因为钩子通常非常简单。有没有可靠的方法可以在不使用 Detours 或 EasyHook 的情况下在 Windows 7 中挂钩文件函数? 关于微型过滤器:我相信与处理加密的过滤器相比,我想要实现的目标非常简单。然而,我没有编写微过滤器的经验,无法估计实现我的目标需要付出多少努力。我偶然发现的所有示例都涉及文件系统过滤器,而不是微型过滤器。
我很感谢任何提示和建议:)
问候, 好奇心
I need to track all files accessed (created, opened, read) by a user and log these actions for further processing within a separate application. I have investigated and searched for possible ways to achieve this (as simple as possible) and came up with the following solutions:
Hook kernel32.dll and intercept all
file specific functions like
CreateFileA, OpenFile,etc. I thought
of modifying the IAT and provide
wrapper functions. I'd still forward
the calls to the original functions,
but report which files where
accessed when to my application.
This sounds easy to achieve, but I
doubt it will work flawlessly on
Windows 7 as it appears to me new
security restrictions prevent
successful hooking by modifying the
import address table. Maybe somebody
knows better :)Write a file system minifilter and
make the callback functions report
about file accesses. As I haven't
written a minifilter before I don't
know if this is a feasible
approach. I believe development of a
minifilter requires far more effort.
Maybe somebody can point out some
resources like tutorials on writing
simple filesystem minifilters.
I know of Microsoft's Detour library but at this stage I would like to avoid to use it, as the hook in general is quite simple. Is there any reliable way of hooking file functions in Windows 7 at all without using Detours or EasyHook?
Concerning minifilters: I believe what I want to achieve is quite simple compared to for example filters, which deal with encryption. However I have no experience in writing minifilters and cannot estimate how much effort it takes to achieve my goals. All examples I stumbled upon have dealt with file system filters and not minifilters.
I'm thankful for any hints and suggestions :)
Greetings,
curiosity
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 .NET 中,您可以使用 FileSystemWatcher。
In .NET you can use FileSystemWatcher.
您检查过我们的 CallbackFilter 产品吗,它提供了一个现成的过滤器驱动程序,让您可以编写所有用户态逻辑?
Did you check our CallbackFilter product, which provides a ready-to-use filter driver and lets you write all logic in user mode?