> For the complete documentation index, see [llms.txt](https://docs.hex-rays.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hex-rays.com/add-ons/malware/concepts/emulators/speakeasy.md).

# Speakeasy

Speakeasy is an open source Windows emulator originally developed by Mandiant. Its main goal is "high resolution emulation of the Windows operating system for dynamic malware analysis for the x86 and amd64 platforms." It runs user-mode executables and DLLs, kernel-mode drivers, and shellcode.

Speakeasy is pure Python, which means that it works across operating systems, and it is easy to install and use locally. We frequently use it as a sort of lightweight sandbox to emulate Windows programs, see how they behave, and capture a log of API calls and other events, including snapshots of memory that is dynamically allocated or unpacked at runtime. Because it is written in Python, it is portable, but it is also not really that fast. It is usually fast enough for basic analysis: not mining cryptocurrency, but stepping through the logic of a small program or backdoor. And because it is written in Python, it is fairly easy to hack on, to manipulate, and to change. We have found that coding agents can rapidly add any missing hooks.

Speakeasy is licensed under the [MIT license](https://github.com/mandiant/speakeasy/blob/master/LICENSE.txt). The source is at [github.com/mandiant/speakeasy](https://github.com/mandiant/speakeasy), and the Python package is `speakeasy-emulator`. For background, see the Mandiant blog post [Emulation of Malicious Shellcode With Speakeasy](https://cloud.google.com/blog/topics/threat-intelligence/emulation-of-malicious-shellcode-with-speakeasy/).

## How Speakeasy emulates Windows

Whereas [Sogen](https://docs.hex-rays.com/add-ons/malware/concepts/emulators/sogen.md) emulates at the syscall level, Speakeasy emulates at the Windows API level. This means that Speakeasy does not bundle or invoke Microsoft Windows functionality directly. It does not emulate the code of `kernel32.dll`. Instead, it provides a huge number of hooks for well-known Windows API functions, for example `CreateFile`. When it sees that the target process invokes `CreateFile`, it runs an implementation written in Python that behaves as if a file was opened and returns a handle. The sample interacts with an emulated file system, network, and registry.

This means that to use Speakeasy, you do not need a Windows license, and you do not have to set up a root directory or environment. That is all self-contained and distributed with the emulator.

As a sandbox, this also gives less noise than a full system: "the only activity that can be recorded is either written by the malware author, or statically compiled within the binary." Each API call, file operation, and network request goes into a JSON report.

Obviously, a limitation here is that the emulation is only as good as the way that we model the Windows API in Speakeasy. We do the best we can, but there will always be edge cases. For example, the handling of files is fairly good, but the synchronization among threads is really tricky to get right, and is basically outside of the scope of what Speakeasy tries to solve. When a sample needs an API or a part of the system that Speakeasy does not model, the run can stop early or go a different way. For these samples, use Sogen, or a full system sandbox such as VMRay. To compare Speakeasy with the other emulators, see [Choose an emulator](https://docs.hex-rays.com/add-ons/malware/concepts/emulators.md#choose-an-emulator).

## How the add-on uses Speakeasy

The add-on installs Speakeasy as a Python package in IDA's Python environment and runs the `speakeasy` command as a separate process. The sample runs in the emulator, never on your system, as described in [Isolation](https://docs.hex-rays.com/add-ons/malware/concepts/isolated-system-emulation.md#isolation). Network requests get decoy replies from the emulated network and do not go to the real network.

Speakeasy is the default emulator for [isolated system emulation](https://docs.hex-rays.com/add-ons/malware/concepts/isolated-system-emulation.md). The add-on starts Speakeasy with its GDB server and connects IDA's remote GDB debugger to it. It also tells Speakeasy to treat all modules and API functions as present. When the sample calls an API that Speakeasy does not model, the call returns 1 and the session continues.

For [sandbox integration](https://docs.hex-rays.com/add-ons/malware/concepts/sandbox-integration.md), select **Extensions → Malware Analysis → Sandbox → Run Speakeasy sandbox**. The add-on runs the sample in Speakeasy with memory tracing and code coverage turned on, then shows the report in the trace view. To show a report that you made before, select **Malware Analysis → Sandbox → Load Speakeasy report (.json)...**. The `emulation_timeout`, `emulation_max_total_time`, `emulation_max_api_count`, and `emulation_max_instructions` settings limit the run.

For [automated unpacking](https://docs.hex-rays.com/add-ons/malware/concepts/automated-unpacking.md), set `default_debugger` to `speakeasy`. The unpacker then starts Speakeasy through the isolated system emulator and runs its heuristics on the emulated process.

If you have a question, an idea, or a problem, email <support@hex-rays.com>. The Malware Analysis team reads every message and replies quickly.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.hex-rays.com/add-ons/malware/concepts/emulators/speakeasy.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
