Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何反编译这个Lua字节码?_Lua_Hex_Bytecode_Decompiling - Fatal编程技术网

如何反编译这个Lua字节码?

如何反编译这个Lua字节码?,lua,hex,bytecode,decompiling,Lua,Hex,Bytecode,Decompiling,所以我有一些Lua字节码,现在我想把它重新编译成人类可读的代码: \27\76\117\97\81\0\1\4\8\4\8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\2\4\0\0\0\5\0\0\0\65\64\0\0\28\64\0\1\30\0\128\0\2\0\0\0\4\6\0\0\0\0\0\0\0\112\114\105\110\116\0\4\9\0\0\0\0\0\0\0\72\105\32\116\104\101\114\101\0\0

所以我有一些Lua字节码,现在我想把它重新编译成人类可读的代码:

\27\76\117\97\81\0\1\4\8\4\8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\2\4\0\0\0\5\0\0\0\65\64\0\0\28\64\0\1\30\0\128\0\2\0\0\0\4\6\0\0\0\0\0\0\0\112\114\105\110\116\0\4\9\0\0\0\0\0\0\0\72\105\32\116\104\101\114\101\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
我将如何实现这一点?我已尝试使用LuaDec,但出现以下错误:

预编译块中的标头错误

如果有人能帮助我,那就太好了。

步骤1 将字节码写入文件

local str = '\27\76\117\97\81\0\1\4\8\4\8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\2\4\0\0\0\5\0\0\0\65\64\0\0\28\64\0\1\30\0\128\0\2\0\0\0\4\6\0\0\0\0\0\0\0\112\114\105\110\116\0\4\9\0\0\0\0\0\0\0\72\105\32\116\104\101\114\101\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'
local file = io.open("bytecode.lua", "wb")
file:write(str)
file:close()
步骤2 安装Lua 5.1请参见Lua.org了解详细信息

步骤3 运行luac查看字节码的内容

$ ~/lua-5.1.5/src/luac -l -l -p bytecode.lua

main <?:0,0> (4 instructions, 16 bytes at 0x19fd550)
0+ params, 2 slots, 0 upvalues, 0 locals, 2 constants, 0 functions
    1   [-] GETGLOBAL   0 -1    ; print
    2   [-] LOADK       1 -2    ; "Hi there"
    3   [-] CALL        0 2 1
    4   [-] RETURN      0 1
constants (2) for 0x19fd550:
    1   "print"
    2   "Hi there"
locals (0) for 0x19fd550:
upvalues (0) for 0x19fd550:

反编译完成。

Lua似乎是使用以下代码编码的:我就是这么想的,但我仍然得到相同的错误:luac:字节码。Lua:预编译块中的错误头确保正确保存字节码。bytecode.lua文件的SHA256是c0189615b。。。
print("Hi there")