Advertisement
aiden50_70

Untitled

May 11th, 2020
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.57 KB | None | 0 0
  1.  
  2. local Byte = string.byte;
  3. local Char = string.char;
  4. local Sub = string.sub;
  5. local Concat = table.concat;
  6. local Insert = table.insert;
  7. local LDExp = math.ldexp;
  8. local GetFEnv = getfenv or function() return _ENV end;
  9. local Setmetatable = setmetatable;
  10. local Select = select;
  11.  
  12. local Unpack = unpack or table.unpack;
  13. local ToNumber = tonumber;local function decompress(b)local c,d,e="","",{}local f=256;local g={}for h=0,f-1 do g[h]=Char(h)end;local i=1;local function k()local l=ToNumber(Sub(b, i,i),36)i=i+1;local m=ToNumber(Sub(b, i,i+l-1),36)i=i+l;return m end;c=Char(k())e[1]=c;while i<#b do local n=k()if g[n]then d=g[n]else d=c..Sub(c, 1,1)end;g[f]=c..Sub(d, 1,1)e[#e+1],c,f=d,d,f+1 end;return table.concat(e)end;local ByteString=decompress('101227510172751223623422Z23023A101927922Y22V2322322311Y23923123423222U12162791G112791327W27528027427927V2761228028827Z27928C');
  14.  
  15. local BitLibrary = bit or bit32 or require('bit')
  16. local BitXOR = BitLibrary.bxor
  17.  
  18. local function gBit(Bit, Start, End)
  19. if End then
  20. local Res = (Bit / 2 ^ (Start - 1)) % 2 ^ ((End - 1) - (Start - 1) + 1);
  21. return Res - Res % 1;
  22. else
  23. local Plc = 2 ^ (Start - 1);
  24. return (Bit % (Plc + Plc) >= Plc) and 1 or 0;
  25. end;
  26. end;
  27.  
  28. local Pos = 1;
  29.  
  30. local function gBits32()
  31. local W, X, Y, Z = Byte(ByteString, Pos, Pos + 3);
  32.  
  33. W = BitXOR(W, 2)
  34. X = BitXOR(X, 2)
  35. Y = BitXOR(Y, 2)
  36. Z = BitXOR(Z, 2)
  37.  
  38. Pos = Pos + 4;
  39. return (Z*16777216) + (Y*65536) + (X*256) + W;
  40. end;
  41.  
  42. local function gBits8()
  43. local F = BitXOR(Byte(ByteString, Pos, Pos), 2);
  44. Pos = Pos + 1;
  45. return F;
  46. end;
  47.  
  48. local function gBits16()
  49. local W, X = Byte(ByteString, Pos, Pos + 2);
  50.  
  51. W = BitXOR(W, 2)
  52. X = BitXOR(X, 2)
  53.  
  54. Pos = Pos + 2;
  55. return (X*256) + W;
  56. end;
  57.  
  58. local function gFloat()
  59. local Left = gBits32();
  60. local Right = gBits32();
  61. local IsNormal = 1;
  62. local Mantissa = (gBit(Right, 1, 20) * (2 ^ 32))
  63. + Left;
  64. local Exponent = gBit(Right, 21, 31);
  65. local Sign = ((-1) ^ gBit(Right, 32));
  66. if (Exponent == 0) then
  67. if (Mantissa == 0) then
  68. return Sign * 0; -- +-0
  69. else
  70. Exponent = 1;
  71. IsNormal = 0;
  72. end;
  73. elseif (Exponent == 2047) then
  74. return (Mantissa == 0) and (Sign * (1 / 0)) or (Sign * (0 / 0));
  75. end;
  76. return LDExp(Sign, Exponent - 1023) * (IsNormal + (Mantissa / (2 ^ 52)));
  77. end;
  78.  
  79. local gSizet = gBits32;
  80. local function gString(Len)
  81. local Str;
  82. if (not Len) then
  83. Len = gSizet();
  84. if (Len == 0) then
  85. return '';
  86. end;
  87. end;
  88.  
  89. Str = Sub(ByteString, Pos, Pos + Len - 1);
  90. Pos = Pos + Len;
  91.  
  92. local FStr = {}
  93. for Idx = 1, #Str do
  94. FStr[Idx] = Char(BitXOR(Byte(Sub(Str, Idx, Idx)), 2))
  95. end
  96.  
  97. return Concat(FStr);
  98. end;
  99.  
  100. local gInt = gBits32;
  101. local function _R(...) return {...}, Select('#', ...) end
  102.  
  103. local function Deserialize()
  104. local Instrs = {};
  105. local Functions = {};
  106. local Lines = {};
  107. local Chunk =
  108. {
  109. Instrs,
  110. Functions,
  111. nil,
  112. Lines
  113. };
  114. local ConstCount = gBits32()
  115. local Consts = {}
  116.  
  117. for Idx=1, ConstCount do
  118. local Type =gBits8();
  119. local Cons;
  120.  
  121. if(Type==3) then Cons = (gBits8() ~= 0);
  122. elseif(Type==1) then Cons = gFloat();
  123. elseif(Type==2) then Cons = gString();
  124. end;
  125.  
  126. Consts[Idx] = Cons;
  127. end;
  128. Chunk[3] = gBits8();for Idx=1,gBits32() do
  129. local Descriptor = gBits8();
  130. if (gBit(Descriptor, 1, 1) == 0) then
  131. local Type = gBit(Descriptor, 2, 3);
  132. local Mask = gBit(Descriptor, 4, 6);
  133.  
  134. local Inst=
  135. {
  136. gBits16(),
  137. gBits16(),
  138. nil,
  139. nil
  140. };
  141.  
  142. if (Type == 0) then
  143. Inst[3] = gBits16();
  144. Inst[4] = gBits16();
  145. elseif(Type==1) then
  146. Inst[3] = gBits32();
  147. elseif(Type==2) then
  148. Inst[3] = gBits32() - (2 ^ 16)
  149. elseif(Type==3) then
  150. Inst[3] = gBits32() - (2 ^ 16)
  151. Inst[4] = gBits16();
  152. end;
  153.  
  154. if (gBit(Mask, 1, 1) == 1) then Inst[2] = Consts[Inst[2]] end
  155. if (gBit(Mask, 2, 2) == 1) then Inst[3] = Consts[Inst[3]] end
  156. if (gBit(Mask, 3, 3) == 1) then Inst[4] = Consts[Inst[4]] end
  157.  
  158. Instrs[Idx] = Inst;
  159. end
  160. end;for Idx=1,gBits32() do Functions[Idx-1]=Deserialize();end;return Chunk;end;
  161. local function Wrap(Chunk, Upvalues, Env)
  162. local Instr = Chunk[1];
  163. local Proto = Chunk[2];
  164. local Params = Chunk[3];
  165.  
  166. return function(...)
  167. local Instr = Instr;
  168. local Proto = Proto;
  169. local Params = Params;
  170.  
  171. local _R = _R
  172. local InstrPoint = 1;
  173. local Top = -1;
  174.  
  175. local Vararg = {};
  176. local Args = {...};
  177.  
  178. local PCount = Select('#', ...) - 1;
  179.  
  180. local Lupvals = {};
  181. local Stk = {};
  182.  
  183. for Idx = 0, PCount do
  184. if (Idx >= Params) then
  185. Vararg[Idx - Params] = Args[Idx + 1];
  186. else
  187. Stk[Idx] = Args[Idx + 1];
  188. end;
  189. end;
  190.  
  191. local Varargsz = PCount - Params + 1
  192.  
  193. local Inst;
  194. local Enum;
  195.  
  196. while true do
  197. Inst = Instr[InstrPoint];
  198. Enum = Inst[1];if Enum <= 3 then if Enum <= 1 then if Enum > 0 then do return end;else Stk[Inst[2]] = Inst[3];end; elseif Enum == 2 then Stk[Inst[2]]=Env[Inst[3]];else Stk[Inst[2]]=Env[Inst[3]];end; elseif Enum <= 5 then if Enum == 4 then
  199. local A = Inst[2]
  200. Stk[A](Stk[A + 1])
  201. else Stk[Inst[2]] = Inst[3];end; elseif Enum > 6 then
  202. local A = Inst[2]
  203. Stk[A](Stk[A + 1])
  204. else do return end;end;
  205. InstrPoint = InstrPoint + 1;
  206. end;
  207. end;
  208. end;
  209. return Wrap(Deserialize(), {}, GetFEnv())();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement