Coding
PromptBeginner5 minmarkdown
Markdown Converter
Agent skill for markdown-converter
7
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
dayu is a parser and decompiler for .abc files (Ark Bytecode files) used on Open/HarmonyOS. It analyzes and reverse-engineers compiled ArkTS/TypeScript applications back into readable pseudocode.
# Install dependencies pip install -r requirements.txt # Basic decompilation workflow (requires both .abc and disassembled .txt files) python main.py -abc input.abc -pa input.txt -dme "com.example.Class.method" # List all classes python main.py -pa input.txt -pc # List methods in a specific class python main.py -pa input.txt -pmc "com.example.Class" # Decompile entire class python main.py -abc input.abc -pa input.txt -dc "com.example.Class" # View Control Flow Graph (requires graphviz) python main.py -abc input.abc -pa input.txt -dme "com.example.Class.method" -cfg # Different output levels: llir, mlir, hlir, pcode (default) python main.py -abc input.abc -pa input.txt -dme "com.example.Class.method" -O hlir
Before decompiling, you need to disassemble the .abc file using HarmonyOS SDK:
ark_disasm input.abc input.txt
The decompiler follows a multi-stage IR transformation pipeline:
ark/ - ABC File Parsingabcreader.py: Main entry point for reading .abc filesabcfile/: Version-specific parsers (ABC v9, v12)abcclass/, abcfield/, abcmethod/: Structure parsers for classes, fields, methodsabcstring.py, abcliteralarray/: String and literal handlingpandasm/ - Panda Assembly Parsingreader.py: Main entry point for parsing disassembled text filesfile.py, pa_class.py, method.py: Structure representationsinsn.py: Instruction parsing and representationdecompile/ - Core Decompilation Enginedecompiler.py: Main decompiler orchestrating the pipelineconfig.py: Configuration classes (DecompilerConfig, output levels, granularity)pa2rawir.py: Converts Panda Assembly to Raw IRdecompile/ir/ - Intermediate Representationnac.py: NAddressCode definitions (ASSIGN, CALL, JUMP, etc.)basicblock.py: Control flow graph basic blocksmethod.py, irclass.py, module.py: IR structure containersbuilder.py: IR instruction builder utilitiesinsn_lifter.py: Lifts bytecode instructions to IRdecompile/passes/ - Analysis and Optimization Passesrawir2llir.py: Raw IR to LLIR transformationbuildcfg.py: Control Flow Graph constructioncopy_propagation.py, dead_code.py: Standard optimizationscontrol_flow_structuring.py: Recovers high-level control structures (if/while/for)resolve_lexvar.py: Resolves lexical variable referencesprint_pcode.py: Final pseudocode generationASSIGN: Variable assignments (max 3 operands)CALL: Function/method calls (1+ operands)UNCOND_JUMP/COND_JUMP: Control flow transfersRETURN: Method returnsUNCOND_THROW/COND_THROW: Exception handlingMETHOD: Single method decompilationCLASS: All methods in a classMODULE: Entire fileLOW_LEVEL_IR: Basic lifted bytecodeMEDIUM_LEVEL_IR: After initial optimizationsHIGH_LEVEL_IR: After advanced optimizationsPSEUDOCODE: Final human-readable outputark/, pandasm/, decompile/)abcfile9.py, abcfile12.py)decompile/passes/decompile/isa.jsondecompile/ir/insn_lifter.pydecompile/ir/insn_enum.pyMethodPass, ClassPass, ModulePass)decompile/passes/decompiler.pyDecompiler behavior is controlled via
DecompilerConfig: