Wiki / Port and reverse

Reverse-engineering engines and modes#

PortCode has two modes.

clean-room (default)deep
Looks atwhat a user sees: run it, inputs, outputs, screenshots, public docsalso inside: disassembly, decompilation, emulation, raw bytes
Toolsbash, parity, screenshot, survey, ledger+ disasm, emulate, decompile, hexdump, re_install
Refuseddisasm emulate decompile hexdump; objdump/strings/otool/gdb/r2… in bashnothing extra
Evidencemostly observationmostly inference (cite tool + address)
Switch--clean-room--deep, /deep, "mode":"deep", PORTCODE_MODE=deep

Clean-room works the way craft-anything does: tools that would look inside are refused and the refusal explains how to enable deep mode. PortCode adds a two-session hand-off: a reverse --deep session writes docs/SPEC.md and ledger entries in its own words; a port --clean-room session builds from those only.

Engines#

portcode engines list shows what is installed. Everything PortCode installs goes into the engines/ folder next to the portcode binary (override: PORTCODE_ENGINES). Installs ask first and downloads are sha256-verified.

idwhatused byinstall
capstonedisassembler (x86, ARM, ARM64, MIPS, RISC-V, PPC)disasmpip, private venv
unicornCPU emulatoremulatepip, private venv
keystoneassemblerbashpip
liefELF/PE/Mach-O/DEX parserbash/pythonpip
yarafile pattern rulesbash/pythonpip
angrsymbolic executionpythonpip (large)
fridadynamic instrumentationbashpip
ghidradecompiler, run headlessdecompileofficial release zip, sha256 from GitHub; needs a JDK
imhexhex editor + pattern languageyou (agent writes .hexpat)cask / AppImage
rizin, radare2, binwalk, die, capa, jadx, wabt, upxsystem toolsbash (deep)your package manager
portcode engines install core        # capstone + unicorn + lief
portcode engines install ghidra imhex
portcode --deep -a reverse

Emulation never touches the host: no syscalls, a hard instruction budget, a 60 s deadline. Use only on software you own or may examine. PortCode never bypasses DRM, logins or anti-cheat.

Workbench#

/workbench [file] (deep mode only; with no file it takes the first executable in original/) opens one screen for reading a binary:

areashowsfrom
leftfunctions: address, size, name; / filtersfunctions (LIEF)
middle1 Pseudo-C · 2 Disassembly · 3 Hex of the selected functiondecompile (Ghidra), disasm (Capstone), hexdump
rightthe evidence ledger, newest first; records that mention the selected function are highlighted.portcode/evidence
bottomthe agent's last answer and the promptthe current session

Keys: j/k move, 1 2 3 or h/l switch view, PgUp/PgDn scroll, / filter, a ask the agent to explain the function and record it as an inference, i type to the agent, r reload, q close. The first Pseudo-C of a binary includes Ghidra's analysis, so it can take a while; later functions reuse the project. Sizes are the distance to the next symbol, so treat them as estimates. The workbench makes the same tool calls an agent would, and it refuses to open in clean-room mode.

Unity and C# / .NET#

tooldoesneeds
unitysurveys a game folder or .app: Unity version, Mono or IL2CPP, managed DLLs, native library, asset and bundle counts, next stepsnothing
dotnetinfo, types, type, strings, refs (assembly refs and P/Invoke) of any .NET assembly, including Unity's Assembly-CSharp.dlldnfile (pip)
dotnet mode=decompileC# source of one typeilspy (dotnet tool install -g ilspycmd, needs the .NET SDK)
unity_assetsinfo, list, text, tree of .assets, levelN, globalgamemanagers, bundles: scenes, TextAssets, MonoBehaviour valuesunitypy (pip)

Install: portcode engines install dnfile unitypy. Mono games keep their C# in Managed/*.dll, so dotnet reads it directly. IL2CPP games compile C# to native code: run Il2CppDumper (engine il2cppdumper, installed by you) on GameAssembly and global-metadata.dat, then point dotnet at the DummyDll files it writes, and use functions, decompile and disasm on the native library. Obfuscated names (a, b) are normal; strings and refs orient you. As everywhere, this is deep mode: record what you see as inference, and port from the ledger, not from decompiled code.

Edit this page on GitHub