Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad header in precompiled chunk #91

Open
olejika opened this issue Dec 22, 2022 · 4 comments
Open

bad header in precompiled chunk #91

olejika opened this issue Dec 22, 2022 · 4 comments

Comments

@olejika
Copy link

olejika commented Dec 22, 2022

bw-scripts.zip

@testuser7
Copy link

I have the same problem:
dumper.zip

@apsonLi
Copy link

apsonLi commented Jun 8, 2023

@testuser7 i had decompiled successfully the sample which you uploaded , u can achieve it by fixing the original code

@testuser7
Copy link

u can achieve it by fixing the original code

Where I can find this fix?

@apsonLi
Copy link

apsonLi commented Jun 9, 2023

u can achieve it by fixing the original code

Where I can find this fix?

Decompilation of the sample you uploaded:

-- params : ...
-- function num : 0
module("dumper", package.seeall)
require("json")
json_encode = function(l_1_0, l_1_1)
-- function num : 0_0
local l_1_2 = (json.encode)(l_1_0)
if l_1_1 ~= nil and l_1_1 == 1 then
return l_1_2
end
local l_1_3 = ""
local l_1_4 = 1
local l_1_5 = 0
local l_1_6 = 3
local l_1_7 = (string.sub)(l_1_2, l_1_4, 1)
while 1 do
if l_1_4 <= (string.len)(l_1_2) then
do
if l_1_7 == """ and l_1_4 - 1 > 0 and (string.sub)(l_1_2, l_1_4 - 1, l_1_4 - 1) ~= "\" then
if false == true then
local l_1_8, l_1_9, l_1_10, l_1_11, l_1_12 = false
else
end
end
if l_1_7 == ":" and true == false then
l_1_3 = l_1_3 .. " : "
else
-- DECOMPILER ERROR at PC54: Confused about usage of register: R8 in 'UnsetPending'

      if l_1_7 == "," and true == false then
        l_1_3 = l_1_3 .. ",\n" .. (string.rep)(" ", l_1_5)
      else
        -- DECOMPILER ERROR at PC69: Confused about usage of register: R8 in 'UnsetPending'

        if (l_1_7 == "{" or l_1_7 == "[") and true == false then
          if l_1_4 - 1 > 0 and (string.sub)(l_1_2, l_1_4 - 1, l_1_4 - 1) ~= ":" and (string.sub)(l_1_2, l_1_4 - 1, l_1_4 - 1) ~= "," then
            l_1_3 = l_1_3 .. "\n" .. (string.rep)(" ", l_1_5)
          end
          l_1_3 = l_1_3 .. l_1_7 .. "\n" .. (string.rep)(" ", l_1_5 + l_1_6)
          l_1_5 = l_1_5 + l_1_6
        else
          -- DECOMPILER ERROR at PC113: Confused about usage of register: R8 in 'UnsetPending'

          if (l_1_7 == "}" or l_1_7 == "]") and true == false then
            if l_1_5 - l_1_6 >= 0 then
              l_1_5 = l_1_5 - l_1_6
            else
              l_1_5 = 0
            end
            if (string.sub)(l_1_2, l_1_4 + 1, l_1_4 + 1) == "," then
              l_1_4 = l_1_4 + 1
              l_1_3 = l_1_3 .. "\n" .. (string.rep)(" ", l_1_5) .. l_1_7 .. ",\n"
            else
              l_1_3 = l_1_3 .. "\n" .. (string.rep)(" ", l_1_5) .. l_1_7 .. "\n"
            end
            l_1_3 = l_1_3 .. (string.rep)(" ", l_1_5)
          else
            l_1_3 = l_1_3 .. l_1_7
          end
        end
      end
    end
    l_1_4 = l_1_4 + 1
    l_1_7 = (string.sub)(l_1_2, l_1_4, l_1_4)
    -- DECOMPILER ERROR at PC170: LeaveBlock: unexpected jumping out DO_STMT

    -- DECOMPILER ERROR at PC170: LeaveBlock: unexpected jumping out IF_THEN_STMT

    -- DECOMPILER ERROR at PC170: LeaveBlock: unexpected jumping out IF_STMT

  end
end

end
return l_1_3
end

dumpTable = function(l_2_0, l_2_1)
-- function num : 0_1
print(json_encode(l_2_0, l_2_1))
end


if you need ,i could send u the luadec which i fixed ,but because of my spare time consumption, may be u should put a price on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@testuser7 @olejika @apsonLi and others