07 - 运行pyrebox mw_monitor的api tracer的步骤

  1. 在pyrebox.conf中有一个mw_monitor.mw_monitor: False的参数,将其设为True

  2. 将mw_monitor/config_examples中的两个配置文件复制到pyrebox.conf所在的文件夹下

  3. 将生成的500MB的数据库文件deviare32_populated.sqlite替换掉原有的50MB的mw_monitor/third_party/deviare2_db/文件夹下的数据库文件

  4. 修改mw_monitor.conf的数据库配置路径,[general]中的output_bundle参数是输出的结果的名字,api_database是上面的.sqlite数据库的地址

    [general]
    
    output_bundle: bundle.tar.gz
    api_database: mw_monitor/third_party/deviare2_db/deviare32_populated.sqlite
    [interproc]
    bin_log_name: interproc.bin
    text_log_name: interproc.log
    basic_stats_name: basic_stats
    
    [api_tracer]
    text_log_name: function_calls.log
    bin_log_name: function_calls.bin
    
    [coverage]
    cov_log_name: coverage.bin
    cov_text_name: coverage.log
    
    [dumper]
    
    path = dumper/
    
  5. 修改mw_monitor_run.json配置文件,其中api_tracerlight_mode参数决定是以轻量级运行api tracer还是正常运行api tracer,light模式会快很多;bin_log参数是决定是否记录二进制日志,text_log决定是否记录文本格式的日志。下面的general中的参数:files_path是Guest Agent拷贝可执行文件(或dll)到虚拟机中的目标文件夹;main_executable是解压出来的可执行文件的名字,就是zip文件里面压缩的文件的名字,不要自己另取一个名字,不然会无法执行;files_bundle是Ubuntu上想拷贝到虚拟机中的zip文件的路径;modules参数可以控制是否执行这四个模块:

    {
        "api_tracer": {
            "bin_log": false,
            "exclude_apis": [],
            "exclude_modules": [],
            "exclude_origin_modules": [],
            "include_apis": [],
            "light_mode": true,
            "procs": null,
            "text_log": true
        },
        "coverage": {
            "procs": null
        },
        "dumper": {  
            "dump_at": "kernel32.dll!CopyFileA",
            "dump_on_exit": false
        },
        "general": {
            "files_path": "C:\\",
            "main_executable": "malware.exe",
            "files_bundle": "malware/malware.zip"
        },
        "interproc": {
            "basic_stats": true,
            "bin_log": true,
            "text_log": true
        },
        "modules": {
            "api_tracer": true,
            "coverage": false,
            "dumper": false,
            "interproc": false
        }
    }
    
  6. 只有运行完后卸载模块才会输出api tracer的结果,直接按q是直接退出,不会生成结果。具体做法:先在qemu命令行中list_modules,然后看到mw_monitor对应的Hdl序号(一般是2),然后使用命令unload_module 2卸载脚本,pyrebox就会生成结果并保存在pyrebox.conf所在的文件夹下

具体运行流程(正常模式下),和light模式的区别就是多了一行加载API tracer数据库的提示:

在这里插入图片描述

api tracer的light mode要快很多,正常mode运行一个程序会一直卡着,很慢

比如说将计算器作为malware.exe传入pyrebox虚拟机中运行,light模式下2分钟就能将计算器启动运行出界面并运算;而正常模式要等15分钟才出现计算器等界面,如图,然后一个个地加载计算器的按钮

ka

最后生成结果,根据上面的设置得出的结果中有三个文件,分别是生成的二进制格式调用日志function_calls.bin、文本格式调用日志function_calls.log和json配置文件mw_monitor_run.json。

light模式一下就生成了结果。
在这里插入图片描述

正常模式还是很慢,要3分钟,主要是function_calls.bin太大,有1.4G。

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值