Compare commits
6 commits
1a5d8e9b7c
...
777c932620
Author | SHA1 | Date | |
---|---|---|---|
777c932620 | |||
e2b186b03a | |||
d7bd65e788 | |||
a0ec8f2cbb | |||
fa8f441d66 | |||
bf95bd7f63 |
6 changed files with 117 additions and 58 deletions
60
README.md
60
README.md
|
@ -1,33 +1,45 @@
|
|||
# Killergram
|
||||
An Android Xposed module to remove sponsored messages of Telegram.
|
||||
Xposed module for removing sponsored messages in Telegram.
|
||||
|
||||
Also allows you to copy or save messages when "Restrict saving content" is enabled.
|
||||
Forwarding messages is still not working due to server limitation.
|
||||
|
||||
## Supported clients
|
||||
- **Official** `org.telegram.messenger`
|
||||
- **Official** `org.telegram.messenger.web`
|
||||
- **Official** `org.telegram.messenger.beta`
|
||||
- **Nekogram** `tw.nekomimi.nekogram`
|
||||
- **Nekogram X** `nekox.messenger`
|
||||
- **Forkgram** `org.forkclient.messenger`
|
||||
- **Forkgram** `org.forkclient.messenger.beta`
|
||||
- **exteraGram** `com.exteragram.messenger`
|
||||
- **exteraGram** `com.exteragram.messenger.beta`
|
||||
- **MDGram** `org.telegram.mdgram`
|
||||
- **MDGram** `org.telegram.mdgramyou`
|
||||
- **BGram** `org.telegram.BifToGram`
|
||||
- **OwlGram** `it.owlgram.android`
|
||||
- **Catogram** `ua.itaysonlab.messenger`
|
||||
- **Catogram X** `org.nift4.catox`
|
||||
- **Nanogram** `com.cool2645.nekolite`
|
||||
- **Ninjagram** `me.ninjagram.messenger`
|
||||
- **Ninjagram** `org.ninjagram.messenger`
|
||||
- **Graph (Telegraph)** `ir.ilmili.telegraph`
|
||||
- **Plus Messenger** `org.telegram.plus`
|
||||
- **iMe Messenger** `com.iMe.android`
|
||||
- **aka** `org.aka.messenger`
|
||||
- **TurboTel Pro** `ellipi.messenger`
|
||||
These clients were successfully tested with Killergram enabled.
|
||||
|
||||
| Name | Package | Notes |
|
||||
|:--------------:|:--------------------------------|:-------------|
|
||||
| Official | `org.telegram.messenger` | |
|
||||
| Official | `org.telegram.messenger.web` | |
|
||||
| Official | `org.telegram.messenger.beta` | |
|
||||
| Nekogram X | `nekox.messenger` | |
|
||||
| Forkgram | `org.forkclient.messenger` | |
|
||||
| Forkgram | `org.forkclient.messenger.beta` | |
|
||||
| exteraGram | `com.exteragram.messenger` | |
|
||||
| exteraGram | `com.exteragram.messenger.beta` | |
|
||||
| MDGram | `org.telegram.mdgram` | Only AdBlock |
|
||||
| MDGram | `org.telegram.mdgramyou` | Only AdBlock |
|
||||
| BGram | `org.telegram.BifToGram` | |
|
||||
| Catogram | `ua.itaysonlab.messenger` | |
|
||||
| Catogram X | `org.nift4.catox` | |
|
||||
| Nullgram | `top.qwq2333.nullgram` | |
|
||||
| Nanogram | `com.cool2645.nekolite` | |
|
||||
| Ninjagram | `me.ninjagram.messenger` | |
|
||||
| Ninjagram | `org.ninjagram.messenger` | |
|
||||
| Graph | `ir.ilmili.telegraph` | |
|
||||
| Plus Messenger | `org.telegram.plus` | |
|
||||
| iMe Messenger | `com.iMe.android` | |
|
||||
| aka | `org.aka.messenger` | |
|
||||
| TurboTel Pro | `ellipi.messenger` | |
|
||||
|
||||
## Unsupported clients
|
||||
These mods have a built-in Xposed protection
|
||||
which is *impossible* to bypass.
|
||||
|
||||
| Name | Package |
|
||||
|:--------:|:-----------------------|
|
||||
| Nekogram | `tw.nekomimi.nekogram` |
|
||||
| OwlGram | `it.owlgram.android` |
|
||||
|
||||
## License
|
||||
This project is licensed under the
|
||||
|
|
|
@ -5,16 +5,14 @@ import java.util.List;
|
|||
|
||||
import de.robv.android.xposed.IXposedHookLoadPackage;
|
||||
import de.robv.android.xposed.XC_MethodReplacement;
|
||||
import de.robv.android.xposed.XposedBridge;
|
||||
import de.robv.android.xposed.XposedHelpers;
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage;
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
|
||||
|
||||
public class MainHook implements IXposedHookLoadPackage {
|
||||
|
||||
public final static List<String> hookPackages = Arrays.asList(
|
||||
"org.telegram.messenger",
|
||||
"org.telegram.messenger.web",
|
||||
"org.telegram.messenger.beta",
|
||||
"tw.nekomimi.nekogram",
|
||||
"nekox.messenger",
|
||||
"org.forkclient.messenger",
|
||||
"org.forkclient.messenger.beta",
|
||||
|
@ -23,9 +21,9 @@ public class MainHook implements IXposedHookLoadPackage {
|
|||
"org.telegram.mdgram",
|
||||
"org.telegram.mdgramyou",
|
||||
"org.telegram.BifToGram",
|
||||
"it.owlgram.android",
|
||||
"ua.itaysonlab.messenger",
|
||||
"org.nift4.catox",
|
||||
"top.qwq2333.nullgram",
|
||||
"com.cool2645.nekolite",
|
||||
"me.ninjagram.messenger",
|
||||
"org.ninjagram.messenger",
|
||||
|
@ -37,31 +35,31 @@ public class MainHook implements IXposedHookLoadPackage {
|
|||
);
|
||||
|
||||
@Override
|
||||
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) {
|
||||
if (hookPackages.contains(lpparam.packageName)) {
|
||||
try {
|
||||
Class<?> messagesControllerClass = XposedHelpers.findClassIfExists("org.telegram.messenger.MessagesController", lpparam.classLoader);
|
||||
if (messagesControllerClass != null) {
|
||||
XposedBridge.hookAllMethods(messagesControllerClass, "getSponsoredMessages", XC_MethodReplacement.returnConstant(null));
|
||||
XposedBridge.hookAllMethods(messagesControllerClass, "isChatNoForwards", XC_MethodReplacement.returnConstant(false));
|
||||
}
|
||||
public void handleLoadPackage(final LoadPackageParam lpparam) {
|
||||
|
||||
Class<?> chatUIActivityClass = XposedHelpers.findClassIfExists("org.telegram.ui.ChatActivity", lpparam.classLoader);
|
||||
if (chatUIActivityClass != null) {
|
||||
XposedBridge.hookAllMethods(chatUIActivityClass, "addSponsoredMessages", XC_MethodReplacement.returnConstant(null));
|
||||
}
|
||||
if (!hookPackages.contains(lpparam.packageName)) return;
|
||||
|
||||
Class<?> SharedConfigClass = XposedHelpers.findClassIfExists("org.telegram.messenger.SharedConfig", lpparam.classLoader);
|
||||
if (SharedConfigClass != null) {
|
||||
XposedBridge.hookAllMethods(SharedConfigClass, "getDevicePerformanceClass", XC_MethodReplacement.returnConstant(2));
|
||||
}
|
||||
XposedClass messagesController = new XposedClass("org.telegram.messenger.MessagesController", lpparam.classLoader);
|
||||
messagesController.hookAllMethods("getSponsoredMessages", XC_MethodReplacement.returnConstant(null));
|
||||
messagesController.hookAllMethods("isChatNoForwards", XC_MethodReplacement.returnConstant(false));
|
||||
|
||||
Class<?> UserConfigClass = XposedHelpers.findClassIfExists("org.telegram.messenger.UserConfig", lpparam.classLoader);
|
||||
if (UserConfigClass != null) {
|
||||
XposedBridge.hookAllMethods(UserConfigClass, "getMaxAccountCount", XC_MethodReplacement.returnConstant(999));
|
||||
XposedBridge.hookAllMethods(UserConfigClass, "hasPremiumOnAccounts", XC_MethodReplacement.returnConstant(true));
|
||||
}
|
||||
} catch (Throwable ignored) { }
|
||||
}
|
||||
XposedClass chatUIActivity = new XposedClass("org.telegram.ui.ChatActivity", lpparam.classLoader);
|
||||
chatUIActivity.hookAllMethods("addSponsoredMessages", XC_MethodReplacement.returnConstant(null));
|
||||
|
||||
XposedClass sponsoredMessages = new XposedClass("org.telegram.tgnet.TLRPC$messages_SponsoredMessages", lpparam.classLoader);
|
||||
sponsoredMessages.hookAllMethods("TLdeserialize", XC_MethodReplacement.returnConstant(null));
|
||||
|
||||
XposedClass getSponsoredMessages = new XposedClass("org.telegram.tgnet.TLRPC$TL_channels_getSponsoredMessages", lpparam.classLoader);
|
||||
getSponsoredMessages.hookAllMethods("a", XC_MethodReplacement.returnConstant(null));
|
||||
|
||||
XposedClass chat = new XposedClass("org.telegram.tgnet.TLRPC$Chat", lpparam.classLoader);
|
||||
chat.hookAllMethods("TLdeserialize", new NoForwardsHook(false));
|
||||
|
||||
XposedClass sharedConfig = new XposedClass("org.telegram.messenger.SharedConfig", lpparam.classLoader);
|
||||
sharedConfig.hookAllMethods("getDevicePerformanceClass", XC_MethodReplacement.returnConstant(2));
|
||||
|
||||
XposedClass userConfig = new XposedClass("org.telegram.messenger.UserConfig", lpparam.classLoader);
|
||||
userConfig.hookAllMethods("getMaxAccountCount", XC_MethodReplacement.returnConstant(999));
|
||||
userConfig.hookAllMethods("hasPremiumOnAccounts", XC_MethodReplacement.returnConstant(true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package com.shatyuka.killergram;
|
||||
|
||||
import de.robv.android.xposed.XC_MethodHook;
|
||||
import de.robv.android.xposed.XposedBridge;
|
||||
import de.robv.android.xposed.XposedHelpers;
|
||||
|
||||
public class NoForwardsHook extends XC_MethodHook {
|
||||
|
||||
boolean forConstructor;
|
||||
|
||||
public NoForwardsHook(boolean forConstructor) {
|
||||
super();
|
||||
this.forConstructor = forConstructor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterHookedMethod(MethodHookParam param) {
|
||||
try {
|
||||
Object obj = this.forConstructor ? param.thisObject : param.getResult();
|
||||
XposedHelpers.setBooleanField(obj, "noforwards", false);
|
||||
}
|
||||
catch (Throwable t) {
|
||||
XposedBridge.log(t);
|
||||
}
|
||||
}
|
||||
}
|
24
app/src/main/java/com/shatyuka/killergram/XposedClass.java
Normal file
24
app/src/main/java/com/shatyuka/killergram/XposedClass.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package com.shatyuka.killergram;
|
||||
|
||||
import de.robv.android.xposed.XC_MethodHook;
|
||||
import de.robv.android.xposed.XposedBridge;
|
||||
import de.robv.android.xposed.XposedHelpers;
|
||||
|
||||
public class XposedClass {
|
||||
|
||||
private final Class<?> aClass;
|
||||
|
||||
public XposedClass(String className, ClassLoader loader) {
|
||||
aClass = XposedHelpers.findClassIfExists(className, loader);
|
||||
}
|
||||
|
||||
public void hookAllMethods(String methodName, XC_MethodHook callback) {
|
||||
try {
|
||||
if (aClass == null) return;
|
||||
XposedBridge.hookAllMethods(aClass, methodName, callback);
|
||||
}
|
||||
catch (Throwable t) {
|
||||
XposedBridge.log(t);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,6 @@
|
|||
<item>org.telegram.messenger</item>
|
||||
<item>org.telegram.messenger.web</item>
|
||||
<item>org.telegram.messenger.beta</item>
|
||||
<item>tw.nekomimi.nekogram</item>
|
||||
<item>nekox.messenger</item>
|
||||
<item>org.forkclient.messenger</item>
|
||||
<item>org.forkclient.messenger.beta</item>
|
||||
|
@ -13,9 +12,9 @@
|
|||
<item>org.telegram.mdgram</item>
|
||||
<item>org.telegram.mdgramyou</item>
|
||||
<item>org.telegram.BifToGram</item>
|
||||
<item>it.owlgram.android</item>
|
||||
<item>ua.itaysonlab.messenger</item>
|
||||
<item>org.nift4.catox</item>
|
||||
<item>top.qwq2333.nullgram</item>
|
||||
<item>com.cool2645.nekolite</item>
|
||||
<item>me.ninjagram.messenger</item>
|
||||
<item>org.ninjagram.messenger</item>
|
||||
|
|
|
@ -12,11 +12,11 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
|||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app"s APK
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
|
||||
appVerName=23.04.12
|
||||
appVerCode=202304120
|
||||
appVerName=23.04.13
|
||||
appVerCode=202304130
|
||||
|
|
Loading…
Add table
Reference in a new issue