Skip to content

Commit

Permalink
new feature
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonLeeeaf committed Jul 16, 2024
1 parent b824665 commit 248cca9
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 27 deletions.
24 changes: 12 additions & 12 deletions .androidide/editor/openedFiles.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
"file": "/storage/emulated/0/MoonLeaf/Projects/FuckMaoNemo/app/src/main/java/io/github/moonleeeaf/fuckmaonemo/Hook.java",
"selection": {
"end": {
"column": 59,
"index": 9189,
"line": 224
"column": 17,
"index": 6820,
"line": 170
},
"start": {
"column": 59,
"index": 9189,
"line": 224
"column": 17,
"index": 6820,
"line": 170
}
}
},
{
"file": "/storage/emulated/0/MoonLeaf/Projects/FuckMaoNemo/app/src/main/res/xml/config.xml",
"selection": {
"end": {
"column": 0,
"index": 0,
"line": 0
"column": 66,
"index": 3096,
"line": 88
},
"start": {
"column": 0,
"index": 0,
"line": 0
"column": 52,
"index": 3082,
"line": 88
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "io.github.moonleeeaf.fuckmaonemo"
minSdk 21
targetSdk 33
versionCode 13000
versionName "1.3.p"
versionCode 14000
versionName "1.4.0"

vectorDrawables {
useSupportLibrary true
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/assets/屏蔽词.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
我操 我‌操
他妈 他‌妈
你妈 你‌妈
妈的 妈‌的
傻逼 傻‌逼
智障 智‌障
傻子 傻‌子
CP C‌P
NM N‌M
TM T‌M
MD M‌D
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.Toast;
import android.widget.Toolbar;
import java.io.FileOutputStream;

public class ConfigActivity extends PreferenceActivity {

Expand All @@ -35,11 +37,19 @@ protected void onCreate(Bundle arg0) {
findPreference("see_miao").setOnPreferenceClickListener((p) -> {
new AlertDialog.Builder(this)
.setTitle("屏蔽词列表")
.setMessage("当期列表:\n" + Hook.MIAO_LIST)
.setMessage("当期列表:\n" + getPreferenceManager().getSharedPreferences().getString("MIAO_LIST_SHARED", "获取失败!"))
.show();

return false;
});

try {
FileOutputStream fos = openFileOutput("fuck_miao.txt", MODE_WORLD_READABLE);
String s = new String(getAssets().open("屏蔽词.txt").readAllBytes());
getPreferenceManager().getSharedPreferences().edit().putString("MIAO_LIST_SHARED", s).apply();
} catch(Exception e) {
Toast.makeText(this, "更新屏蔽词列表失败!" + e, Toast.LENGTH_LONG).show();
}
}

}
135 changes: 124 additions & 11 deletions app/src/main/java/io/github/moonleeeaf/fuckmaonemo/Hook.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.content.res.loader.AssetsProvider;
import android.os.Bundle;
import android.util.Pair;
import android.widget.Toast;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
Expand All @@ -14,7 +17,10 @@
import de.robv.android.xposed.callbacks.XC_LoadPackage;
import java.lang.reflect.Method;
import java.net.Proxy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Hook implements IXposedHookLoadPackage {
Expand All @@ -24,14 +30,24 @@ public class Hook implements IXposedHookLoadPackage {
private int nohengheng;
private int aaaa;

public static final String MIAO_LIST = "妈 马 操 草 傻 艹 牛 逼 P 槽 涩 色 m";
public static final String[] MIAO = MIAO_LIST.split(" ");
public static String MIAO_LIST;
public static String[][] MIAO;

private XC_MethodHook.Unhook force_set_work_myown_unhook;

private static String[][] demo(String[] array, String split) {
ArrayList<String[]> ls = new ArrayList<>();
for (String i : array) {
String[] b = i.split(split);
ls.add(new String[] {b[0], b[1]});
}
return ls.toArray(new String[][]{});
}

@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam param) throws Throwable {
if ("com.codemao.nemo".equals(param.packageName)) {
xsp = new XSharedPreferences("io.github.moonleeeaf.fuckmaonemo", "config");
if ("com.codemao.nemo".equals(param.packageName) || xsp.getBoolean("force_enable", false)) {
XposedBridge.log("[FuckMaoNemo] 开始注入...");
// 感谢 安宁 提供取加固程序的 ClassLoader 的代码
XposedBridge.hookAllMethods(
Expand All @@ -58,11 +74,16 @@ public Application getApplication() throws ClassNotFoundException {
return (Application) XposedHelpers.callStaticMethod(Class.forName("android.app.ActivityThread"), "currentApplication");
}

public static String fuck屏蔽词(String str) {
for (String i : MIAO) {
str = str.replaceAll(i, "‌" + i + "‌");
public static Pair<String, String> fuck屏蔽词(String str) {
String after = str;
String a = "";
for (String[] i : MIAO) {
after = str.replaceAll(i[0], i[1]);
if (!after.equals(str))
a += i[0];
str = after;
}
return str;
return new Pair<>(str, a);
}

public void hook(XC_LoadPackage.LoadPackageParam param) throws Exception {
Expand All @@ -71,9 +92,7 @@ public void hook(XC_LoadPackage.LoadPackageParam param) throws Exception {

nohengheng = 0;
aaaa = 0;

xsp = new XSharedPreferences("io.github.moonleeeaf.fuckmaonemo", "config");


XposedBridge.log("[FuckMaoNemo] 注入中...");

// 拦截40x码
Expand Down Expand Up @@ -111,6 +130,16 @@ protected void beforeHookedMethod(MethodHookParam mP) throws Throwable {
);
});

load("test", () -> {
methodToVoid(
getMethod(
XposedHelpers.findClass("com.codemao.nemo.bean.AuthorInfo", classLoader),
"setFork_user",
boolean.class
)
);
});

// 绕过防沉迷
load("fuck_fcm", () -> {
XposedBridge.log("[FuckMaoNemo] Hook_绕过防沉迷");
Expand All @@ -121,6 +150,82 @@ protected void beforeHookedMethod(MethodHookParam mP) throws Throwable {
));
});

// 修复KN作品播放
load("fix_kn_player", () -> {
XposedBridge.log("[FuckMaoNemo] Hook_修复KN作品播放");
XposedBridge.hookMethod(
getMethod(
XposedHelpers.findClass("com.codemao.nemo.view.X5DWebView", classLoader),
"loadUrl",
String.class
),
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam mp) throws Throwable {
String url = (String) mp.args[0];
if (url != null && url.contains("kn.codemao.cn"))
url = url.substring(0, url.lastIndexOf("?")) + "&is_nemo_player=true";
mp.args[0] = url;
XposedBridge.log("KN作品替换链接:" + url);
}
}
);
XposedBridge.hookMethod(
getMethod(
XposedHelpers.findClass("com.codemao.creativestore.dsbridge.DWebView", classLoader),
"loadUrl",
String.class
),
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam mp) throws Throwable {
String url = (String) mp.args[0];
if (url != null && url.contains("kn.codemao.cn"))
url = url.substring(0, url.lastIndexOf("?")) + "&is_nemo_player=true";
mp.args[0] = url;
XposedBridge.log("KN作品替换链接:" + url);
}
}
);
});

// 作品没有失效
load("work_is_valid", () -> {
XposedBridge.log("[FuckMaoNemo] Hook_作品没有失效");
XposedBridge.hookMethod(getMethod(
XposedHelpers.findClass("com.codemao.nemo.bean.CollectWorkInfo", classLoader),
"getPublish_time",
null
),new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam mp) throws Throwable {
long time = XposedHelpers.getLongField(mp.thisObject, "publish_time");
if (time <= 0)
time = 114514;
return time;
}
});
});

// 岛3我推荐你吗
load("fuck_box3recommend", () -> {
XposedBridge.log("[FuckMaoNemo] Hook_岛3我推荐你吗");

Object mgr = XposedHelpers.findClass("com.giu.xzz.http.RetrofitManager",classLoader).getDeclaredMethod("get", null).invoke(null, null);
Object example = mgr.getClass().getDeclaredMethod("create", new Class[] { Class.class }).invoke(mgr, XposedHelpers.findClass("com.codemao.nemo.retrofit.api.DiscoveryService", classLoader));

XposedBridge.hookAllMethods(
example.getClass(),
"getRecommendBoxData",
new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam mp) throws Throwable {
return XposedHelpers.findClass("io.reactivex.Observable", classLoader).getConstructor(null).newInstance(null);
}
}
);
});

// 强制显示再创作按钮
load("force_show_rework", () -> {
XposedBridge.log("[FuckMaoNemo] Hook_强制显示再创作按钮");
Expand Down Expand Up @@ -234,10 +339,18 @@ protected Object replaceHookedMethod(MethodHookParam hp) throws Throwable {
// 防止屏蔽屏蔽词
load("fuck_miao", () -> {
XposedBridge.log("[FuckMaoNemo] Hook_反屏蔽");

MIAO_LIST = xsp.getString("MIAO_LIST_SHARED", null);

MIAO = demo(MIAO_LIST.split("\n"), " ");

XC_MethodHook hook = new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam mp) throws Throwable {
XposedHelpers.setObjectField(mp.thisObject, "content", fuck屏蔽词((String) XposedHelpers.getObjectField(mp.thisObject, "content")));
Pair<String, String> sb = fuck屏蔽词((String) XposedHelpers.getObjectField(mp.thisObject, "content"));
XposedHelpers.setObjectField(mp.thisObject, "content", sb.first);
if (!"".equals(sb.second))
Toast.makeText(getApplication(), "[FuckMaoNemo] 发送内容已尝试防止屏蔽下列字符词语:" + sb.second, Toast.LENGTH_LONG).show();
}
};
XposedBridge.hookMethod(
Expand Down
28 changes: 27 additions & 1 deletion app/src/main/res/xml/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
<Preference
android:title="作者"
android:summary="编程猫 @满月叶\nGitHub @MoonLeeeaf\n喵呜~" />


<SwitchPreference
android:key="force_enable"
android:title="强制启用"
android:summary="如果你正在使用基于官方 Nemo 修改的客户端,那么可以打开此选项(记得配置模块作用域哦)" />

</PreferenceCategory>

<PreferenceCategory android:title="网络">
Expand Down Expand Up @@ -68,9 +73,30 @@
android:title="谋权篡位"
android:summary="伪装任意作品是你自己的,可以:\n直接编辑作品源码\n其他用途" />

<SwitchPreference
android:key="fuck_box3recommend"
android:title="岛3我推荐你吗"
android:summary="机吧猫砸进里面的玩意实际上还不如去研究如何优化 Nemo 客户端,打开后主页将没有四个岛三作品引流\n提示:还没修好,等我修修,不然你会进不去主页的哦" />

<SwitchPreference
android:key="work_is_valid"
android:title="作品没有失效"
android:summary="让作品的发布时间大于0,可以绕过收藏作品的“失效”状态" />

<SwitchPreference
android:key="fix_kn_player"
android:title="修复 KN 作品无法打开"
android:summary="去你吗的Nemo推广(UA检测),去你妈的 ?is_nemo_player 害得我无法打开,我直接把它机吧割了,QSWL\n本功能仅需要时启用,5.0.0用户请不要启用" />

</PreferenceCategory>

<PreferenceCategory android:title="实验">

<SwitchPreference
android:key="test"
android:title="未命名实验功能"
android:summary="实验" />

<SwitchPreference
android:key="force_show_rework"
android:title="强制显示再创作图标"
Expand Down

0 comments on commit 248cca9

Please sign in to comment.