开发工具
工具名称 | 工具类型 | 说明 |
---|---|---|
AndroidStuduo | 编辑工具 | 开发工具 |
jadx | java工具 | 将apk解成java项目 |
xposed | 插件工具 | 插件 |
tg | 版本 | 9.7.5 |
分析源码的点:
发送图片的点
获取sendMessageParams
获取TLRPC$TL_photo
回调
实现
public void sendImg(String path, String toUserId) throws Exception {
Class AccountInstance = mHookClassLoader.loadClass("org.telegram.messenger.AccountInstance");
Class SendMessageParams = mHookClassLoader.loadClass("org.telegram.messenger.SendMessagesHelper$SendMessageParams");
Object accountInstance = XposedHelpers.callStaticMethod(AccountInstance, "getInstance", 0);
Object sendMessagesHelper = XposedHelpers.callMethod(accountInstance, "getSendMessagesHelper");
Object tLRPC$TL_photo = XposedHelpers.callMethod(sendMessagesHelper, "generatePhotoSizes", path, null);
Map map = Map.of("final", "1", "groupId", "0", "originalPath", path);
Object sendMessageParams = XposedHelpers.callStaticMethod(SendMessageParams, "of", tLRPC$TL_photo, null, 0, null, null, null, null, null, map, true, 0, 0, null, false, false);
XposedHelpers.setLongField(sendMessageParams, "peer", Long.parseLong(toUserId));
XposedHelpers.callMethod(sendMessagesHelper, "sendMessage", sendMessageParams);
}
回调处理
这样那样 再 这样那样 就好了