Advertisement
Guest User

Untitled

a guest
Jun 9th, 2017
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.07 KB | None | 0 0
  1. Класс авторизации
  2.  
  3. public class bf {
  4. public static bg m1104a(String str, String str2, String str3, boolean z, String str4, byte[] bArr) {
  5. bg bgVar;
  6. Exception exception;
  7. Exception e;
  8. bg bgVar2;
  9. Throwable th;
  10. String a = C0000a.m2a(str2, "$2a$10$OOv2wLxbNjUxVcc1sjysau");
  11. a = (!z || str3.isEmpty()) ? "{\"email\":\"" + str + "\",\"password\":\"" + a + "\"" : "{\"email\":\"" + str + "\",\"password\":\"" + a + "\",\"totp\":\"" + str3 + "\"";
  12. a = (bArr == null || bArr.length <= 0) ? a + "}" : a + ", \"sign\":\"" + C0136r.m1137a(bArr).toLowerCase() + "\",\"task\":\"" + str4 + "\"}";
  13. Log.d("Auth", "request: " + a);
  14. byte[] bytes = a.getBytes();
  15. try {
  16. HttpURLConnection httpURLConnection = null;
  17. try {
  18. HttpURLConnection httpURLConnection2 = (HttpURLConnection) new URL(z ? "https://rest.url.com/api/2.4/auth/login" : "https://rest.url.com/api/2.4/auth/register").openConnection();
  19. try {
  20. httpURLConnection2.setRequestProperty("Accept-Encoding", "");
  21. httpURLConnection2.setRequestProperty("Content-Type", "application/json");
  22. httpURLConnection2.setRequestProperty("Connection", "close");
  23. httpURLConnection2.setRequestProperty("User-Agent", m1105a());
  24. try {
  25. httpURLConnection2.setRequestMethod("POST");
  26. httpURLConnection2.setDoInput(true);
  27. httpURLConnection2.setDoOutput(true);
  28. httpURLConnection2.setFixedLengthStreamingMode(bytes.length);
  29. try {
  30. httpURLConnection2.getOutputStream().write(bytes);
  31. try {
  32. int responseCode = httpURLConnection2.getResponseCode();
  33.  
  34.  
  35.  
  36. Класс, в котором вызывается метод получения Sign
  37.  
  38. public class C0136r {
  39. private static final char[] f609a;
  40.  
  41. static {
  42. f609a = "0123456789ABCDEF".toCharArray();
  43. }
  44.  
  45. public static int m1136a(char c) {
  46. if (c >= '0' && c <= '9') {
  47. return c - 48;
  48. }
  49. if (c >= 'A' && c <= 'F') {
  50. return (c - 65) + 10;
  51. }
  52. if (c >= 'a' && c <= 'f') {
  53. return (c - 97) + 10;
  54. }
  55. throw new RuntimeException("Invalid hex character");
  56. }
  57.  
  58. public static String m1137a(byte[] bArr) {
  59. char[] cArr = new char[(bArr.length * 2)];
  60. for (int i = 0; i < bArr.length; i++) {
  61. int i2 = bArr[i] & 255;
  62. cArr[i * 2] = f609a[i2 >>> 4];
  63. cArr[(i * 2) + 1] = f609a[i2 & 15];
  64. }
  65. return new String(cArr);
  66. }
  67.  
  68. public static byte[] m1138a(String str) {
  69. if ((str.length() & 1) != 0) {
  70. throw new RuntimeException("Invalid hex string");
  71. }
  72. byte[] bArr = new byte[(str.length() / 2)];
  73. for (int i = 0; i < str.length() / 2; i++) {
  74. bArr[i] = (byte) ((C0136r.m1136a(str.charAt(i * 2)) << 4) | C0136r.m1136a(str.charAt((i * 2) + 1)));
  75. }
  76. return bArr;
  77. }
  78. }
  79.  
  80.  
  81. Класс, в котором вызывается метод авторизации
  82.  
  83. public C0139u(LoginActivity loginActivity, int i, Handler handler, String str, String str2, String str3) {
  84. this.f616a = loginActivity;
  85. this.f617b = i;
  86. this.f618c = handler;
  87. this.Username = str; \\Login
  88. this.Password = str2; \\ password
  89. this.f621f = str3; \\ Task
  90. }
  91.  
  92. byte[] m1140a(bj bjVar) {
  93. byte[] bytes = bjVar.f554b.getBytes();
  94. byte[] bArr = new byte[64];
  95. int i = 0;
  96. while (i < bjVar.f553a) {
  97. LoginActivity.keccak(bytes, bArr);
  98. i++;
  99. bytes = bArr;
  100. }
  101. return bArr;
  102. }
  103.  
  104. public void run() {
  105. if (this.f621f.isEmpty()) {
  106. bk c = bf.m1113c(this.Username);
  107. if (c.f555a) {
  108. bj bjVar = c.f557c;
  109. if (this.f617b == 0 ? c.f556b : false) {
  110. this.f618c.post(new C0138t(this.f616a, "Verification required", this.Username, ""));
  111. return;
  112. }
  113. bg a;
  114. do {
  115. bj bjVar2 = bjVar;
  116. a = bf.m1104a(this.Username, this.Password, "", this.f617b == 0, bjVar2.f554b, bjVar2.f553a > 0 ? m1140a(bjVar2) : null);
  117. bjVar = a.f548c;
  118. } while (bjVar != null);
  119. this.f618c.post(new C0138t(this.f616a, a.f546a, this.Username, a.f547b));
  120. return;
  121. }
  122. this.f618c.post(new C0138t(this.f616a, c.f558d, this.Username, ""));
  123. return;
  124. }
  125. bg a2 = bf.m1104a(this.Username, this.Password, this.f621f, this.f617b == 0, null, null);
  126. this.f618c.post(new C0138t(this.f616a, a2.f546a, this.Username, a2.f547b));
  127. }
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement