From 56ffb9ce9c43dfc97e735341632a848c66c760d3 Mon Sep 17 00:00:00 2001
From: fengyuecanzhu <1021300691@qq.com>
Date: Mon, 23 May 2022 18:46:18 +0800
Subject: [PATCH] change makeAuth
---
.gitignore | 1 +
.idea/gradle.xml | 1 +
.idea/modules.xml | 4 +
.../fycz/myreader/model/user/UserService.kt | 3 +-
build.gradle | 4 +
.../main/java/xyz/fycz/dynamic/AppLoadImpl.kt | 6 +-
.../java/xyz/fycz/dynamic/fix/App245Fix.kt | 81 +++++++++++++++++++
settings.gradle | 1 +
8 files changed, 96 insertions(+), 5 deletions(-)
create mode 100644 dynamic/src/main/java/xyz/fycz/dynamic/fix/App245Fix.kt
diff --git a/.gitignore b/.gitignore
index ba63cba..1d39116 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@
.DS_Store
/build
/captures
+/user
.externalNativeBuild
keystore
# Compiled class file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 2818960..d16e683 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -14,6 +14,7 @@
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 8bd560e..a847a9a 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -15,6 +15,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/xyz/fycz/myreader/model/user/UserService.kt b/app/src/main/java/xyz/fycz/myreader/model/user/UserService.kt
index b4a5baf..7aceaf4 100644
--- a/app/src/main/java/xyz/fycz/myreader/model/user/UserService.kt
+++ b/app/src/main/java/xyz/fycz/myreader/model/user/UserService.kt
@@ -266,6 +266,7 @@ object UserService {
App.getApplication().packageName,
AppInfoUtils.SHA1
) + "&appVersion=" + App.getVersionCode() +
- "&deviceId=" + getUUID() + "&isDebug=" + App.isDebug()
+ "&isDebug=" + App.isDebug() +
+ "&deviceId=" + getUUID()
}
}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index e372b7b..c0a5b9e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -34,6 +34,10 @@ buildscript {
classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
+
+ classpath 'com.github.megatronking.stringfog:gradle-plugin:3.0.0'
+ // 选用加解密算法库,默认实现了xor算法,也可以使用自己的加解密库。
+ classpath 'com.github.megatronking.stringfog:xor:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
diff --git a/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt b/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt
index b3d299c..69f485a 100644
--- a/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt
+++ b/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt
@@ -26,10 +26,7 @@ import com.kongzue.dialogx.dialogs.BottomDialog
import me.fycz.maple.MapleBridge
import me.fycz.maple.MapleUtils
import me.fycz.maple.MethodHook
-import xyz.fycz.dynamic.fix.App243Fix
-import xyz.fycz.dynamic.fix.App244Fix
-import xyz.fycz.dynamic.fix.App244Fix2
-import xyz.fycz.dynamic.fix.AppFix
+import xyz.fycz.dynamic.fix.*
import xyz.fycz.myreader.application.App
import xyz.fycz.myreader.ui.activity.MainActivity
@@ -49,6 +46,7 @@ class AppLoadImpl : IAppLoader {
App243Fix::class.java,
App244Fix::class.java,
App244Fix2::class.java,
+ App245Fix::class.java,
)
override fun onLoad(appParam: AppParam) {
diff --git a/dynamic/src/main/java/xyz/fycz/dynamic/fix/App245Fix.kt b/dynamic/src/main/java/xyz/fycz/dynamic/fix/App245Fix.kt
new file mode 100644
index 0000000..16b986f
--- /dev/null
+++ b/dynamic/src/main/java/xyz/fycz/dynamic/fix/App245Fix.kt
@@ -0,0 +1,81 @@
+/*
+ * This file is part of FYReader.
+ * FYReader is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * FYReader is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FYReader. If not, see .
+ *
+ * Copyright (C) 2020 - 2022 fengyuecanzhu
+ */
+
+package xyz.fycz.dynamic.fix
+
+import me.fycz.maple.MapleBridge
+import me.fycz.maple.MapleUtils
+import me.fycz.maple.MethodReplacement
+import xyz.fycz.myreader.application.App
+import xyz.fycz.myreader.model.user.UserService
+import xyz.fycz.myreader.util.AppInfoUtils
+import xyz.fycz.myreader.util.utils.EncoderUtils
+
+/**
+ * @author fengyue
+ * @date 2022/5/23 18:20
+ */
+@AppFix([243, 244, 245], ["修改用户服务验证机制(beta)"], "2022-05-23")
+class App245Fix : AppFixHandle {
+
+ override fun onFix(key: String): BooleanArray {
+ val result = try {
+ fixMakeAuth()
+ true
+ } catch (e: Exception) {
+ MapleUtils.log(e)
+ false
+ }
+ fixResult(key, "makeAuth", result)
+ return booleanArrayOf(result)
+ }
+
+ private fun fixMakeAuth() {
+ MapleUtils.findAndHookMethod(
+ UserService::class.java,
+ "makeAuth",
+ object : MethodReplacement() {
+ override fun replaceHookedMethod(param: MapleBridge.MethodHookParam): Any {
+ return makeAuth()
+ }
+ }
+ )
+ }
+
+ fun makeAuth(): String {
+ var auth = "signal=" + AppInfoUtils.getSingInfo(
+ App.getmContext(),
+ App.getApplication().packageName,
+ AppInfoUtils.SHA1
+ ) + "&appVersion=" + App.getVersionCode()
+ auth = try {
+ EncoderUtils.encryptAES2Base64(
+ auth.toByteArray(), DO_FILTER_KEY,
+ "AES/ECB/PKCS5Padding"
+ )?.let { String(it) }.toString()
+ } catch (e: Exception) {
+ ""
+ }
+ return "&auth=$auth" +
+ "&deviceId=" + UserService.getUUID() +
+ "&isDebug=" + App.isDebug()
+ }
+
+ val DO_FILTER_KEY = "79qdunN8534y44T3".toByteArray()
+
+}
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 896738c..7c5b224 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -19,3 +19,4 @@
include ':app'
include ':DialogX'
include ':dynamic'
+include ':user'