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
|
# 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.
|
Also allows you to copy or save messages when "Restrict saving content" is enabled.
|
||||||
Forwarding messages is still not working due to server limitation.
|
Forwarding messages is still not working due to server limitation.
|
||||||
|
|
||||||
## Supported clients
|
## Supported clients
|
||||||
- **Official** `org.telegram.messenger`
|
These clients were successfully tested with Killergram enabled.
|
||||||
- **Official** `org.telegram.messenger.web`
|
|
||||||
- **Official** `org.telegram.messenger.beta`
|
| Name | Package | Notes |
|
||||||
- **Nekogram** `tw.nekomimi.nekogram`
|
|:--------------:|:--------------------------------|:-------------|
|
||||||
- **Nekogram X** `nekox.messenger`
|
| Official | `org.telegram.messenger` | |
|
||||||
- **Forkgram** `org.forkclient.messenger`
|
| Official | `org.telegram.messenger.web` | |
|
||||||
- **Forkgram** `org.forkclient.messenger.beta`
|
| Official | `org.telegram.messenger.beta` | |
|
||||||
- **exteraGram** `com.exteragram.messenger`
|
| Nekogram X | `nekox.messenger` | |
|
||||||
- **exteraGram** `com.exteragram.messenger.beta`
|
| Forkgram | `org.forkclient.messenger` | |
|
||||||
- **MDGram** `org.telegram.mdgram`
|
| Forkgram | `org.forkclient.messenger.beta` | |
|
||||||
- **MDGram** `org.telegram.mdgramyou`
|
| exteraGram | `com.exteragram.messenger` | |
|
||||||
- **BGram** `org.telegram.BifToGram`
|
| exteraGram | `com.exteragram.messenger.beta` | |
|
||||||
- **OwlGram** `it.owlgram.android`
|
| MDGram | `org.telegram.mdgram` | Only AdBlock |
|
||||||
- **Catogram** `ua.itaysonlab.messenger`
|
| MDGram | `org.telegram.mdgramyou` | Only AdBlock |
|
||||||
- **Catogram X** `org.nift4.catox`
|
| BGram | `org.telegram.BifToGram` | |
|
||||||
- **Nanogram** `com.cool2645.nekolite`
|
| Catogram | `ua.itaysonlab.messenger` | |
|
||||||
- **Ninjagram** `me.ninjagram.messenger`
|
| Catogram X | `org.nift4.catox` | |
|
||||||
- **Ninjagram** `org.ninjagram.messenger`
|
| Nullgram | `top.qwq2333.nullgram` | |
|
||||||
- **Graph (Telegraph)** `ir.ilmili.telegraph`
|
| Nanogram | `com.cool2645.nekolite` | |
|
||||||
- **Plus Messenger** `org.telegram.plus`
|
| Ninjagram | `me.ninjagram.messenger` | |
|
||||||
- **iMe Messenger** `com.iMe.android`
|
| Ninjagram | `org.ninjagram.messenger` | |
|
||||||
- **aka** `org.aka.messenger`
|
| Graph | `ir.ilmili.telegraph` | |
|
||||||
- **TurboTel Pro** `ellipi.messenger`
|
| 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
|
## License
|
||||||
This project is licensed under the
|
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.IXposedHookLoadPackage;
|
||||||
import de.robv.android.xposed.XC_MethodReplacement;
|
import de.robv.android.xposed.XC_MethodReplacement;
|
||||||
import de.robv.android.xposed.XposedBridge;
|
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
|
||||||
import de.robv.android.xposed.XposedHelpers;
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage;
|
|
||||||
|
|
||||||
public class MainHook implements IXposedHookLoadPackage {
|
public class MainHook implements IXposedHookLoadPackage {
|
||||||
|
|
||||||
public final static List<String> hookPackages = Arrays.asList(
|
public final static List<String> hookPackages = Arrays.asList(
|
||||||
"org.telegram.messenger",
|
"org.telegram.messenger",
|
||||||
"org.telegram.messenger.web",
|
"org.telegram.messenger.web",
|
||||||
"org.telegram.messenger.beta",
|
"org.telegram.messenger.beta",
|
||||||
"tw.nekomimi.nekogram",
|
|
||||||
"nekox.messenger",
|
"nekox.messenger",
|
||||||
"org.forkclient.messenger",
|
"org.forkclient.messenger",
|
||||||
"org.forkclient.messenger.beta",
|
"org.forkclient.messenger.beta",
|
||||||
|
@ -23,9 +21,9 @@ public class MainHook implements IXposedHookLoadPackage {
|
||||||
"org.telegram.mdgram",
|
"org.telegram.mdgram",
|
||||||
"org.telegram.mdgramyou",
|
"org.telegram.mdgramyou",
|
||||||
"org.telegram.BifToGram",
|
"org.telegram.BifToGram",
|
||||||
"it.owlgram.android",
|
|
||||||
"ua.itaysonlab.messenger",
|
"ua.itaysonlab.messenger",
|
||||||
"org.nift4.catox",
|
"org.nift4.catox",
|
||||||
|
"top.qwq2333.nullgram",
|
||||||
"com.cool2645.nekolite",
|
"com.cool2645.nekolite",
|
||||||
"me.ninjagram.messenger",
|
"me.ninjagram.messenger",
|
||||||
"org.ninjagram.messenger",
|
"org.ninjagram.messenger",
|
||||||
|
@ -37,31 +35,31 @@ public class MainHook implements IXposedHookLoadPackage {
|
||||||
);
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) {
|
public void handleLoadPackage(final 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));
|
|
||||||
}
|
|
||||||
|
|
||||||
Class<?> chatUIActivityClass = XposedHelpers.findClassIfExists("org.telegram.ui.ChatActivity", lpparam.classLoader);
|
if (!hookPackages.contains(lpparam.packageName)) return;
|
||||||
if (chatUIActivityClass != null) {
|
|
||||||
XposedBridge.hookAllMethods(chatUIActivityClass, "addSponsoredMessages", XC_MethodReplacement.returnConstant(null));
|
|
||||||
}
|
|
||||||
|
|
||||||
Class<?> SharedConfigClass = XposedHelpers.findClassIfExists("org.telegram.messenger.SharedConfig", lpparam.classLoader);
|
XposedClass messagesController = new XposedClass("org.telegram.messenger.MessagesController", lpparam.classLoader);
|
||||||
if (SharedConfigClass != null) {
|
messagesController.hookAllMethods("getSponsoredMessages", XC_MethodReplacement.returnConstant(null));
|
||||||
XposedBridge.hookAllMethods(SharedConfigClass, "getDevicePerformanceClass", XC_MethodReplacement.returnConstant(2));
|
messagesController.hookAllMethods("isChatNoForwards", XC_MethodReplacement.returnConstant(false));
|
||||||
}
|
|
||||||
|
|
||||||
Class<?> UserConfigClass = XposedHelpers.findClassIfExists("org.telegram.messenger.UserConfig", lpparam.classLoader);
|
XposedClass chatUIActivity = new XposedClass("org.telegram.ui.ChatActivity", lpparam.classLoader);
|
||||||
if (UserConfigClass != null) {
|
chatUIActivity.hookAllMethods("addSponsoredMessages", XC_MethodReplacement.returnConstant(null));
|
||||||
XposedBridge.hookAllMethods(UserConfigClass, "getMaxAccountCount", XC_MethodReplacement.returnConstant(999));
|
|
||||||
XposedBridge.hookAllMethods(UserConfigClass, "hasPremiumOnAccounts", XC_MethodReplacement.returnConstant(true));
|
XposedClass sponsoredMessages = new XposedClass("org.telegram.tgnet.TLRPC$messages_SponsoredMessages", lpparam.classLoader);
|
||||||
}
|
sponsoredMessages.hookAllMethods("TLdeserialize", XC_MethodReplacement.returnConstant(null));
|
||||||
} catch (Throwable ignored) { }
|
|
||||||
}
|
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</item>
|
||||||
<item>org.telegram.messenger.web</item>
|
<item>org.telegram.messenger.web</item>
|
||||||
<item>org.telegram.messenger.beta</item>
|
<item>org.telegram.messenger.beta</item>
|
||||||
<item>tw.nekomimi.nekogram</item>
|
|
||||||
<item>nekox.messenger</item>
|
<item>nekox.messenger</item>
|
||||||
<item>org.forkclient.messenger</item>
|
<item>org.forkclient.messenger</item>
|
||||||
<item>org.forkclient.messenger.beta</item>
|
<item>org.forkclient.messenger.beta</item>
|
||||||
|
@ -13,9 +12,9 @@
|
||||||
<item>org.telegram.mdgram</item>
|
<item>org.telegram.mdgram</item>
|
||||||
<item>org.telegram.mdgramyou</item>
|
<item>org.telegram.mdgramyou</item>
|
||||||
<item>org.telegram.BifToGram</item>
|
<item>org.telegram.BifToGram</item>
|
||||||
<item>it.owlgram.android</item>
|
|
||||||
<item>ua.itaysonlab.messenger</item>
|
<item>ua.itaysonlab.messenger</item>
|
||||||
<item>org.nift4.catox</item>
|
<item>org.nift4.catox</item>
|
||||||
|
<item>top.qwq2333.nullgram</item>
|
||||||
<item>com.cool2645.nekolite</item>
|
<item>com.cool2645.nekolite</item>
|
||||||
<item>me.ninjagram.messenger</item>
|
<item>me.ninjagram.messenger</item>
|
||||||
<item>org.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
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
# 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
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
# Automatically convert third-party libraries to use AndroidX
|
# Automatically convert third-party libraries to use AndroidX
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
|
||||||
appVerName=23.04.12
|
appVerName=23.04.13
|
||||||
appVerCode=202304120
|
appVerCode=202304130
|
||||||
|
|
Loading…
Add table
Reference in a new issue