问题描述
|
我正在使用此脚本加密我的Lua代码。
local script = string.dump(
function()
local function h4x(strtbl)
buffer=\"\"
for v in strtbl do
buffer=buffer..strtbl[v]
end
return buffer
end
print(\"encrypted\")
end
)
buff=\"\"
for v=1,string.len(script) do --Convert our string into a hex string.
buff=buff..\'\\\\\'..string.byte(script,v)
end
file=io.open(\'encrypted.txt\',\'w\') --Output our bytecode into ascii format to encrypted.txt
file:write(buff)
file:flush()
file:close()
crypto.txt的输出类似于\“ 00/12/46/4/2/6/4/62 / \”。如何解密字节码?
解决方法
此文本未加密。它只是十六进制的Lua字节码。
关于将字节码反汇编为人类可读操作码的方法的讨论是另一个问题:Lua等同于Python dis()吗?
,显然,其将每个BYTE打印为以\'/ \'分隔的值(即使已声明转换为十六进制,也为十进制)。
然后,您要做的就是使用从字符串中提取的字节填充数组,并使用
tonumber
将其转换回其字节值。这将有助于解析格式化的输出