总结

qiling 能否运行 ko?

Demigod: The Art of Emulating Kernel Rootkits

How ?

使用 qiling 自带的测试代码:

cd ./qiling/examples/rootfs/x86_linux/kernel
unzip -P infected m0hamed_rootkit.ko.zip

cd ./qiling/tests
python3 test_elf_ko.py

最简单的代码版本:

from qiling import Qiling
from qiling.const import QL_VERBOSE

def test_ko():
    ql = Qiling(["../examples/rootfs/x8664_linux/kernel/hello.ko"],
            "../examples/rootfs/x8664_linux", verbose=QL_VERBOSE.OFF)

    ba = ql.loader.load_address

    ql.run(ba + 0x1064, ba + 0x107e)

if __name__ == "__main__":
    test_ko()

为什么需要调整 load_address ? 怎么来的?

ql.run 的 api

ql.run(begin, end, timeout, count)