Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
evendevil66 committed Aug 11, 2024
0 parents commit f76a957
Show file tree
Hide file tree
Showing 43 changed files with 915 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
45 changes: 45 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
}

android {
namespace 'com.xp.fxckvip'
compileSdk 34

defaultConfig {
applicationId "com.xp.fxckvip"
minSdk 22
targetSdk 34
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildToolsVersion '34.0.0'
}

dependencies {
compileOnly 'de.robv.android.xposed:api:82'
// implementation libs.androidx.core.ktx
// implementation libs.androidx.appcompat
// implementation libs.material
// testImplementation libs.junit
// androidTestImplementation libs.androidx.junit
// androidTestImplementation libs.androidx.espresso.core

}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
24 changes: 24 additions & 0 deletions app/src/androidTest/java/com/xp/fxckvip/ExampleInstrumentedTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.xp.fxckvip

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.xp.fxckvip", appContext.packageName)
}
}
32 changes: 32 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
tools:targetApi="31">
<meta-data
android:name="FxckVip"
android:value="true"/>
<!-- 模块的简介(在框架中显示) -->
<meta-data
android:name="xposeddescription"
android:value="获取部分应用的VIP权限或去除广告(已适配:某茄小说、某猫小说)" />
<!-- 模块最低支持的Api版本 一般填54即可 -->
<meta-data
android:name="xposedminversion"
android:value="54"/>
<!-- 模块作用域 -->
<meta-data
android:name="xposedscope"
android:resource="@array/xposedscope"/>
</application>


</manifest>
1 change: 1 addition & 0 deletions app/src/main/assets/xposed_init
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.xp.fxckvip.MainHook
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
169 changes: 169 additions & 0 deletions app/src/main/java/com/xp/fxckvip/DragonRead.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
package com.xp.fxckvip

import android.widget.Toast
import de.robv.android.xposed.XC_MethodHook
import de.robv.android.xposed.XposedBridge
import de.robv.android.xposed.XposedHelpers


class DragonRead {
fun hook(classLoader: ClassLoader) {
hookCreate(classLoader)
hookAd(classLoader)
hookVip(classLoader)
hookUpdate(classLoader)

}

private fun hookCreate(classLoader: ClassLoader) {
XposedHelpers.findAndHookMethod(
"com.dragon.read.pages.main.MainFragmentActivity",
classLoader,
"onCreate",
android.os.Bundle::class.java,
object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam) {
//调用原方法
super.afterHookedMethod(param)
//获取当前的Activity
val activity = param.thisObject as android.app.Activity
//调用showToast方法
Toast.makeText(activity, "番茄FxckVip模块加载成功!", Toast.LENGTH_SHORT).show()
}
}
)
// XposedHelpers.findAndHookMethod(
// "com.dragon.read.reader.ui.ReaderActivity",
// classLoader,
// "onCreate",
// android.os.Bundle::class.java,
// object : XC_MethodHook() {
// override fun afterHookedMethod(param: MethodHookParam) {
// //调用原方法
// super.afterHookedMethod(param)
// //获取当前的Activity
// val activity = param.thisObject as android.app.Activity
// //调用showToast方法
// Toast.makeText(activity, "FxckVip去广告已启用", Toast.LENGTH_SHORT).show()
// }
// }
// )
}


private fun hookAd(classLoader: ClassLoader) {
try {
classLoader.loadClass("com.dragon.read.component.biz.impl.g.e")
XposedHelpers.findAndHookMethod("com.dragon.read.component.biz.impl.g.e",
classLoader,
"isNoAd",
String::class.java,
object : XC_MethodHook() {
@Throws(Throwable::class)
override fun afterHookedMethod(param: MethodHookParam) {
super.afterHookedMethod(param)
param.result = true
}
})
classLoader.loadClass("com.dragon.read.component.biz.impl.h.e")
XposedHelpers.findAndHookMethod("com.dragon.read.component.biz.impl.h.e",
classLoader,
"isNoAd",
String::class.java,
object : XC_MethodHook() {
@Throws(Throwable::class)
override fun afterHookedMethod(param: MethodHookParam) {
super.afterHookedMethod(param)
param.result = true
}
})
classLoader.loadClass("com.dragon.read.component.biz.impl.i.e")
XposedHelpers.findAndHookMethod("com.dragon.read.component.biz.impl.i.e",
classLoader,
"isNoAd",
String::class.java,
object : XC_MethodHook() {
@Throws(Throwable::class)
override fun afterHookedMethod(param: MethodHookParam) {
super.afterHookedMethod(param)
}
})
XposedHelpers.findAndHookMethod(
"com.dragon.read.component.biz.impl.i.e",
classLoader,
"hasNoAdFollAllScene",
object : XC_MethodHook() {
@Throws(Throwable::class)
override fun afterHookedMethod(param: MethodHookParam) {
super.afterHookedMethod(param)
param.result = true
}
})
} catch (e: Exception) {
XposedBridge.log("com.dragon.read.component.biz.impl.g.e:${e.message}")
}

}

private fun hookVip(classLoader: ClassLoader) {
val vipSubTypeClass = Class.forName("com.dragon.read.rpc.model.VipSubType", false, classLoader)
XposedHelpers.findAndHookConstructor("com.dragon.read.user.model.VipInfoModel",
classLoader,
String::class.java,
String::class.java,
String::class.java,
Boolean::class.java,
Boolean::class.java,
Int::class.java,
Boolean::class.java,
vipSubTypeClass,
object : XC_MethodHook() {
@Throws(Throwable::class)
override fun beforeHookedMethod(param: MethodHookParam) {
val args = param.args
// this.expireTime = str;
// this.isVip = str2;
// this.leftTime = str3;
// this.isAutoCharge = z;
// this.isUnionVip = z2;
// this.unionSource = i2;
// this.isAdVip = z3;
// this.subType = vipSubType;
args[0] = "3743662698"
args[1] = "1"
args[2] = "999999"
args[3] = false
args[4] = true
args[5] = 1
args[6] = true
}

@Throws(Throwable::class)
override fun afterHookedMethod(param: MethodHookParam) {
super.afterHookedMethod(param)
val args = param.args
val expireTime = args[0] as String
val isVip = args[1] as String
val leftTime = args[2] as String
val isAutoCharge = args[3] as Boolean
}
})
}

private fun hookUpdate(classLoader: ClassLoader) {
try {
XposedHelpers.findAndHookMethod(
"com.dragon.read.update.b",
classLoader,
"b",
object : XC_MethodHook() {
@Throws(Throwable::class)
override fun afterHookedMethod(param: MethodHookParam) {
param.result = false
}
})
} catch (e: Throwable) {
XposedBridge.log("Error occurred calling hooker on $e")
}
}
}
37 changes: 37 additions & 0 deletions app/src/main/java/com/xp/fxckvip/MainHook.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.xp.fxckvip

import android.widget.Toast
import de.robv.android.xposed.IXposedHookLoadPackage
import de.robv.android.xposed.XC_MethodHook
import de.robv.android.xposed.XposedBridge
import de.robv.android.xposed.XposedHelpers
import de.robv.android.xposed.callbacks.XC_LoadPackage
class MainHook : IXposedHookLoadPackage {
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
//创建包名列表
val packageList = arrayOf(
"com.dragon.read",
"com.kmxs.reader"
)
//匹配包名 不存在则return
if (!packageList.contains(lpparam.packageName)) return
// 执行Hook
XposedBridge.log("FxckVip模块加载成功!")
hook(lpparam)

}

private fun hook(lpparam: XC_LoadPackage.LoadPackageParam) {
//遍历lpparam的packageName分配给对应的处理类
when (lpparam.packageName) {
"com.dragon.read" -> {
val dragonRead = DragonRead()
dragonRead.hook(lpparam.classLoader)
}
"com.kmxs.reader" -> {
val qimao = Qimao()
qimao.hook(lpparam.classLoader)
}
}
}
}
Loading

0 comments on commit f76a957

Please sign in to comment.