吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 17826|回复: 25
收起左侧

[Android 原创] FakeLocation高版本悬浮窗上无法使用

[复制链接]
lemniscate 发表于 2019-4-26 14:56
一直用开fakeLocation去打卡,最近出了个某妖精游戏,记得以前有一个悬浮窗可以拨弄的(虽然到现在也不知道怎么用),就想试试,去打打鼓,但是开启后发现悬浮窗会消失,点击有时候还会crash。
Crash log大致是这样的:WindowManager$BadTokenException: Unable to add window -- window android.view.ViewRootImpl$W@363f7b1 has already been added。
查询百度后发现Android高版本对全局窗口做了限制,防止滥用。特别是type为type toast的类型,三点五秒后会消失。 QQ截图20190426141448.png

说个题外话,我查询52发现有另一个版本的叫fake location,是不是原作者的新作就没查证了,我使用的是如上的版本。
通过百度上面的log的关键字,就可以得出要更改type类型为system alert window。(如果有想知道是怎么回事的我这里给出一个文章link:https://www.jianshu.com/p/1445e330114b)


那么根据经验,悬浮窗一般通过addView这个函数进行添加的,那么我们通过ui的跟踪我们可以来到这个类:com.rong.xposed.fakelocation.service.f.FxService
通过搜索addView, QQ截图20190426142412.png ,发现有两个地方调用,那么我来讲一下,刚开始是一个定位的图标,点击后会展开,所以有两个addView 动作。
其中我们可以看到,有一个叫type的东西,高版本中会设为2005(TYPE_PHONE),所以我们现在要将这个值改为system alert window(2003)。
因为想要练手frida,所以那frida测试了一下


import frida, sys,io

def on_message(message, data):
    if message['type'] == 'send':
        print("
  • {0}".format(message['payload']))     else:         print(message) jscode = """ Java.perform(function () {     var fxService = Java.use('com.rong.xposed.fakelocation.service.f.FxService');     var clazz = Java.use('java.lang.Class');     fxService.i.overload().implementation = function(){         send('i empty args')         Java.choose("com.rong.xposed.fakelocation.service.f.FxService", {             onMatch: function(instance) {                 send('fxService instance:'+instance)                 var fxInstance = instance                 var fxClazz = Java.cast(fxInstance.getClass(),clazz)                 console.log(fxClazz)                 var h = fxClazz.getDeclaredField('h')                 h.setAccessible(true)                 var hInstance = h.get(fxInstance)                 var hClazz = Java.cast(hInstance.getClass(),clazz)                 console.log(hClazz)                 var type = hClazz.getDeclaredField('type')                 type.setAccessible(true)                 var typeVal = type.get(hInstance)                 console.log('before:'+typeVal)                 type.setInt(hInstance,2003)                 console.log('after:'+type.get(hInstance))                 instance.i()             },             onComplete: function() { }         });     }     fxService.j.overload().implementation = function(){         send('j empty args')         Java.choose("com.rong.xposed.fakelocation.service.f.FxService", {             onMatch: function(instance) {                 var fxInstance = instance                 var fxClazz = Java.cast(fxInstance.getClass(),clazz)                 console.log(fxClazz)                 var j = fxClazz.getDeclaredField('j')                 j.setAccessible(true)                 var jInstance = j.get(fxInstance)                 var jClazz = Java.cast(jInstance.getClass(),clazz)                 console.log(jClazz)                 var type = jClazz.getDeclaredField('type')                 type.setAccessible(true)                 var typeVal = type.get(jInstance)                 console.log('before:'+typeVal)                 type.setInt(jInstance,2003)                 console.log('after:'+type.get(jInstance))                 instance.j()             },             onComplete: function() { }         });     }     fxService.n.overload().implementation = function(){         send('n')         this.n()     }     fxService.o.overload().implementation = function(){         send('o')         this.o()     } }); """ # process = frida.get_usb_device().attach('com.rong.xposed.fakelocation') # script = process.create_script(jscode) # script.on('message', on_message) # print('
  • Running CTF') # script.load() # sys.stdin.read() device = frida.get_device_manager().enumerate_devices()[-1] pid = device.spawn(["com.rong.xposed.fakelocation"]) session = device.attach(pid) print("
  • Attach Application id:",pid) device.resume(pid) print("
  • Application onResume") script = session.create_script(jscode) script.on('message', on_message) print('
  • Running CTF') script.load() sys.stdin.read()


  • xp版本:
    public class Hook implements IXposedHookLoadPackage {
        @Override
        public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
            if (lpparam.packageName.equals("com.rong.xposed.fakelocation")) {
                final Class<?> fxServiceClass = lpparam.classLoader.loadClass("com.rong.xposed.fakelocation.service.f.FxService");
                XposedHelpers.findAndHookMethod(fxServiceClass, "m", new XC_MethodHook() {
                    @Override
                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                        Field jField = fxServiceClass.getDeclaredField("j");
                        jField.setAccessible(true);
                        WindowManager.LayoutParams jLayoutParam = (WindowManager.LayoutParams) jField.get(param.thisObject);
                        if (jLayoutParam == null) {
                            jLayoutParam = new WindowManager.LayoutParams();
                            jLayoutParam.type = 2003;
                            jLayoutParam.format = 1;
                            jLayoutParam.flags = 8;
                            jLayoutParam.gravity = 8388659;
                            jLayoutParam.width = -2;
                            jLayoutParam.height = -2;
                            jField.set(param.thisObject, jLayoutParam);
                        }
                        super.beforeHookedMethod(param);
                    }
                });
                XposedHelpers.findAndHookMethod(fxServiceClass, "l", new XC_MethodHook() {
                    @Override
                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                        Field hField = fxServiceClass.getDeclaredField("h");
                        hField.setAccessible(true);
                        WindowManager.LayoutParams hLayoutParam = (WindowManager.LayoutParams) hField.get(param.thisObject);
                        if (hLayoutParam == null) {
                            hLayoutParam = new WindowManager.LayoutParams();
                            hLayoutParam.type = 2003;
                            hLayoutParam.format = 1;
                            hLayoutParam.flags = 8;
                            hLayoutParam.gravity = 8388659;
                            hLayoutParam.width = -2;
                            hLayoutParam.height = -2;
                            hField.set(param.thisObject, hLayoutParam);
                        }
                        super.beforeHookedMethod(param);
                    }
                });
            }
        }
    }


    然后悬浮窗就能飘起来拉,当然,小米手机记得先去给软件悬浮窗权限!

    哈哈哈哈,开开心心打开游戏,被检测到了,封了一个小时,(脸上笑嘻嘻)




    免费评分

    参与人数 6威望 +1 吾爱币 +13 热心值 +6 收起 理由
    qtfreet00 + 1 + 9 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
    笙若 + 1 + 1 谢谢@Thanks!
    十分之三 + 1 最后一句才是亮点
    960064995 + 1 + 1 大佬花式捉妖
    神棍黄小坏 + 1 + 1 硬核捉妖
    xztyx + 1 + 1 热心回复!

    查看全部评分

    发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

    sylainy 发表于 2019-4-26 16:38
    还有就是,我今天发的求助帖,有人说在联想的ZUK手机上面有自带的虚拟定位软件,还能摇杆的。。
    比你这个fake的8块钱一个月好用多了。。
    可惜没人有ZUK手机,希望那个有的话,能提取出来
     楼主| lemniscate 发表于 2019-4-29 11:00
    亓颜王语oba 发表于 2019-4-27 14:08
    没root,怎么防止检测

    没root就别用了,搞不定的。除非用vxp可能会好点。扫包名,扫你gps和基站定位是否在同一个地方。你没root很难搞
    xztyx 发表于 2019-4-26 15:07
    dy8587 发表于 2019-4-26 15:15
    官方公告把这个软件列入黑名单了,各位珍惜账号
    sylainy 发表于 2019-4-26 16:37
    可以防封。。。用VXP,一直在用,稳如狗
     楼主| lemniscate 发表于 2019-4-26 17:00
    sylainy 发表于 2019-4-26 16:37
    可以防封。。。用VXP,一直在用,稳如狗

    高版本也好用么,你android几
    sylainy 发表于 2019-4-26 17:15
    lemniscate 发表于 2019-4-26 17:00
    高版本也好用么,你android几

    不用高版本,用低版本,飞行模式的时候开fake,然后就不会提示升级了
    我VIVO QIOO,安卓9.0
    灵影 发表于 2019-4-26 19:23
    不明所以,高手就是高手,你玩的什么游戏
    泪痕123 发表于 2019-4-26 20:25
    这框架不是早不更新了吗?而且地图偏移伤不起,悬浮窗倒是没效果,原来是这样
     楼主| lemniscate 发表于 2019-4-27 00:52
    泪痕123 发表于 2019-4-26 20:25
    这框架不是早不更新了吗?而且地图偏移伤不起,悬浮窗倒是没效果,原来是这样

    对 你们现在用什么虚拟
    您需要登录后才可以回帖 登录 | 注册[Register]

    本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

    快速回复 收藏帖子 返回列表 搜索

    RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

    GMT+8, 2024-4-25 16:49

    Powered by Discuz!

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表