1

我的学期项目是网络级反恶意软件。它的主要组件是Manager和Agent。Agent 为 Manager 提供:

1. CPU usage, Memory usage and B/W usage information

2. Network related Information - 

    Network Profiling
    Function calls from Network Sockets
    TCP packets related information

3. Disk Related Information - 

    I/O monitoring
    File Read/Writes
    File Attribute changes

4. General Profiling

    Function calls
    Call Graph
    Frequently used system calls
    call volume per process

这四个功能中的每一个都作为线程实现。我们的平台是Linux。我们找到了一个名为 systemtap 的工具...

http://sourceware.org/systemtap/SystemTap_Beginners_Guide/useful-systemtap-scripts.html

与其利用诸如 top、ifstat、tcpdump 等 linux 命令,我们发现这是一个更好的选择。实际上,所有要做的就是从代理 Java 程序调用脚本或可执行文件。

“systemtap”使用的所有脚本都是用 systemtap 脚本语言编写的。前端工具(stap)将此脚本转换为 C 代码,然后将其编译为内核文件。

stap --tmpdir=/home/test/nettop.stp

通过使用上述命令,我设法获得了转换后的 C 代码文件。但是由于依赖性问题,该文件没有被编译。

gcc nettop.c nettop.c:10:29:致命错误:runtime_defines.h:没有此类文件或目录编译终止。

gcc -B /usr/share/systemtap/runtime/ -B /usr/src/kernels/3.3.1-3.fc16.x86_64/include/nettop.c nettop.c:10:29:致命错误:runtime_defines.h : 没有这样的文件或目录编译终止。

gcc --sysroot=/usr/nettop.c nettop.c:10:29:致命错误:runtime_defines.h:没有这样的文件或目录编译终止。

systemtap 运行时头文件都使用linux/header格式,表示 systemtap 的类路径设置为 /usr/../../../../include。将所有标题复制到特定文件夹很容易,但编辑它们以反映正确的路径名称是不可能的。有 106 个运行时标头引用超过一千个 linux 标头。

一个。如何让 gcc 使用特定文件夹作为库?

湾。这种代理架构有更好的替代方案吗?

PS:希望这个问题不会太模糊。感谢您提前回复。

4

1 回答 1

0

不要尝试手动编译 systemtap 的中间 C 代码。相反,通过 stap(或通过 staprun 编译的 .ko)运行脚本,并通过 stdout 使用它们的输出。

于 2012-07-11T13:15:04.790 回答