Skip to content

ActualMasterOogway/Iridium

Repository files navigation

Iridium - Luau Bytecode Deserializer

Iridium is a powerful Luau bytecode deserializer and disassembler written in Luau itself. It allows you to analyze, inspect, and understand compiled Luau bytecode by breaking it down into its constituent components.

Description

Iridium provides a comprehensive toolkit for working with Luau bytecode. It can parse bytecode from various Luau versions (3-6) and extract detailed information about functions, constants, instructions, and more. This makes it an invaluable tool for reverse engineering, debugging, and understanding how Luau code is executed at a low level.

Features

  • Bytecode Parsing

    • Support for Luau bytecode versions 3-6
    • Typed bytecode support (version 4-6)
    • Complete bytecode structure analysis
  • Function Analysis

    • Function prototype extraction
    • Stack size information
    • Parameter count detection
    • Upvalue tracking
    • Vararg function detection
  • Instruction Decoding

    • Complete instruction set support
    • Opcode identification
    • Operand extraction
    • Instruction flow analysis
  • Constant Pool Management

    • String constants
    • Number constants
    • Boolean constants
    • Table constants
    • Vector constants
    • Nil constants
    • Closure constants
    • Import constants
  • Type System

    • Type version detection
    • Userdata type mapping
    • Type flags parsing
    • Type data parsing
      • Version 1
      • Version 2
      • Version 3
  • Debug Info

    • Line information
    • Debug name
  • Utility Functions

    • String reference resolution
    • Type mapping utilities
    • Hexadecimal conversion

Usage

local Iridium, Types = require("Iridium"), require("Iridium/Types")

-- Deserialize bytecode from a string or buffer
local deserialized = Iridium:Deserialize(bytecodeData)

-- Access function information
local mainFunction = deserialized.Protos[deserialized.ProtoEntryPoint]

-- Inspect instructions
for i, instruction in ipairs(mainFunction.Instructions) do
    print(instruction.Code, instruction.Encodings.A, instruction.Encodings.B, instruction.Encodings.C)
end

-- Access constants
for i, constant in ipairs(mainFunction.Constants) do
    print(constant.ClassName, constant)
end

For advanced usage I'd suggest checking this example out

Building from Source

Click here.

Contributing

Contributions are welcome! Feel free to submit issues or pull requests to help improve Iridium.

Authors

  • ActualMasterOogway - Creator and main developer

Acknowledgements

  • atrexus - Unluau was a really helpful resource
  • lovre - Platinum helped me find where I was underreading/overreading
  • GRH - Helped me reading line information correctly ❤