my friend sent me this code thats related to a project im working on, but he told me i had to find a way to deobfuscate it to actually understand what is happening. ive done some research, but cant find a way to deobfuscate it. can someone help me? and would be great to teach me how to as well so ill be able to do it myself in the future. would be greatly appreciated.
return (function(L_1_arg1, L_2_arg2, L_3_arg3)
local L_4_ = string.char;
local L_5_ = string.sub;
local L_6_ = table.concat;
local L_7_ = math.ldexp;
local L_8_ = getfenv or function()
return _ENV
end;
local L_9_ = select;
local L_10_ = unpack or table.unpack;
local L_11_ = tonumber;
local function L_12_func(L_28_arg1)
local L_29_, L_30_, L_31_ = "", "", {}
local L_32_ = 256;
local L_33_ = {}
for L_36_forvar1 = 0, L_32_ - 1 do
L_33_[L_36_forvar1] = L_4_(L_36_forvar1)
end;
local L_34_ = 1;
local function L_35_func()
local L_37_ = L_11_(L_5_(L_28_arg1, L_34_, L_34_), 36)
L_34_ = L_34_ + 1;
local L_38_ = L_11_(L_5_(L_28_arg1, L_34_, L_34_ + L_37_ - 1), 36)
L_34_ = L_34_ + L_37_;
return L_38_
end;
L_29_ = L_4_(L_35_func())
L_31_[1] = L_29_;
while L_34_ < #L_28_arg1 do
local L_39_ = L_35_func()
if L_33_[L_39_] then
L_30_ = L_33_[L_39_]
else
L_30_ = L_29_..L_5_(L_29_, 1, 1)
end;
L_33_[L_32_] = L_29_..L_5_(L_30_, 1, 1)
L_31_[#L_31_ + 1], L_29_, L_32_ = L_30_, L_30_, L_32_ + 1
end;
return table.concat(L_31_)
end;
local L_13_ = L_12_func('1S1R2751R27427522X23I22Y23223627A1R1V27623G23E23A23I1R1H27622K23I23322023I22X23123623C27M1M27622A23922W27U27S27U27W27Y27G27623E2322332371R28027527T27V27U22023323822X23E23G27Z27622G23823923H23623G23228P23323628V2761R1L27619192761Q29827529C1P27621N29E1R29C1O1R29A1R29M27H29529K29P1R29G29I29T29C1U29S29V2A229O29C29C27529O29G29G27529X2A91R1T1R21N29M2AD2781G29T2AA2752972952A61A29B295');
local L_14_ = (bit or bit32);
local L_15_ = L_14_ and L_14_.bxor or function(L_40_arg1, L_41_arg2)
local L_42_, L_43_, L_44_ = 1, 0, 10
while L_40_arg1 > 0 and L_41_arg2 > 0 do
local L_45_, L_46_ = L_40_arg1 % 2, L_41_arg2 % 2
if L_45_ ~= L_46_ then
L_43_ = L_43_ + L_42_
end
L_40_arg1, L_41_arg2, L_42_ = (L_40_arg1 - L_45_) / 2, (L_41_arg2 - L_46_) / 2, L_42_ * 2
end
if L_40_arg1 < L_41_arg2 then
L_40_arg1 = L_41_arg2
end
while L_40_arg1 > 0 do
local L_47_ = L_40_arg1 % 2
if L_47_ > 0 then
L_43_ = L_43_ + L_42_
end
L_40_arg1, L_42_ = (L_40_arg1 - L_47_) / 2, L_42_ * 2
end
return L_43_
end
local function L_16_func(L_48_arg1, L_49_arg2, L_50_arg3)
if L_50_arg3 then
local L_51_ = (L_48_arg1 / 2 ^ (L_49_arg2 - 1)) % 2 ^ ((L_50_arg3 - 1) - (L_49_arg2 - 1) + 1);
return L_51_ - L_51_ % 1;
else
local L_52_ = 2 ^ (L_49_arg2 - 1);
return (L_48_arg1 % (L_52_ + L_52_) >= L_52_) and 1 or 0;
end;
end;
local L_17_ = 1;
local function L_18_func()
local L_53_, L_54_, L_55_, L_56_ = L_1_arg1(L_13_, L_17_, L_17_ + 3);
L_53_ = L_15_(L_53_, 27)
L_54_ = L_15_(L_54_, 27)
L_55_ = L_15_(L_55_, 27)
L_56_ = L_15_(L_56_, 27)
L_17_ = L_17_ + 4;
return (L_56_ * 16777216) + (L_55_ * 65536) + (L_54_ * 256) + L_53_;
end;
local function L_19_func()
local L_57_ = L_15_(L_1_arg1(L_13_, L_17_, L_17_), 27);
L_17_ = L_17_ + 1;
return L_57_;
end;
local function L_20_func()
local L_58_, L_59_ = L_1_arg1(L_13_, L_17_, L_17_ + 2);
L_58_ = L_15_(L_58_, 27)
L_59_ = L_15_(L_59_, 27)
L_17_ = L_17_ + 2;
return (L_59_ * 256) + L_58_;
end;
local function L_21_func()
local L_60_ = L_18_func();
local L_61_ = L_18_func();
local L_62_ = 1;
local L_63_ = (L_16_func(L_61_, 1, 20) * (2 ^ 32)) + L_60_;
local L_64_ = L_16_func(L_61_, 21, 31);
local L_65_ = ((-1) ^ L_16_func(L_61_, 32));
if (L_64_ == 0) then
if (L_63_ == 0) then
return L_65_ * 0;
else
L_64_ = 1;
L_62_ = 0;
end;
elseif (L_64_ == 2047) then
return (L_63_ == 0) and (L_65_ * (1 / 0)) or (L_65_ * (0 / 0));
end;
return L_7_(L_65_, L_64_ - 1023) * (L_62_ + (L_63_ / (2 ^ 52)));
end;
local L_22_ = L_18_func;
local function L_23_func(L_66_arg1)
local L_67_;
if (not L_66_arg1) then
L_66_arg1 = L_22_();
if (L_66_arg1 == 0) then
return '';
end;
end;
L_67_ = L_5_(L_13_, L_17_, L_17_ + L_66_arg1 - 1);
L_17_ = L_17_ + L_66_arg1;
local L_68_ = {}
for L_69_forvar1 = 1, #L_67_ do
L_68_[L_69_forvar1] = L_4_(L_15_(L_1_arg1(L_5_(L_67_, L_69_forvar1, L_69_forvar1)), 27))
end
return L_6_(L_68_);
end;
local L_24_ = L_18_func;
local function L_25_func(...)
return {
...
}, L_9_('#', ...)
end
local function L_26_func()
local L_70_ = {};
local L_71_ = {};
local L_72_ = {};
local L_73_ = {
[#{
"1 + 1 = 111";
"1 + 1 = 111";
}] = L_71_,
[#{
"1 + 1 = 111";
"1 + 1 = 111";
"1 + 1 = 111";
}] = nil,
[#{
"1 + 1 = 111";
{
545;
872;
438;
422
};
"1 + 1 = 111";
{
691;
505;
809;
517
};
}] = L_72_,
[#{
"1 + 1 = 111";
}] = L_70_,
};
local L_74_ = L_18_func()
local L_75_ = {}
for L_76_forvar1 = 1, L_74_ do
local L_77_ = L_19_func();
local L_78_;
if (L_77_ == 1) then
L_78_ = (L_19_func() ~= 0);
elseif (L_77_ == 2) then
L_78_ = L_21_func();
elseif (L_77_ == 0) then
L_78_ = L_23_func();
end;
L_75_[L_76_forvar1] = L_78_;
end;
for L_79_forvar1 = 1, L_18_func() do
L_71_[L_79_forvar1 - 1] = L_26_func();
end;
for L_80_forvar1 = 1, L_18_func() do
local L_81_ = L_19_func();
if (L_16_func(L_81_, 1, 1) == 0) then
local L_82_ = L_16_func(L_81_, 2, 3);
local L_83_ = L_16_func(L_81_, 4, 6);
local L_84_ = {
L_20_func(),
L_20_func(),
nil,
nil
};
if (L_82_ == 0) then
L_84_[3] = L_20_func();
L_84_[4] = L_20_func();
elseif (L_82_ == 1) then
L_84_[3] = L_18_func();
elseif (L_82_ == 2) then
L_84_[3] = L_18_func() - (2 ^ 16)
elseif (L_82_ == 3) then
L_84_[3] = L_18_func() - (2 ^ 16)
L_84_[4] = L_20_func();
end;
if (L_16_func(L_83_, 1, 1) == 1) then
L_84_[2] = L_75_[L_84_[2]]
end
if (L_16_func(L_83_, 2, 2) == 1) then
L_84_[3] = L_75_[L_84_[3]]
end
if (L_16_func(L_83_, 3, 3) == 1) then
L_84_[4] = L_75_[L_84_[4]]
end
L_70_[L_80_forvar1] = L_84_;
end
end;
L_73_[3] = L_19_func();
return L_73_;
end;
local function L_27_func(L_85_arg1, L_86_arg2, L_87_arg3)
L_85_arg1 = (L_85_arg1 == true and L_26_func()) or L_85_arg1;
return (function(...)
local L_88_ = L_85_arg1[1];
local L_89_ = L_85_arg1[3];
local L_90_ = L_85_arg1[2];
local L_91_ = L_25_func
local L_92_ = 1;
local L_93_ = -1;
local L_94_ = {};
local L_95_ = {
...
};
local L_96_ = L_9_('#', ...) - 1;
local L_97_ = {};
local L_98_ = {};
for L_102_forvar1 = 0, L_96_ do
if (L_102_forvar1 >= L_89_) then
L_94_[L_102_forvar1 - L_89_] = L_95_[L_102_forvar1 + 1];
else
L_98_[L_102_forvar1] = L_95_[L_102_forvar1 + #{
"1 + 1 = 111";
}];
end;
end;
local L_99_ = L_96_ - L_89_ + 1
local L_100_;
local L_101_;
while true do
L_100_ = L_88_[L_92_];
L_101_ = L_100_[1];
if L_101_ <= 8 then
if L_101_ <= 3 then
if L_101_ <= 1 then
if L_101_ > 0 then
local L_103_ = L_100_[2]
local L_104_, L_105_ = L_91_(L_98_[L_103_](L_98_[L_103_ + 1]))
L_93_ = L_105_ + L_103_ - 1
local L_106_ = 0;
for L_107_forvar1 = L_103_, L_93_ do
L_106_ = L_106_ + 1;
L_98_[L_107_forvar1] = L_104_[L_106_];
end;
else
local L_108_ = L_100_[2]
L_98_[L_108_] = L_98_[L_108_](L_98_[L_108_ + 1])
end;
elseif L_101_ == 2 then
local L_109_ = L_100_[2]
L_98_[L_109_] = L_98_[L_109_](L_10_(L_98_, L_109_ + 1, L_100_[3]))
else
L_98_[L_100_[2]] = L_98_[L_100_[3]][L_100_[4]];
end;
elseif L_101_ <= 5 then
if L_101_ == 4 then
local L_110_ = L_100_[2]
L_98_[L_110_](L_10_(L_98_, L_110_ + 1, L_93_))
else
local L_111_ = L_100_[2];
local L_112_ = L_98_[L_100_[3]];
L_98_[L_111_ + 1] = L_112_;
L_98_[L_111_] = L_112_[L_100_[4]];
end;
elseif L_101_ <= 6 then
L_98_[L_100_[2]] = L_87_arg3[L_100_[3]];
elseif L_101_ > 7 then
L_98_[L_100_[2]] = L_100_[3];
else
local L_113_ = L_100_[2]
L_98_[L_113_] = L_98_[L_113_](L_98_[L_113_ + 1])
end;
elseif L_101_ <= 13 then
if L_101_ <= 10 then
if L_101_ > 9 then
local L_114_ = L_100_[2];
local L_115_ = L_98_[L_100_[3]];
L_98_[L_114_ + 1] = L_115_;
L_98_[L_114_] = L_115_[L_100_[4]];
else
local L_116_ = L_100_[2]
L_98_[L_116_] = L_98_[L_116_](L_10_(L_98_, L_116_ + 1, L_100_[3]))
end;
elseif L_101_ <= 11 then
local L_117_ = L_100_[2]
local L_118_, L_119_ = L_91_(L_98_[L_117_](L_98_[L_117_ + 1]))
L_93_ = L_119_ + L_117_ - 1
local L_120_ = 0;
for L_121_forvar1 = L_117_, L_93_ do
L_120_ = L_120_ + 1;
L_98_[L_121_forvar1] = L_118_[L_120_];
end;
elseif L_101_ == 12 then
do
return
end;
else
L_98_[L_100_[2]] = L_98_[L_100_[3]][L_100_[4]];
end;
elseif L_101_ <= 15 then
if L_101_ == 14 then
local L_122_ = L_100_[2]
L_98_[L_122_](L_10_(L_98_, L_122_ + 1, L_93_))
else
L_98_[L_100_[2]] = L_87_arg3[L_100_[3]];
end;
elseif L_101_ <= 16 then
L_98_[L_100_[2]] = L_100_[3];
elseif L_101_ == 17 then
do
return
end;
else
local L_123_;
local L_124_;
L_98_[L_100_[2]] = L_87_arg3[L_100_[3]];
L_92_ = L_92_ + 1;
L_100_ = L_88_[L_92_];
L_98_[L_100_[2]] = L_87_arg3[L_100_[3]];
L_92_ = L_92_ + 1;
L_100_ = L_88_[L_92_];
L_124_ = L_100_[2];
L_123_ = L_98_[L_100_[3]];
L_98_[L_124_ + 1] = L_123_;
L_98_[L_124_] = L_123_[L_100_[4]];
L_92_ = L_92_ + 1;
L_100_ = L_88_[L_92_];
L_98_[L_100_[2]] = L_100_[3];
L_92_ = L_92_ + 1;
L_100_ = L_88_[L_92_];
L_124_ = L_100_[2]
L_98_[L_124_] = L_98_[L_124_](L_10_(L_98_, L_124_ + 1, L_100_[3]))
L_92_ = L_92_ + 1;
L_100_ = L_88_[L_92_];
L_98_[L_100_[2]] = L_98_[L_100_[3]][L_100_[4]];
L_92_ = L_92_ + 1;
L_100_ = L_88_[L_92_];
L_124_ = L_100_[2]
L_98_[L_124_] = L_98_[L_124_](L_98_[L_124_ + 1])
L_92_ = L_92_ + 1;
L_100_ = L_88_[L_92_];
L_98_[L_100_[2]] = L_87_arg3[L_100_[3]];
L_92_ = L_92_ + 1;
L_100_ = L_88_[L_92_];
L_98_[L_100_[2]] = L_87_arg3[L_100_[3]];
L_92_ = L_92_ + 1;
L_100_ = L_88_[L_92_];
L_98_[L_100_[2]] = L_98_[L_100_[3]][L_100_[4]];
end;
L_92_ = L_92_ + 1;
end;
end);
end;
return L_27_func(true, {}, L_8_())();
end)(string.byte, table.insert, setmetatable);