sha0coder/mwemu
GitHub: sha0coder/mwemu
纯 Rust 实现的高速 x86 恶意软件模拟器,支持 Windows 进程环境模拟、shellcode 和 PE 文件分析。
Stars: 289 | Forks: 36
# MWEmu
[](https://github.com/sha0coder/mwemu/actions/workflows/ci.yaml)
[](https://pypi.org/project/pymwemu/)
[](https://crates.io/crates/libmwemu)
[](https://crates.io/crates/mwemu)
[](https://docs.rs/libmwemu)
[](https://codecov.io/gh/sha0coder/mwemu)
## 官方文档
[mwemu.github.io](https://mwemu.github.io)
## 这是什么?
这是一个硬件模拟器 + 操作系统进程模拟器,使用纯 Rust 实现。
这种方法对于恶意软件分析和其他内容(PE, shellcode 等)非常方便。
操作系统主要是 Windows,它模拟了一个 Windows 进程,并提供了一些非常基础的 Linux 支持。
硬件方面支持 x86 32/64位,快速且可靠。

## 三种使用软件的方式
- mwemu 命令行 https://github.com/sha0coder/mwemu
- libmwemu crate https://crates.io/crates/libmwemu
- pymwemu https://pypi.org/project/pymwemu/
## 关于 scemu 的说明
该项目已从 scemu 重命名为 mwemu。
## 一些视频
[r2con2025](https://www.youtube.com/watch?v=-TFL-_-nIqA) 在模拟过程中从 mwemu 使用 radare2 进行静态分析和可视化。
[一些演示](https://www.youtube.com/@JesusOlmos-wm8ch/videos)
## 特性
- 📦 Rust 的安全性,非常适合模拟恶意软件。
- 所有依赖项均使用 Rust 编写。
- ⚡ 非常快速的模拟(比 unicorn 快得多)
- [基准测试](BENCHMARK.md)
- 25,767,432 条指令/秒
- 680,000 条指令/秒(打印每条指令 -vv)
- 由出色的 iced-x86 Rust 反汇编库提供支持。
- 提供命令行工具、Rust 库和 Python 库。
- 迭代检测器。
- 内存和寄存器跟踪。
- 彩色输出。
- 在特定时刻停止并探索或修改状态。
- 已实现 339 条 CPU 指令。
- 已实现 15 个 dll 中的 260 个 32位 winapi。
- 已实现 10 个 dll 中的 204 个 64位 winapi。
- 所有 linux 系统调用。
- SEH 链。
- 向量异常处理程序。
- PEB, TEB 结构。
- 动态链接。
- IAT 绑定。
- 延迟加载。
- 内存分配器。
- 通过 int3 响应。
- 非调试模式的 cpuid。
- 32位和 64位 shellcode 模拟。
- pe32 和 pe64 可执行文件模拟。
- 使用已知 payload 进行完全模拟:
- metasploit shellcodes。
- metasploit 编码器。
- cobalt strike。
- shellgen。
- guloader(目前尚未完全支持,但比调试器走得更远)
- mars stealer pe32。
- bumblebee。
- 复杂恶意软件函数的部分模拟:
- guloader
- xloader
- danabot
## pymwemu 对抗恶意软件
- raccoon,字符串解密
- vidar,字符串解密
- xloader,完全解密,密钥生成,构建 URL 加密。
- lokibot,api 去混淆
- mars 解包并获取 ioc
- shikata 解码并获取 ioc
- danabot 字符串解密
- zloader 字符串解密
- bumblebee 在模拟了 25,515,274,634 条指令后解包。
- enigma loader api 去混淆和 drop 解密
- bugsleep 解包
- gozi bss 解密和 dga 预测器。
## 捕获模拟时刻
在模拟过程中,你可以看到已模拟的 CPU 指令数量,这是模拟时刻的唯一 ID。
使用 -c 标志,你可以在特定时刻停止模拟,并通过控制台检查正在发生的情况。
## 用法
```
MWEMU emulator for malware 0.7.11
@sha0coder
USAGE:
mwemu [FLAGS] [OPTIONS]
FLAGS:
-6, --64bits enable 64bits architecture emulation
--banzai skip unimplemented instructions, and keep up emulating what can be emulated
--flags trace the flags hex value in every instruction.
-F, --fpu trace the fpu states.
-h, --handle handle Ctrl+C to spawn console
--help Prints help information
-l, --loops show loop interations, it is slow.
-m, --memory trace all the memory accesses read and write.
-n, --nocolors print without colors for redirectin to a file >out
-r, --regs print the register values in every step.
-p, --stack_trace trace stack on push/pop
-t, --test test mode
--version Prints version information
-v, --verbose -vv for view the assembly, -v only messages, without verbose only see the api calls and goes
faster
OPTIONS:
-A, --args provide arguments to the EXE like: --args '"aa" "bb"'
--cmd launch a console command
-b, --base set base address for code
-c, --console select in which moment will spawn the console to inspect.
-C, --console_addr spawn console on first eip = address
-d, --dump load from dump.
-a, --entry entry point of the shellcode, by default starts from the beginning.
-e, --exit exit position of the shellcode
-f, --filename set the shellcode binary file.
-i, --inspect monitor memory like: -i 'dword ptr [ebp + 0x24]
-L, --log log output to file
-M, --maps select the memory maps folder
--mxcsr set mxcsr register
--r10 set r10 register
--r11 set r11 register
--r12 set r12 register
--r13 set r13 register
--r14 set r14 register
--r15 set r15 register
--r8 set r8 register
--r9 set r9 register
--rax set rax register
--rbp set rbp register
--rbx set rbx register
--rcx set rcx register
--rdi set rdi register
--rdx set rdx register
-R, --reg trace a specific register in every step, value and content
--rflags set rflags register
--rsi set rsi register
--rsp set rsp register
-x, --script