luadec icon indicating copy to clipboard operation
luadec copied to clipboard

bad header in precompiled chunk

Open olejika opened this issue 2 years ago • 4 comments

bw-scripts.zip

olejika avatar Dec 22 '22 20:12 olejika

I have the same problem: dumper.zip

testuser7 avatar Jan 10 '23 22:01 testuser7

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

apsonLi avatar Jun 08 '23 06:06 apsonLi

u can achieve it by fixing the original code

Where I can find this fix?

testuser7 avatar Jun 09 '23 09:06 testuser7

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

apsonLi avatar Jun 09 '23 09:06 apsonLi