解密Lua字节码?
我正在用这个脚本加密我的 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/”。如何解密字节码?
I'm encrypting my Lua code with this script.
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()
The output of encrypted.txt is like "00/12/46/4/2/6/4/62/". How do I decrypt bytecode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该文本未加密。它只是十六进制的 Lua 字节码。
关于将此字节码反汇编为人类可读操作码的方法的讨论在另一个问题中:Lua相当于Python dis ()?
This text is not encrypted. It's just Lua bytecode in hexadecimal.
Discussion of means of disassembling this bytecode into human-readable opcodes is in another question: Lua equivalent to Python dis()?
显然,它将每个字节打印为由“/”分隔的值(十进制,即使其声明已转换为十六进制)。
然后,您需要做的就是使用从字符串中提取的字节填充数组,并使用 tonumber 将它们转换回字节值。 这将有助于解析格式化输出
Obviously its printing out each BYTE as a value (which is decimal, even though its stated its converted to hex) delimited by a '/'.
All you need to do then is fill an array using the bytes you pull from the string, using
tonumber
to convert them back to their byte value. this will help with parsing the formatted output