import java.util.
*;
import java.lang.reflect.*;
public class TranslatedLua {
// This variable is used to simulate the Lua assignment in the first line.
static String _BZoAeVqYvBtQ;
// Define a functional interface to simulate Lua’s anonymous functions.
interface LuaFunction {
Object call(Object... args);
}
public static void main(String[] args) {
// ----------------------------------------------------------------
// ([[This file was protected with MoonSec V3]]):gsub('.+',
// (function(a) _BZoAeVqYvBtQ = a; end));
// In Lua this converts the string "This file was protected with MoonSec
V3"
// by a global substitution that matches the whole string and passes it to
// an anonymous function that assigns it to _BZoAeVqYvBtQ.
// In Java we simply do:
String initialStr = "This file was protected with MoonSec V3";
_BZoAeVqYvBtQ = initialStr;
// ----------------------------------------------------------------
// ----------------------------------------------------------------
// return (function(l,...) ... end);
// The entire remainder of the Lua code is wrapped inside an anonymous
function
// that is returned. We simulate that by writing a LuaFunction and
immediately
// calling it. (The first parameter l in Lua is forced to be a function in
our case.)
LuaFunction mainFunc = new LuaFunction() {
public Object call(Object... outerArgs) {
// In Lua: function(l,...)
Object l = outerArgs[0]; // first argument
// Many local variables are declared:
Object d = null;
Object a = null;
Object h = null;
Object t = null;
Object o = null;
Object p = null;
int e = 24915;
int n = 0;
// Lua table -> using a HashMap to simulate.
HashMap<Object, Object> r = new HashMap<>();
// while n<104 do n=n+1; ... end
while(n < 104) {
n = n + 1;
// while n < 0x1a7 and e % 0x3d98 < 0x1ecc do
while(n < 0x1a7 && (e % 0x3d98) < 0x1ecc) {
n = n + 1;
e = (e - 178) % 29917;
int f = n + e;
if(e % 0x1a48 >= 0xd24) {
e = (e - 0x2ac) % 0xbf3c;
// while n < 0x22c and e % 0x15dc < 0xaee do
while(n < 0x22c && (e % 0x15dc) < 0xaee) {
n = n + 1;
e = (e - 353) % 23354;
f = n + e;
if(e % 0x19dc <= 0xcee) {
e = (e * 0x3c4) % 0x2ad9;
// local e = 47336
int tempKey = 47336;
if (!r.containsKey(tempKey)) {
r.put(tempKey, 0x1);
}
} else if(e % 2 != 0) {
e = (e - 0x383) % 0x6471;
int tempKey = 82178;
if (!r.containsKey(tempKey)) {
r.put(tempKey, 0x1);
// p=function(r) ... end
p = new LuaFunction() {
public Object call(Object... args) {
// In Lua, parameter r is used as a
string upon which :sub is applied.
final String str =
args[0].toString();
// local e=0x01
final int[] localE = {0x01};
// local function n(n) e = e+n;
return r:sub(e-n,e-0x01) end
LuaFunction n_func = new
LuaFunction() {
public Object call(Object...
innerArgs) {
int inc = ((Number)
innerArgs[0]).intValue();
int temp = localE[0];
localE[0] = localE[0] +
inc;
// Lua’s string.sub is 1-
indexed; in Java we use substring (0-indexed).
// We assume that the
conversion works identically.
int start = temp - inc; //
approximate simulation
int end = localE[0] - 1;
return str.substring(start,
end);
}
};
// while true do ... end
while (true) {
// local r=n(0x01)
String r_val =
n_func.call(0x01).toString();
if (r_val.equals("\5")) {
break;
}
// local e = d.byte(n(0x01))
// Simulate string.byte by
using charAt.
int byteVal = ((String)
d).charAt(((Number)n_func.call(0x01)).intValue());
// local e = n(e)
int e_val =
n_func.call(byteVal).toString().charAt(0);
if(r_val.equals("\2")) {
// e = h.qinmdYMI(e)
try {
Method m =
h.getClass().getMethod("qinmdYMI", Object.class);
e_val = (Integer)
m.invoke(h, e_val);
} catch(Exception ex) {
// Error handling: do
nothing
}
} else if(r_val.equals("\3")) {
// e = e ~= "\0"
e_val = (!
(""+e_val).equals("\0")) ? 1 : 0;
} else if(r_val.equals("\6")) {
// o[e]=function(n,e)return
l(8,nil,l,e,n) end
final int capturedE =
e_val;
// Ensure o is a table: we
simulate with Map.
if(o == null) {
o = new HashMap<Object,
Object>();
}
((Map<Object, Object>)
o).put(capturedE, new LuaFunction() {
public Object
call(Object... funcArgs) {
// return
l(8,nil,l,e,n)
return
((LuaFunction) l).call(8, null, l, funcArgs[1], funcArgs[0]);
}
});
} else if(r_val.equals("\4")) {
// e = o[e]
// In Lua this is an index
access. We simulate it.
e_val = (((Map<Object,
Object>) o).get(e_val) != null) ? 0 : 0;
} else if(r_val.equals("\0")) {
// e = o[e]
[ n(d.byte(n(0x01))) ]
int index = ((String)
d).charAt(((Number)n_func.call(0x01)).intValue());
Object temp = ((Map<Object,
Object>) o).get(e_val);
if(temp instanceof List) {
List<?> listTemp =
(List<?>) temp;
e_val =
(listTemp.get(index) instanceof Number) ? ((Number) listTemp.get(index)).intValue()
: 0;
}
}
// local n=n(0x08)
int n_val =
((Number)n_func.call(0x08)).intValue();
// h[n] = e
if(h instanceof Map) {
((Map)h).put(n_val, e_val);
}
}
return null;
}
};
}
} else {
e = (e * 0x38) % 0x6f70;
n = n + 1;
int tempKey = 25657;
if (!r.containsKey(tempKey)) {
r.put(tempKey, 0x1);
t = "\
4\8\116\111\110\117\109\98\101\114\113\105\110\109\100\89\77\73\0\6\115\116\114\105
\110\103\4\99\104\97\114\97\71\82\77\121\69\74\66\0\6\115\116\114\105\110\103\3\115
\117\98\104\103\85\116\107\103\114\103\0\6\115\116\114\105\110\103\4\98\121\116\101
\107\107\77\115\90\118\112\106\0\5\116\97\98\108\101\6\99\111\110\99\97\116\66\111\
105\106\120\108\71\119\0\5\116\97\98\108\101\6\105\110\115\101\114\116\89\66\104\11
7\97\106\80\114\5";
}
}
}
} else if(e % 2 != 0) {
e = (e - 0x39) % 0x6e6b;
while(n < 0x86 && (e % 0x31c8) < 0x18e4) {
n = n + 1;
e = (e - 773) % 44094;
int p_calc = n + e;
if(e % 0x1f6c >= 0xfb6) {
e = (e - 0x5d) % 0x8b89;
int tempKey = 4432;
if (!r.containsKey(tempKey)) {
r.put(tempKey, 0x1);
// o=(not o)and _ENV or o;
// In Lua this picks _ENV if o is falsey.
o = (o == null) ? System.getenv() : o;
}
} else if(e % 2 != 0) {
e = (e + 0x14d) % 0xb207;
int tempKey = 27994;
if (!r.containsKey(tempKey)) {
r.put(tempKey, 0x1);
// o = getfenv and getfenv();
// In Java we simulate getfenv by using
reflection if available.
try {
Method m =
TranslatedLua.class.getMethod("getfenv");
o = m.invoke(null);
} catch(Exception ex) {
o = null;
}
}
} else {
e = (e * 0x39d) % 0x7bdd;
n = n + 1;
int tempKey = 35669;
if (!r.containsKey(tempKey)) {
r.put(tempKey, 0x1);
// a = tonumber;
a = new LuaFunction() {
public Object call(Object... args) {
return
Integer.parseInt(args[0].toString());
}
};
}
}
}
} else {
e = (e * 0x109) % 0x5b92;
n = n + 1;
while(n < 0x2d1 && (e % 0x3926) < 0x1c93) {
n = n + 1;
e = (e * 770) % 35356;
int o_calc = n + e;
if(e % 0x4866 >= 0x2433) {
e = (e * 0x301) % 0x6f84;
int tempKey = 8946;
if (!r.containsKey(tempKey)) {
r.put(tempKey, 0x1);
// d = string;
// We simulate Lua’s string library by
simply using Java’s String class.
d = "";
}
} else if(e % 2 != 0) {
e = (e - 0x267) % 0x3e38;
int tempKey = 19372;
if (!r.containsKey(tempKey)) {
r.put(tempKey, 0x1);
}
} else {
e = (e * 0x1ff) % 0xda4;
n = n + 1;
int tempKey = 53003;
if (!r.containsKey(tempKey)) {
r.put(tempKey, 0x1);
// h = {};
h = new HashMap<Object, Object>();
}
}
}
}
e = (e + 174) % 49415;
}
}
// p(t);
if(p instanceof LuaFunction) {
((LuaFunction) p).call(t);
}
// local n = {}
HashMap<Object, Object> n_table = new HashMap<>();
// for e = 0x0, 0xff do
for (int e_i = 0; e_i <= 0xff; e_i++) {
try {
// local r = h.aGRMyEJB(e)
Method m = h.getClass().getMethod("aGRMyEJB", int.class);
Object r_val = m.invoke(h, e_i);
n_table.put(e_i, r_val);
n_table.put(r_val, e_i);
} catch(Exception ex) {
// Do nothing if method not found.
}
}
// local function f(e)return n[e]; end
LuaFunction f_func = new LuaFunction() {
public Object call(Object... args) {
return n_table.get(args[0]);
}
};
// local s = (function(l,p) ... end);
LuaFunction s = new LuaFunction() {
public Object call(Object... args) {
// Parameters: l, p
Object l_val = args[0];
String p_str = args[1].toString();
int t_val = 0x01, r_val = 0x10;
// local n = {{},{},{}}
ArrayList<HashMap<Object, Object>> n_list = new
ArrayList<>();
n_list.add(new HashMap<>());
n_list.add(new HashMap<>());
n_list.add(new HashMap<>());
int o_val = -0x01;
int e_val = 0x01;
Object d_val = l_val; // d = l
while (true) {
// In Lua: n[0x03][ h.hgUtkgrg(p, e, (function() e=t+e
return e-0x01 end)()) ]
int temp = t_val + e_val;
try {
Method m = h.getClass().getMethod("hgUtkgrg",
String.class, int.class, int.class);
Object subVal = m.invoke(h, p_str, e_val, temp -
1);
n_list.get(2).put(subVal, new Object() {
int value = ++o_val; // (function() o=o+0x01
return o end)()
}.value);
} catch(Exception ex) {
// ignore errors
o_val++;
}
if(o_val == 0x0f) {
o_val = "";
r_val = 0x000;
break;
}
}
int o_length = p_str.length();
while(e_val < o_length + 1) {
try {
Method m = h.getClass().getMethod("hgUtkgrg",
String.class, int.class, int.class);
Object subVal = m.invoke(h, p_str, e_val, (t_val +
e_val) - 1);
n_list.get(1).put(r_val, subVal);
} catch(Exception ex) {
// do nothing
}
r_val = r_val + 1;
if(r_val % 0x02 == 0x00) {
r_val = 0x00;
try {
Method m = h.getClass().getMethod("YBhuajPr",
HashMap.class, Object.class);
Object argForF =
f_func.call((((((n_list.get(2).get(n_list.get(1).get(0x00))) == null ? 0x00 :
(Integer) n_list.get(2).get(n_list.get(1).get(0x00))) * 0x10)
+
((n_list.get(2).get(n_list.get(1).get(0x01)) == null ? 0x00 : (Integer)
n_list.get(2).get(n_list.get(1).get(0x01))))
+ ((Number)d_val).intValue()) % 0x100);
m.invoke(h, n_list.get(0), argForF);
} catch(Exception ex) { }
// d = l+d; In Lua string concatenation – here we
simulate by numeric addition.
d_val = ((Number)d_val).intValue() +
((Number)l_val).intValue();
}
e_val = e_val + 1;
}
try {
Method m = h.getClass().getMethod("BoijxlGw",
HashMap.class);
return m.invoke(h, n_list.get(0));
} catch(Exception ex) { }
return null;
}
};
// p(s(116, "<obfuscated string>"));
// The next two lines call l() with the result of s(...)
((LuaFunction) l).call(s.call(116, "{(mZ>wL;eo*+3)uHeu(3)wLZHm;u>+
+HZ))+>+,Lw)HwZL3(;3>)+wL(HLw)"));
((LuaFunction) l).call(s.call(212,
"l7y:egQ#=n&kDS{RyDg{R#yee{#7&yD#n67Dgn#S&D&nR::eggQD&RD=SSDDRnn_&RSn7-:DeSnyDn{kRk
ekQ:&wgS=Syegy#g&QS={n:QeDQ=k#DS{e7&R+yykk{=7y:gQQ=kgg{n>ne=Q:neDySnyng7g{nSDRSQk={
=#SnSSDRDDgg=#D&n{=rDynQ9#:n7SJdQ77gryDQGR:77eD#7ngSv{ny=e7Q{&eDnRyyk::=y&yD:
{D::Rey:n{Sn0:eqQ#nQ=:D=7=y:e=n7&RSk7={N/
D&kD7RgyDe&QQ=RDkSgsneRgDeQ#7Sg7:eWngke{:K#yyeeyDgDRe7kek#=&yDgRQ7kyygk&Sk:1#7:e&Q7
eB#7YDyggy==&S#&7g:&Q==gk:
{#RDe{gR&QknR77n:S8D:&SgR&y=eg#:&#ky{=*Qg:QR=g{Q}QDDRnn3k{{77yeeQ7=R&:Sy7gyRe&#:Qyn
oy=eR#R&DSQRny&eRgQ=S&R{nySQ:QSnD#&&g:DQ&=Sk{RowDe:Q{n#kSRSRDyk_D:&S:R7yeen#:kdknSS
:9gkQ&kDDgRyD=R==S&S{DGDSgQyneD:{R7{yeg=&#ky{#y=g:#Q:S"));
// mhIrmCiEjbaAvFh=function(e) e((-h.w_QcGvAM+(function() local
r,n=h.uQqzUCLs,h.tqLRXmds;
// (function(e)e(e(e))end)(function(e) if r>h.miXJTSnB then
return e end
// r=r+h.tqLRXmds n=(n-h.TQDOXXdo)%h.UKnxCfMy if(n
%h.JLYJOLYg)<=h.ymkgYuyS then return e else return e(e(e and e)) end
// return e(e(e)) end) return n; end)()))
LuaFunction mhIrmCiEjbaAvFh = new LuaFunction() {
public Object call(Object... args) {
// Due to the heavy nesting and obfuscation we simulate the
operations using reflection.
// Here we call the passed function with an argument
computed as:
// -h.w_QcGvAM + (result of a nested anonymous function)
int part1 = 0;
try {
Method m = h.getClass().getMethod("w_QcGvAM");
part1 = (Integer) m.invoke(h);
} catch(Exception ex) {
}
// The inner function is highly nested; we simulate by
calling a dummy lambda.
LuaFunction inner = new LuaFunction() {
public Object call(Object... a) {
int r_local = 0;
int n_local = 0;
try {
Method m1 = h.getClass().getMethod("uQqzUCLs");
Method m2 = h.getClass().getMethod("tqLRXmds");
r_local = (Integer) m1.invoke(h);
n_local = (Integer) m2.invoke(h);
} catch(Exception ex) { }
// The inner anonymous function recursively calls
itself.
if(r_local > 0) { // simulate condition h.miXJTSnB
unavailable
return a[0];
}
r_local = r_local + 0; // r = r + h.tqLRXmds
simulation
n_local = (n_local - 0) % 1; // simulation
if(n_local <= 0) {
return a[0];
} else {
return this.call(a[0]);
}
}
};
int part2 = ((Number) inner.call(0)).intValue();
return ((LuaFunction) args[0]).call((-part1 + part2));
}
};
// hFvAabjEiCmrIhm={h.BOuOwWbM,h.egORiWFC};
Object[] hFvAabjEiCmrIhm = new Object[] {
invokeMethod(h, "BOuOwWbM", null),
invokeMethod(h, "egORiWFC", null)
};
// local e = (-h.eYSvxeti + (function() ... end)())
Object e_var;
int h_eYSvxeti = 0;
try {
Method m = h.getClass().getMethod("eYSvxeti");
h_eYSvxeti = (Integer) m.invoke(h);
} catch(Exception ex) { }
LuaFunction dummyLambda = new LuaFunction() {
public Object call(Object... args) {
// A dummy implementation to simulate the complex nested
lambda chain.
int d_local = 0, n_local = 0;
try {
Method m1 = h.getClass().getMethod("uQqzUCLs");
Method m2 = h.getClass().getMethod("tqLRXmds");
d_local = (Integer) m1.invoke(h);
n_local = (Integer) m2.invoke(h);
} catch(Exception ex) { }
return n_local;
}
};
e_var = -h_eYSvxeti + ((Number) dummyLambda.call()).intValue();
// local f = h.JTFgWAvj or h.Tz_zamia;
Object f_var = invokeMethod(h, "JTFgWAvj", null);
if(f_var == null) {
f_var = invokeMethod(h, "Tz_zamia", null);
}
// local pe = (getfenv) or (function() return _ENV end);
Object pe;
try {
Method m = TranslatedLua.class.getMethod("getfenv");
pe = m.invoke(null);
} catch(Exception ex) {
pe = System.getenv();
}
// local j = h.tqLRXmds;
Object j_var = invokeMethod(h, "tqLRXmds", null);
// local p = h.fCeEIVqs;
Object p_var = invokeMethod(h, "fCeEIVqs", null);
// local o = h.UrFVEY_s;
Object o_var = invokeMethod(h, "UrFVEY_s", null);
// local t = h.gHFlDPAz;
Object t_var = invokeMethod(h, "gHFlDPAz", null);
// local function re(k,...) local u = s(e, "<obfuscated>") end;
LuaFunction re = new LuaFunction() {
public Object call(Object... args) {
Object k = args[0];
// The rest uses s(e, "<obfuscated string>")
Object u = s.call(e_var, "R1Lor*}?#=U&C(Hp(1ULporr=}HUo?
##(=#(HoL(#p}pC}1J}1&LI1pp}1Coi?}1&#o&=L(CL(?HC(Hpo&#r(*L&?*n?
*CU#p=rU==UHp=*}=po1#=(LLo?rCoC1LH?rC?1Urp&&rHU#Hpru=1HuHp*rUrp/pL#=(*o?
#ol(}CUHpp*x=p=o<?*(Ur(?r&U*p?r=}=(po1#*CH}1&CYL*oUrpog(}1&#p#q*U=p}r(=?(H?1C?
1L}o&rwoLr?1C#1L*=HCr##((HLp?H?
rp1rL#pCoL}#r(=1(}#&&r(UoHHop=2(pp(*q=#HHr*C#1U}=&UJ&*U?
Hpp*}U5p1rL=1#&pprL=}H#o#C&Lo}C&(3H*(#1C11p?1&#ap*pH#oH#=(UL&?U=1H?
oU=)H>}oC^0r**U}p*-&}o&rE1r(U(p?o(=pH*oC#C1*?1&}<?*#U?&H1r*(}#TC*H=Cp=r}=CHW?}
(n1?}#&=Q#1??CCC1#1U&L-&rHUUo*=r(}L??#o}#L&rLH?UU11#r*&&Sr*r#*b&LC=p#=(pLU?&CC1&op?
&(?o1?LMr?CU*p}r?=}=#p(rpUUU#op=oH?o1o(H*LA#o#1LL?*Co1=*&UUXCrH=HU&*o=}pLo?
r)&Ho1#L(Le#}&&UC#rp?(r1=*HLoo#r(o&Lvq*r1U?U&&PC*(UCC}1U*(&18o*o}S2?r?U*p?
oH=*H*H#&p1}}M&1{L&=1o}?U&p#r&U1#&H?LC?(CH1(1(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}}UHp(*pHLop#o(rL*?r#}H*L*?CCp1(#1=H1#*p&191=rHpo*#}(?L}L}=UHr1U?((&oq?
r&p1LUrp#r*=}H?o}L(U#C??((*1H}pCqVpLI?r(LL8}}&?-?=Upro&#C((LCLL=<((op=L(1L*?
L(}*=UppUr&=CH&>=r&UrpH*k(rL(?*C}1?}}*&CULU*rC?1H}(&grLUCHoor#*(rCprL=oHo1=?
CC&1#*(Cp1H}}&Cv}}o#=p&r?=#HUrr}#HCo(#C11}?&Llo*rUo=?1r*r&1pU#CHrL(?HCp1H1r=1HLLp*?
C}L}U=pHrU=&HC&1Hpr1=CH}(LLo?*CU1}}?&#v?L=}p&U1oUYHpru}1Cpo(");
return null;
}
};
return null;
}
};
// We now call the main function with a dummy function for l.
mainFunc.call(new LuaFunction() {
public Object call(Object... args) {
return null;
}
});
}
// A helper method to simulate Lua's getfenv (if available) or return the
environment.
public static Object getfenv() {
return System.getenv();
}
// Utility method to invoke a method by name with parameters via reflection.
public static Object invokeMethod(Object obj, String methodName, Object[]
params) {
try {
if (obj == null) return null;
Class<?> cls = obj.getClass();
if(params == null) params = new Object[]{};
Class<?>[] paramTypes = new Class<?>[params.length];
for (int i = 0; i < params.length; i++) {
paramTypes[i] = params[i].getClass();
}
Method m = cls.getMethod(methodName, paramTypes);
return m.invoke(obj, params);
} catch(Exception ex) {
return null;
}
}
}