Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

phantomscope is a DMA reverse-engineering toolkit.

Typical workflow

  1. session_open (device="fpga" for a PCILeech FPGA, or a dump path).

  2. processes to find a PID (or use attach with a name).

  3. modules / regions / threads / callstack to orient, and handles / heaps / kernel_modules when the backend has them.

  4. read (with dump=True) / read_typed / dump_region for memory, scan_aob / scan_value / scan_next / pointer_scan for discovery, write / patch_list / patch_restore for edits (journaled).

  5. capture_module to hand a live module's bytes to the static analyser, then disassemble / functions / xrefs_to / basic_blocks, and struct_layout / globals_touched to infer what the code expects its pointers to point at.

  6. decompile for pseudo-C of one function, with api_calls and string_xrefs for the names it does not have. rename_function and set_comment make those names stick: later calls report them.

  7. fingerprint / find_similar / match_functions / diff_images to recognise code across addresses and builds, and packing_report / crypto_constants / search_immediates for triage.

  8. emu_create over a loaded image to snapshot-emulate it: emu_step, emu_run, emu_watch and emu_call stand in for breakpoints, which DMA cannot provide. emu_stubs first when the code calls imports.

Static-only workflows (PE files) can start at load_file.

For a raw physical image with no operating system involved, open session_open(backend="physical", device="<dump>") and use the physical tools: physical_info / physical_map / physical_read / physical_write (addresses are physical), translate / virtual_read / virtual_write / walk (x86-64 page-table walking with a CR3), physical_images (find PEs by structure alone) and capture_image (hand a discovered PE to the static engine).

Every dynamic tool needs a session; every static tool needs a loaded image key (images lists them). Static images and emulators are scoped to the session that captured them, so pass session="<name>" when several targets are open; a bare key is still resolved against every engine.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}

Tools

Functions exposed to the LLM to take actions

NameDescription
session_openC

Open a memory acquisition session.

device: "fpga" (PCILeech), a memory dump path, "pmem", "usb3380", a LeechAgent remote ("rpc://host"), or "mock" for a deterministic test target when backend="mock". options is a space-separated list of extra MemProcFS arguments.

session_listC

List open sessions.

session_closeA

Close a session (all sessions when name is omitted).

attachB

Attach to a process by PID or name and make it the default target.

processesC

List processes, optionally filtered by name.

process_infoC

Detailed information about one process.

modulesC

List loaded modules of a process.

regionsC

List memory regions (VADs) of a process.

threadsC

List threads of a process.

callstackC

Return the callstack of a thread.

kernel_modulesC

Kernel modules (drivers) loaded on the target, when the backend has a kernel view.

kernel_processesC

Processes seen by the kernel, including ones hidden from the user-mode list.

handlesD

Handles open in a process; filter matches the type or name, case-insensitively.

heapsD

Heaps of a process.

readC

Read process virtual memory. va may be 0x1234 or module+0x10.

read_typedC

Read a typed value (int8..uint64, float, double).

writeC

Write bytes or a typed value. Every write is journaled and reversible.

patch_listC

List every write made through this session.

patch_restoreB

Restore one patch by id, or every outstanding patch with all=True.

address_infoC

Resolve an address to module/region/function information.

dump_regionB

Dump a memory range to a file (or return its hex when out_path is empty).

scan_aobC

Scan live process memory for an AOB pattern (48 8B ?? E8).

scan_stringsA

Find readable strings in live memory — what the target built at run time.

strings only reads an image on disk. A URL after a redirect, a decrypted key, a JSON payload assembled on the heap exist only here.

encoding="both" covers ASCII and UTF-16LE; wide strings are stored with a lower-case-only convention on Windows, so scanning only ASCII misses most user-visible text.

scan_valueB

First value scan. Returns a scan key used by scan_next.

scan_nextC

Narrow a previous scan to addresses still holding (or no longer holding) a value.

scan_resultsC

List the addresses currently held by a scan.

pointer_scanC

Find module+offset pointer chains that point at a target address.

snapshotD

Take a memory snapshot.

diffC

Show what changed in a range since now (or watch it for timeout seconds).

trace_changesB

Poll a range and report every byte that moved, as hex and as typed values.

This is the DMA answer to a memory breakpoint: nothing can be stopped, so the range is sampled and diffed. Runs name the changed field, how many samples caught a new value, and the same bytes read as int32/uint32/float/int64/uint64/ double, which is usually enough to tell a flag from a counter from a timer.

trace_valueC

Time series for one typed value: the counter/timer/health-bar view.

read_objectB

Dump one object: hexdump, aligned qwords with pointer validity, typed fields.

fields takes "0x0:int32,0x8:pointer,0x10:char[16]" and decodes exactly those offsets, so a guessed layout can be checked instead of eyeballed.

read_arrayC

Read count objects stride bytes apart (follow for Entity**).

infer_structA

Infer a field layout from sampled values and print a C declaration.

count objects at stride are compared: a qword that is a mapped address every time is reported as a pointer, one whose high dword is always zero as int32, and fields that differ between objects are marked varies.

detect_containerC

Decide whether an address holds a std::vector, TArray, std::string, or other.

expand_containerC

Detect a container and read its elements in one call (the entity-list workflow).

resolve_pointer_chainB

Walk a pointer path and report every hop plus the final value.

base is game.exe+0x1a2b or an address, offsets is "0x10,0x38,0x8": each offset is added before the next dereference and the last one selects the field. A broken hop is reported with its address instead of a plausible zero.

pointer_chain_replayC

Re-run chains from pointer_scan (JSON) and keep the ones that resolve.

snapshot_moduleB

Snapshot every mapped region of a module (baseline for diff_module).

diff_moduleC

Compare a module's regions against a snapshot_module baseline.

physical_infoC

Geometry of the open physical image: segments, size, CR3, cache state.

physical_mapD

Physical address ranges: the dump's segments, or the target's RAM map.

physical_readB

Read physical memory. Bytes outside every captured segment read as zeros.

physical_writeA

Write bytes into a raw physical dump file on disk.

Not a write to a live target: the physical backend backs a dump file, so this edits that file in place. Use write for a live process.

translateB

Translate a virtual address through page tables (defaults to the session CR3).

virtual_readC

Read virtual memory through page tables. strict=False zero-fills holes.

virtual_writeC

Write virtual memory through page tables (hex).

walkC

Report which pages in a virtual range are present (no OS structures used).

physical_imagesC

Find PE images in physical memory by structure alone (no module list).

physical_scanC

AOB-scan physical memory (48 8B ?? E8). Hits are physical addresses.

capture_imageC

Capture a PE found at a physical address and load it for static analysis.

The loaded image is based at the PE ImageBase unless base overrides it, so reported addresses match the image's own view of itself.

load_fileB

Load a PE file from disk for static analysis.

Files loaded without session go into the standalone engine, so a static-only workflow never depends on which DMA session happens to be open.

capture_moduleC

Capture a live module through DMA and load it for static analysis.

export_moduleA

Dump a live module to a PE file that IDA, Ghidra and pefile will open.

The last mile of unpacking: capture the module, then write it somewhere useful. A memory buffer is RVA-indexed, so writing it out verbatim gives a file whose section headers no longer match where the bytes are — every tool rejects it. This demaps it: headers stay, each section moves from its virtual address to its declared raw offset.

raw=True keeps the mapped layout instead, for byte-exact captures.

save_imageC

Write an already-loaded image to disk (same demap as export_module).

patch_applyA

Overwrite bytes in a loaded image, remembering the original for rollback.

The static twin of write: patch the image (which is where the code you disassembled actually lives), then save_image to demap it into a working file. The cached function index is invalidated, so disassemble and decompile show the patched bytes immediately rather than the old ones.

bytes takes hex: "EB", "EB 1C" or "EB1C". A conditional branch is usually the target — 74/75 (jz/jnz) to EB (jmp) skips the failure path without changing instruction length.

static_patch_listC

Every static image patch made through this engine, oldest first.

static_patch_restoreB

Undo one static patch by index, or every outstanding patch with all=True.

key selects the image; without it the engine that owns any patch is used.

imagesA

List images loaded for static analysis (all engines when session is empty).

unload_imageC

Forget a loaded image and any emulator built over it.

image_summaryC

Header/section/import/export summary of a loaded image.

sectionsD

Sections of a loaded image.

importsC

Imports of a loaded image (optionally filtered by module).

exportsD

Exports of a loaded image.

stringsC

Extract strings; contains filters case-insensitively.

functionsC

List discovered functions with callers counts.

function_infoD

Function containing an address.

disassembleC

Disassemble from an address, or a whole function when function=True.

basic_blocksC

Basic blocks of the function containing an address.

xrefs_toC

Cross references to an address.

xrefs_fromD

Cross references from an address.

callersC

Functions that call the function containing va.

calleesC

Functions called by the function containing va.

scan_patternC

Scan a static image for an AOB pattern.

rttiD

MSVC RTTI classes and their vtables.

static_readC

Read bytes from a loaded image.

static_address_infoA

Resolve an address inside a loaded image: section, function, symbol, flags.

The static counterpart of address_info; use it when the address came from an analysis result rather than from a live process.

struct_layoutB

Infer candidate struct layouts from the memory operands a function uses.

Every [rcx+0x10] observed becomes a field hypothesis at offset 0x10, sized by the access width. Offsets are relative and the base is a role (arg0/arg1/...) or a register, because nothing proves which object the register holds. Confirm hypotheses with read_typed against live memory.

live_struct_layoutA

Combine a function's field accesses with the live values at those offsets.

struct_layout knows which offsets exist and how wide the accesses are, but not what is in them. infer_struct knows what is in them, but not which offsets the code cares about. This runs both and merges them: every offset is confirmed by code and typed by data, padding is dropped, a dword that reads as a sane float in every sample is declared float, adjacent floats are grouped into a vector, and offsets seen in only one of the two are listed separately instead of being silently dropped.

key is a loaded image (found in any engine), function is any address inside the function, and object_va is a live instance of the object that function's first argument points at. session selects the live target; the image does not have to live in that session, so a sample loaded from disk works against whatever is attached.

globals_touchedC

Module globals (RIP-relative references) read or written by a function.

decompileA

Lift one function to readable pseudo-C.

Control flow is rebuilt from the basic-block graph: dominators, natural loops and if/else joins become while / if statements instead of goto, cmp + jcc pairs become conditions, arg0..arg3 name the incoming register arguments, imports and string references are resolved through the image, and registers that hold rbp-relative slots become locals. Every line keeps the original instruction as a trailing comment, so the output can be checked against disassemble instead of trusted.

Heuristics are stated in the response: confidence drops when blocks are unreachable, the graph is irreducible, or instructions stay unmodelled (SSE, string ops), and notes says why. Pair with rename_function — the annotated name is used by later calls.

rename_functionA

Name a function; every later tool reports that name instead of sub_x.

Names persist to <file>.phantomscope.json next to a PE loaded from disk, and live for the session otherwise (a memory capture has no local file). The identifier must look like a symbol: decrypt_config, ?f@@YAXH@Z.

set_commentB

Attach a comment to an address; disassemble shows it inline.

annotationsB

List the names, comments and notes recorded for an image.

clear_annotationsA

Drop the annotations for one address, or all of them when va is empty.

api_callsB

Imported APIs called in an image (or in one function), grouped by API.

Resolves call [rip+iat] and the mov reg,[iat]; call reg thunk form, so a stripped binary still tells you it talks to kernel32!CreateFileW. This is the fast way to classify an unknown function: crypto, network, registry, process injection.

api_sitesC

Every API reference site with its address, function and reference kind.

find_apiC

Functions that call an API matching needle (case-insensitive).

string_xrefsC

Strings and the code addresses that reference them.

Narrow with contains (substring) or point at one string with va. A "licence expired" string with one caller is a much better lead than the caller list of an unnamed function.

fingerprintB

Structural fingerprint of a function (normalised hash, constants, imports).

Relative branch targets and immediates are abstracted, so the same function hashes the same at another address or in another build; the immediates are kept separately in constants.

find_similarB

Functions in the same image that look like the one at va.

Similarity is the Jaccard index over mnemonic trigrams: explainable, and good at finding the four copies of the same routine a compiler inlined.

match_functionsC

Match the functions of two loaded images (hash first, shape second).

diff_imagesB

Structural diff of two builds: identical, similar, removed and added code.

Load both versions (load_file twice), then this tells you exactly which functions changed — the shortest path from "new game build" to "the function they patched".

packing_reportB

Evidence for packing or virtualisation, with a 0-10 score.

Checks section entropy, writable+executable sections, sections with no file data, the import count, how much code the analyser actually recovered, TLS callbacks, entry-point placement and overlay data. Each hit carries its weight and a one-line reason, so the verdict can be argued with.

crypto_constantsA

Locate known crypto/hash tables and round constants by value.

AES S-box and its inverse, the CRC-32 table, MD5/SHA initial states, TEA and xxHash primes, FNV offsets, MurmurHash constants, base64 and hex alphabets. A hit means the bytes are there — treat it as a lead, not a proof.

search_immediatesB

Where a number is used: instruction immediates and stored data.

Pass value as hex or decimal (0x9e3779b9, -1, 1033). width picks the stored size (4 or 8). This is how you find the cmp eax, 0x1e behind a trial limit or the constant in a hash loop.

server_infoD–
emu_availableA

Whether snapshot emulation (Unicorn) is installed.

emu_createA

Create an emulator over a loaded image (optionally seeding rip/rsp).

stubs=True installs an import stub for every IAT slot up front, which is what lets emu_call run a real function that talks to the OS. trace=True starts recording executed instructions and taken edges (see emu_coverage); it is off by default because a hook per instruction is slow.

emu_regsC

Read (or set with rax=0x10,rcx=5) emulator registers.

emu_stepC

Single-step the emulator (count instructions).

emu_runC

Run until an address (until) or until the step budget is exhausted.

emu_readC

Read emulator memory.

emu_writeC

Write emulator memory (hex).

emu_watchC

Watch an emulator memory range for reads and/or writes.

emu_eventsC

Accesses recorded by emulator watchpoints.

emu_callA

Call a function in the emulator (x64 Microsoft calling convention).

Imported functions fault unless their IAT slots were redirected: call emu_stubs first (or emu_create(stubs=True)) so call kernel32!X returns a value instead of stopping on an unmapped fetch.

emu_stubsA

Redirect every import slot to a generated stub, so the code can keep running.

A snapshot holds the image, not the module it imports from, so call qword ptr [rip+iat] would fault. This rewrites each IAT slot to a mov eax, imm; ret stub in a mapped page and logs every hit.

returns sets per-API return values: "Sleep=0,GetTickCount=0x64" or "kernel32.dll!CreateFileW=0x40"; unlisted imports return default. Driving a return value is how you take the success path through a check without patching the binary.

emu_callsC

Imported functions the emulator actually called, with argument registers.

emu_stub_listC

Installed import stubs with the value each one returns.

emu_closeB

Release an emulator and its native engine.

Worth calling when you are done with a large image: unicorn holds memory per instance, and a session that creates emulators in a loop will grow until they are closed.

emu_traceB

Turn instruction/edge recording on, off, or reset it.

recording costs a callback per instruction, so it is opt-in: enable it when the question is which path did the run take, not when you need a value.

emu_coverageB

What the emulated run executed: unique instructions, hot spots, branch forks.

forks are the addresses that had more than one successor — i.e. the branch decisions actually taken, which answers "did the check pass" and "which case of the switch ran".

emu_reachedC

Which of the listed addresses the emulated run actually reached.

emu_faultsC

Bad accesses seen in the emulator: unmapped read/write/fetch with rip and address.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

C2.5/5.0

Scored across 115 tools

Disambiguation4/5

The tool set is partitioned into clear domains (live DMA, static image analysis, physical dump, emulator, annotations), and most tools have a distinct resource+action. The main friction is the five read variants (read, static_read, physical_read, virtual_read, emu_read) and matching write variants, which require careful attention to pick correctly, though descriptions do distinguish them.

Naming Consistency3/5

Most names are snake_case, but the convention is mixed: bare nouns (read, write, walk, diff, snapshot, handles, threads), verb_noun (capture_image, rename_function, patch_apply), and inconsistent prefix ordering (physical_read vs read vs static_read vs session_open). Readable but not predictable enough to guess a name without consulting the list.

Tool Count1/5

115 tools is far past the threshold where an agent can hold the surface in mind. While each has a role, the sheer count guarantees selection errors and cognitive overhead; this surface should be split into sub-servers or namespaces (live, static, physical, emu).

Completeness5/5

Coverage across the reverse-engineering domain is exceptional: session/process lifecycle, live reads/writes with patch journaling, static image loading, disassembly/decompilation/xrefs, struct inference, emulator with import stubs and coverage, physical memory, and annotations. No obvious dead ends for the stated purpose.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues