· 7 years ago · Apr 21, 2018, 08:02 PM
1import java.nio.ByteBuffer;
2import java.nio.IntBuffer;
3import java.security.SecureRandom;
4import java.util.Arrays;
5import android.support.annotation.NonNull;
6import android.util.Base64;
7import java.util.concurrent.atomic.AtomicReference;
8import android.support.v7.widget.helper.ItemTouchHelper.Callback;
9
10import javax.crypto.spec.IvParameterSpec;
11import javax.crypto.spec.PBEKeySpec;
12import javax.crypto.spec.SecretKeySpec;
13import java.security.Key;
14
15import javax.crypto.Cipher;
16import javax.crypto.Mac;
17import javax.crypto.SecretKey;
18import javax.crypto.SecretKeyFactory;
19
20import java.security.InvalidKeyException;
21import java.security.NoSuchAlgorithmException;
22
23
24public class HelloWorld
25{
26 //rK7g5nQOnVKEJly17CcB50fnA11SO5ofR0Z6aQDzoaXoYgEAAPV-ME5TDAR2Z2kpiC9apbjp3md_muDXp3SrLAdlfpTe125CGw==;ATIuNC4wAAAAADE0MDEw
27
28 static String postbody = ("username=fgjhghh&password=vfhjhhg&grant_type=password&edidSessionId=76f11486-55de-434b-8240-02b929943a3f&client_id=befcbc59-53ac-4db3-8292-7cab81a13d5e&client_secret=td");
29
30 static String optString = "V6y8yuKPUmrkCc47d2u7Tj-7T8t3neFvjBJfkw==";
31 static String bArr2 = "Um729YCRdXGftuhmvNK8o0e6J__xxL9dBTiULA==";
32
33 static byte[] aOptStringbArr2;
34
35 public volatile static byte[] f11159a;
36
37 static byte[] aPostBodyF11159a;
38
39 public volatile static byte[] f11160b;
40
41 public static byte[] m13163a(String str) {
42 try {
43 return Base64.decode(str, 10);
44 } catch (Exception e) {
45 return Base64.decode("", 10);
46 }
47 }
48
49 public static byte[] m13164a(byte[] bArr, byte[] bArr2) {
50 byte[] bArr3 = null;
51 if (bArr2 != null) {
52 try {
53 Key secretKeySpec = new SecretKeySpec(bArr2, m13133c());
54 Mac instance = Mac.getInstance(m13133c());
55 instance.init(secretKeySpec);
56 bArr3 = instance.doFinal(bArr);
57 } catch (InvalidKeyException e) {
58 System.out.println("M10");
59 } catch (NoSuchAlgorithmException e2) {
60 System.out.println("M11");
61 } catch (Exception e3) {
62 System.out.println("M100");
63 }
64 }
65 return bArr3;
66 }
67
68 //=======
69 public static String m13133c() {
70 return m13131a(new byte[]{(byte) -68, (byte) 86, (byte) 32, (byte) -52, (byte) 122, (byte) 55, (byte) -50, (byte) 55, (byte) 96, (byte) 70, (byte) 24, (byte) 46, (byte) 27, (byte) 104, (byte) 22, (byte) -119}, f10457d);
71 }
72
73 private static SecretKey f10457d = m13129C();
74 private static byte[] f10456c = new byte[]{(byte) 114, (byte) -122, (byte) 70, Byte.MAX_VALUE, (byte) -11, (byte) 40, (byte) -11, (byte) -37, (byte) -49, (byte) 26, (byte) -40, (byte) -47, (byte) -19, (byte) 9, (byte) -127, (byte) 94};
75
76 private static String m13131a(byte[] bArr, SecretKey secretKey) {
77 if (!(bArr == null || secretKey == null)) {
78 try {
79 Cipher instance = Cipher.getInstance("AES/CBC/PKCS5Padding");
80 instance.init(2, secretKey, new IvParameterSpec(f10456c));
81 return new String(instance.doFinal(bArr), "UTF-8");
82 } catch (Exception e) {
83 }
84 }
85 return "";
86 }
87
88 private static SecretKey m13129C() {
89 int i = 0;
90 try {
91 int[] iArr = new int[]{368, 296, 179, 528, 3, 318, 564, 1, 292, 536, 439, 192, 633, 333, 40, 556, 325, 277, 16, 536, 275, 343, 40, 522, 41, 268, 577, 414, 72, 618, 307, 312, 45, 521, 307, 28, 567, 33, 256, 620, 21, 340, 526, 336, 357, 12, 552, 299, 408, 236, 554, 383, 278, 6, 559, 393, 2, 638, 414, 82, 596, 436, 138, 629, 439, 30, 604, 268};
92 ByteBuffer allocate = ByteBuffer.allocate(48);
93 IntBuffer allocate2 = IntBuffer.allocate(48);
94 int i2 = 1;
95 int i3 = 0;
96 for (int i4 = 0; i4 < 68; i4++) {
97 if (iArr[i4] > 510) {
98 i3++;
99 i2 = 1;
100 } else if (i2 != 0) {
101 if (iArr[i4] > 255) {
102 allocate2.put((200 - iArr[i4]) + 255);
103 } else {
104 allocate2.put(iArr[i4] + Callback.DEFAULT_DRAG_ANIMATION_DURATION);
105 }
106 i2 = 0;
107 } else if (iArr[i4] > 255) {
108 allocate2.put((allocate2.get((i4 - 1) - i3) - iArr[i4]) + 255);
109 } else {
110 allocate2.put(allocate2.get((i4 - 1) - i3) + iArr[i4]);
111 }
112 }
113 int[] array = allocate2.array();
114 int length = array.length;
115 while (i < length) {
116 allocate.put(Integer.valueOf(array[i]).byteValue());
117 i++;
118 }
119 return new SecretKeySpec(Arrays.copyOfRange(SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1").generateSecret(new PBEKeySpec(Base64.encodeToString(allocate.array(), 1).toCharArray(), new byte[]{(byte) 97, (byte) -55, (byte) -80, (byte) 22, (byte) 33, (byte) -116, (byte) 52, (byte) 59, (byte) -104, (byte) -41, (byte) -39, (byte) 22, (byte) -32, (byte) -98, (byte) 61, (byte) -99, (byte) 42, (byte) 124, (byte) 31, (byte) -5, (byte) 10, (byte) -53, (byte) 61, (byte) -120, (byte) -85, (byte) 62, (byte) 73, (byte) -87, (byte) -6, (byte) -36, (byte) -22, (byte) -104}, 1024, 128)).getEncoded(), 0, 16), "AES");
120 } catch (Exception e) {
121 return null;
122 }
123 }
124
125
126 public final static String m14504a(@NonNull byte[] bArr, @NonNull byte[] bArr2) {
127 int i = 1;
128 StringBuilder stringBuilder = new StringBuilder();
129 stringBuilder.append(m14491b(bArr, bArr2));
130 ByteBuffer allocate = ByteBuffer.allocate(15);
131 ByteBuffer allocate2 = ByteBuffer.allocate(9);
132 allocate2.put("2.4.0".getBytes());
133 allocate2.flip();
134 allocate.put(Integer.valueOf(1).byteValue());
135 allocate.put(allocate2.array());
136
137 i = 0;
138
139 allocate.put(Integer.toString(i).getBytes());
140 allocate.put(m14522a());
141 allocate.flip();
142 String a = m13158a(allocate.array());
143 if (a.length() > 0) {
144 stringBuilder.append(";").append(a);
145 }
146 return stringBuilder.toString();
147 }
148
149 private static String m14491b(@NonNull byte[] bArr, @NonNull byte[] bArr2) {
150 byte[] bArr3 = new byte[(bArr.length + bArr2.length)];
151 int i = 0;
152 while (i < bArr3.length) {
153 bArr3[i] = i < bArr.length ? bArr[i] : bArr2[i - bArr.length];
154 i++;
155 }
156 return m13158a(bArr3);
157 }
158
159 public static String m13158a(byte[] bArr) {
160 try {
161 return Base64.encodeToString(bArr, 10);
162 } catch (Exception e) {
163 return "";
164 }
165 }
166
167 public final static byte[] m14522a() {
168 ByteBuffer allocate = ByteBuffer.allocate(4);
169 allocate.put(((String) "FF").getBytes()); //затеÑтить 80/10 20/10 FF/10
170 allocate.put(((String) "10").getBytes());
171 allocate.flip();
172 return allocate.array();
173 }
174
175 //========
176 public static void main(String[] args)
177 {
178 aOptStringbArr2 = m13164a(m13163a(optString), m13163a(bArr2));
179 f11159a = aOptStringbArr2;
180 f11160b = "ABUcwOliAQAAXpqxbtCTpMx8IXwrha0NmvC70zudXiLCLxfywvJRUejj".getBytes(); //uuid в байтах
181
182 aPostBodyF11159a = m13164a(postbody.getBytes(), f11159a);
183
184 //System.out.println(Arrays.toString(m13163a(optString)).getBytes());
185 System.out.println(m14504a(aPostBodyF11159a,f11160b));
186 }
187}