Malware analysis with Claude Code and idalib
This tutorial demonstrates a simple agentic use of idalib. Claude Code on the Web inspects malware files in its sandbox, taking a plain-language prompt and driving the entire session: installing IDA, writing analysis scripts, running them against a binary, and extracting findings.
New to idalib? See the Overview first.
Prerequisites
An active IDA Pro license or IDA Home
Claude Code on the Web, with connected GitHub repository (or another AI coding assistant that can write and run scripts)
API Key created:
via HCLI by using
hcli auth key createvia Hex-Rays portal
Optional
Hex-Rays Claude Code skills: pre-built skills that teach Claude to work with idalib
Walkthrough
0. Set up the cloud environment
In Claude Code on the Web, choose your project's repository and add a cloud environment. Configure it with the following settings so that Claude can install IDA and idalib in the cloud sandbox using HCLI:
Network access:
FullEnvironment variables:
Setup script:

1. Get the sample
Prepare some known malware sample. This example uses the Practical Malware Analysis Lab 01-01.dll, a 32-bit Windows PE DLL from the Mandiant capa test files repository.
2. Give Claude Code a prompt
Open Claude Code on the Web and give it a plain-language prompt, for example:
"Install IDA Pro and idalib with HCLI, then download <URL to your malware sample> and demonstrate you can analyze it with idalib, using the script. For reference, use https://ida-domain.docs.hex-rays.com/llms.txt"
3. Review the analysis script
Claude Code writes an idalib script on the fly in response to the prompt. It uses standard IDAPython modules or the Domain API, depending on the prompt, to open the binary, wait for auto-analysis to complete, and extract segments, exports, imports, functions, and strings.
4. Run the analysis and review the output
Claude Code runs the script directly against the sample and produces the output.
What this reveals
In this example, the strings and imports tell the story: 127.26.152.13 is a hardcoded C2 IP, SADFHUHF is a mutex name used to prevent re-infection, and the WS2_32 imports confirm raw TCP socket communication. This is a classic backdoor from the Practical Malware Analysis lab series.
What's next
For a broader look at the available approaches, see Agentic IDA with idalib.
Last updated
Was this helpful?
