从此代码的输出中获取输入

时间:2017-05-15 00:18:10

标签: lua

我想知道相反的代码来从这段代码的输出中获取输入 这个脚本在转换" CODEXXXCODEXXX"对于数字,现在虽然我有我想要的数字" CODEXXXCODEXXX"背部。提前谢谢

local script = string.dump(
function()

-------------

--CODEXXXCODEXXX

-------------

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()

1 个答案:

答案 0 :(得分:0)

读取文件并重建字符串(注意:使用反斜杠作为数字后面的分隔符 - 而不是之前)

script = "Hello World!"

buff = ""
for v=1,string.len(script) do --Convert our string into a [hex] byte string.
     buff = buff..string.byte(script,v)..'\\'
end

print(buff)

str_back = ""
for num in buff:gmatch("(%d+)\\") do
    str_back = str_back..string.char(num)
end

print(str_back)