-
Notifications
You must be signed in to change notification settings - Fork 34
Write custom luac parser
metaworm edited this page Oct 5, 2023
·
5 revisions
To write a custom parser for metaworm's luadec, you should
- Export a function as name
parse
like this, which parse the binary luac into LuaBytecode struct, and invoke its to_msgpack method to convert to uniform serialized style
use extism_pdk::*;
#[plugin_fn]
pub fn parse(luac: Vec<u8>) -> FnResult<Vec<u8>> {
parse_(&luac)
.map_err(|e| WithReturnCode::from(e))?
.to_msgpack()
.map_err(|e| WithReturnCode::from(e))
}
- Build it as WASM
cargo b -r --target wasm32-unknown-unknown
and load it to decompiler
Refer to this repo: https://github.com/metaworm/openwrt-luac-parser