Kate Mobile v109.1版本的 MD5 值为:fcd76ded5f363ecbfac46035a4ed2a23
以下内容为反编译后的 LoginLogic.java 源代码,内容仅作参考
package com.perm.kate.api;
import android.util.Log;
import com.perm.kate.Helper;
import com.perm.kate.KateConstants;
import com.perm.utils.ProxyManager;
import com.perm.utils.TokenHider;
import com.perm.utils.Utils;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import org.json.JSONException;
import org.json.JSONObject;
public class LoginLogic {
private String getConnectionError(HttpURLConnection httpURLConnection) {
InputStream errorStream;
if (httpURLConnection == null || (errorStream = httpURLConnection.getErrorStream()) == null) {
return null;
}
try {
return Utils.convertStreamToString(errorStream);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
public Object[] logInDirect(String str, String str2, String str3, String str4, String str5) {
String str6;
String str7;
int i;
MalformedURLException malformedURLException;
IOException iOException;
HttpURLConnection httpURLConnection;
String str8;
String connectionError;
String message;
JSONObject jSONObject;
String optString;
String str9;
String str10;
int responseCode;
JSONObject jSONObject2;
String optString2;
String str11;
Object[] objArr;
String str12 = "UTF-8";
try {
try {
try {
try {
} catch (MalformedURLException e) {
i = 1;
malformedURLException = e;
}
} catch (JSONException e2) {
Helper.reportError(e2);
e2.printStackTrace();
}
} catch (IOException e3) {
e = e3;
str6 = "error_description";
str7 = "redirect_uri";
str12 = "need_validation";
}
} catch (Throwable th) {
Helper.reportError(th);
th.printStackTrace();
}
try {
?? sb = new StringBuilder();
try {
sb.append("https://oauth.vk.com/token?grant_type=password&client_id=2685278&client_secret=");
sb.append(KateConstants.tmp);
sb.append("&username=");
sb.append(URLEncoder.encode(str, "UTF-8"));
sb.append("&password=");
sb.append(URLEncoder.encode(str2, "UTF-8"));
sb.append("&v=");
sb.append(URLEncoder.encode("5.139", "UTF-8"));
sb.append("&scope=");
sb.append(URLEncoder.encode(Auth.getSettings(), "UTF-8"));
String sb2 = sb.toString();
str9 = sb;
str9 = sb;
if (str3 != null && str4 != null) {
try {
?? sb3 = new StringBuilder();
sb3.append(sb2);
sb3.append("&captcha_sid=");
sb3.append(str3);
sb3.append("&captcha_key=");
sb3.append(str4);
sb2 = sb3.toString();
str9 = sb3;
} catch (IOException e4) {
iOException = e4;
str7 = "redirect_uri";
str12 = "need_validation";
httpURLConnection = null;
str8 = "error_description";
iOException.printStackTrace();
connectionError = getConnectionError(httpURLConnection);
if (connectionError != null) {
}
message = iOException.getMessage();
if (message != null) {
}
i = 1;
Object[] objArr2 = new Object[i];
objArr2[0] = 5;
return objArr2;
}
}
httpURLConnection = ProxyManager.getConnection(new URL(sb2));
try {
httpURLConnection.setConnectTimeout(30000);
httpURLConnection.setReadTimeout(30000);
if (str5 != null) {
try {
httpURLConnection.setRequestProperty("User-Agent", str5);
} catch (IOException e5) {
iOException = e5;
str7 = "redirect_uri";
str12 = "need_validation";
str8 = "error_description";
iOException.printStackTrace();
connectionError = getConnectionError(httpURLConnection);
if (connectionError != null) {
}
message = iOException.getMessage();
if (message != null) {
return new Object[]{1};
}
i = 1;
Object[] objArr22 = new Object[i];
objArr22[0] = 5;
return objArr22;
}
}
responseCode = httpURLConnection.getResponseCode();
StringBuilder sb4 = new StringBuilder();
str7 = "rc=";
sb4.append("rc=");
sb4.append(responseCode);
Log.i("Kate.LoginLogic", sb4.toString());
} catch (IOException e6) {
e = e6;
str7 = "redirect_uri";
str12 = "need_validation";
str10 = "error_description";
}
} catch (IOException e7) {
e = e7;
str7 = "redirect_uri";
str12 = "need_validation";
str6 = "error_description";
iOException = e;
httpURLConnection = null;
str8 = str6;
iOException.printStackTrace();
connectionError = getConnectionError(httpURLConnection);
if (connectionError != null) {
Log.i("Kate.LoginLogic", "error response=" + connectionError);
try {
jSONObject = new JSONObject(connectionError);
optString = jSONObject.optString("error");
} catch (JSONException e8) {
e8.printStackTrace();
Helper.reportError(e8);
}
if ("need_captcha".equals(optString)) {
return new Object[]{2, jSONObject.optString("captcha_img"), jSONObject.optString("captcha_sid")};
}
if ("invalid_client".equals(optString)) {
return new Object[]{1};
}
if ("invalid_request".equals(optString)) {
return new Object[]{7, jSONObject.optString(str8)};
}
if (str12.equals(optString)) {
return new Object[]{6, jSONObject.optString(str7)};
}
Helper.reportError(new Exception(connectionError));
}
message = iOException.getMessage();
if (message != null && message.equals("Received authentication challenge is null")) {
return new Object[]{1};
}
i = 1;
Object[] objArr222 = new Object[i];
objArr222[0] = 5;
return objArr222;
}
} catch (MalformedURLException e9) {
malformedURLException = e9;
i = 1;
malformedURLException.printStackTrace();
Helper.reportError(malformedURLException);
Object[] objArr2222 = new Object[i];
objArr2222[0] = 5;
return objArr2222;
}
if (responseCode == 200) {
String convertStreamToString = Utils.convertStreamToString(httpURLConnection.getInputStream());
Log.i("Kate.LoginLogic", "response=" + TokenHider.hideAccessTokenInJson(convertStreamToString));
JSONObject jSONObject3 = new JSONObject(convertStreamToString);
return new Object[]{0, jSONObject3.getString("access_token"), jSONObject3.getString("user_id")};
}
if (responseCode != 500 && responseCode != 401) {
String connectionError2 = getConnectionError(httpURLConnection);
Log.i("Kate.LoginLogic", "error response=" + connectionError2);
Helper.reportError(new Exception("code=" + responseCode + " message=" + connectionError2));
i = 1;
Object[] objArr22222 = new Object[i];
objArr22222[0] = 5;
return objArr22222;
}
String connectionError3 = getConnectionError(httpURLConnection);
if (connectionError3 != null) {
try {
Log.i("Kate.LoginLogic", "error response=" + connectionError3);
try {
jSONObject2 = new JSONObject(connectionError3);
optString2 = jSONObject2.optString("error");
} catch (JSONException e10) {
e = e10;
}
if ("need_captcha".equals(optString2)) {
return new Object[]{2, jSONObject2.optString("captcha_img"), jSONObject2.optString("captcha_sid")};
}
if ("invalid_client".equals(optString2)) {
return new Object[]{1};
}
if ("invalid_request".equals(optString2)) {
try {
objArr = new Object[2];
objArr[0] = 7;
str11 = "error_description";
} catch (IOException e11) {
e = e11;
str11 = "error_description";
} catch (JSONException e12) {
e = e12;
}
try {
objArr[1] = jSONObject2.optString(str11);
return objArr;
} catch (IOException e13) {
e = e13;
iOException = e;
str7 = "redirect_uri";
str12 = "need_validation";
str8 = str11;
iOException.printStackTrace();
connectionError = getConnectionError(httpURLConnection);
if (connectionError != null) {
}
message = iOException.getMessage();
if (message != null) {
}
i = 1;
Object[] objArr222222 = new Object[i];
objArr222222[0] = 5;
return objArr222222;
} catch (JSONException e14) {
e = e14;
JSONException jSONException = e;
jSONException.printStackTrace();
Helper.reportError(jSONException);
Helper.reportError(new Exception(connectionError3));
i = 1;
Object[] objArr2222222 = new Object[i];
objArr2222222[0] = 5;
return objArr2222222;
}
}
str9 = "error_description";
str12 = "need_validation";
try {
} catch (IOException e15) {
e = e15;
str7 = "redirect_uri";
str10 = str9;
iOException = e;
str8 = str10;
iOException.printStackTrace();
connectionError = getConnectionError(httpURLConnection);
if (connectionError != null) {
}
message = iOException.getMessage();
if (message != null) {
}
i = 1;
Object[] objArr22222222 = new Object[i];
objArr22222222[0] = 5;
return objArr22222222;
} catch (JSONException e16) {
e = e16;
}
if (str12.equals(optString2)) {
str = httpURLConnection;
try {
Object[] objArr3 = new Object[2];
objArr3[0] = 6;
try {
objArr3[1] = jSONObject2.optString("redirect_uri");
return objArr3;
} catch (JSONException e17) {
e = e17;
}
} catch (IOException e18) {
e = e18;
str7 = "redirect_uri";
httpURLConnection = str;
str10 = str9;
iOException = e;
str8 = str10;
iOException.printStackTrace();
connectionError = getConnectionError(httpURLConnection);
if (connectionError != null) {
}
message = iOException.getMessage();
if (message != null) {
}
i = 1;
Object[] objArr222222222 = new Object[i];
objArr222222222[0] = 5;
return objArr222222222;
} catch (JSONException e19) {
e = e19;
JSONException jSONException2 = e;
jSONException2.printStackTrace();
Helper.reportError(jSONException2);
Helper.reportError(new Exception(connectionError3));
i = 1;
Object[] objArr2222222222 = new Object[i];
objArr2222222222[0] = 5;
return objArr2222222222;
}
} else {
Helper.reportError(new Exception(connectionError3));
}
JSONException jSONException22 = e;
jSONException22.printStackTrace();
Helper.reportError(jSONException22);
Helper.reportError(new Exception(connectionError3));
} catch (IOException e20) {
e = e20;
}
}
i = 1;
Object[] objArr22222222222 = new Object[i];
objArr22222222222[0] = 5;
return objArr22222222222;
}
}