Пример #1
0
def udateWechat(deviceId):
    try:
        device.returnHome(deviceId, infor='回到桌面')
        device.installApkFromPath(deviceId, config.new_wechat, infor='更新微信')
        device.returnHome(deviceId, infor='回到桌面')
        pass
    except BaseException as e:
        print(e)
    finally:
        print('结束')
Пример #2
0
def xpCheck(deviceId, phoneProuct):
    ui = device.getUiAnazaed(deviceId)
    device.returnHome(deviceId, infor='回到桌面')
    if phoneProuct == config.PHONE_COOLPAD:  #酷派
        device.pushFile(deviceId,
                        config.new_xp_coolpad,
                        config.pushFileLocition,
                        infor='推送酷派框架到手机')
        device.installApkFromPath(deviceId,
                                  config.new_xp_coolpad,
                                  infor='安装酷派框架')
    else:
        device.pushFile(deviceId,
                        config.new_xp,
                        config.pushFileLocition,
                        infor='推送框架到手机')
        device.installApkFromPath(deviceId, config.new_xp, infor='安装框架')
    pass
Пример #3
0
def update(deviceId):
    try:
        ui = device.getUiAnazaed(deviceId)
        phone = device.getPhoneProduct(deviceId)
        device.returnHome(deviceId, infor='回到桌面')
        device.mkDir(deviceId, config.pushFileLocition)
        if device.pushFile(deviceId,
                           config.plugins,
                           '/mnt/sdcard/',
                           infor='推送plugins文件夹'):
            print(deviceId + ':推送成功')
        else:
            print(deviceId + ':推送失败')
            # 推送所有需要安装的软件
        device.pushFile(deviceId,
                        config.new_chatproxy,
                        config.pushFileLocition,
                        infor='推送插件到手机')
        device.pushFile(deviceId,
                        config.new_app,
                        config.pushFileLocition,
                        infor='推送app')
        # 推送代码段结束
        device.installApkFromPath(deviceId,
                                  config.new_chatproxy,
                                  infor='安装chatproxy')
        device.installApkFromPath(deviceId, config.new_app, infor='安装app')
        device.returnHome(deviceId, infor='回到桌面')
        setChat(deviceId, phone)
        if ui.waitOpenById('de.robv.android.xposed.installer:id/checkbox',
                           3,
                           1,
                           infor='等待模块界面打开'):
            device.reboot(deviceId, beforeTime=5, infor='5秒后自动重启')
        pass
    except BaseException as e:
        print(e)
    finally:
        print('结束')
Пример #4
0
def startRoot(deviceId, phoneProuct):

    ui = device.getUiAnazaed(deviceId)
    device.returnHome(deviceId, infor='回到桌面')
    device.mkDir(deviceId, config.pushFileLocition)
    if phoneProuct == config.PHONE_XIAOMI_4A:
        print('无需设置')
        return
    flag = False
    if device.checkAppIfInstall(deviceId,
                                'com.kingroot.kinguser',
                                infor='检查kingroot是否存在') == False:
        flag = True
        print('kinroot未安装,进行安装操作')
        if device.installApkFromPath(deviceId,
                                     config.new_kingroot,
                                     infor='安装Kingroot'):
            print('kingroot安装完成')
        else:
            print('kingroot安装失败,尝试再次安装')
    device.killApp(deviceId, 'com.kingroot.kinguser', infor='强制关闭kingroot')
    device.pushFile(deviceId,
                    config.new_kingroot,
                    config.pushFileLocition,
                    infor='推送kINGroot到手机')
    if device.checkAppIfInstall(deviceId,
                                'com.kingroot.kinguser',
                                infor='检查kingroot是否存在') == False:
        flag = True
        print('kinroot未安装,进行第二次安装操作')
        if device.installApkFromPath(deviceId,
                                     config.new_kingroot,
                                     infor='安装Kingroot'):
            print('kingroot安装完成')
        else:
            print(deviceId + ':第二次kingroot安装失败,如有需要,请手动安装或【重启手机】后再次尝试执行此脚本')
            return
    device.startApp(deviceId,
                    'com.kingroot.kinguser/.activitys.SliderMainActivity',
                    infor='打开kingroot',
                    beforeTime=2,
                    endTime=1)
    if flag:
        if phoneProuct == config.PHONE_ZTE_BV0701:  #如果是中兴小鲜
            device.swipe(deviceId,
                         535,
                         1500,
                         535,
                         150,
                         infor='向上滑动',
                         beforeTime=1)
            device.swipe(deviceId,
                         535,
                         1500,
                         535,
                         150,
                         infor='向上滑动',
                         beforeTime=1)
            device.tapXY(deviceId, 561, 1707, infor='点击立即开启', beforeTime=1)
        if phoneProuct == config.PHONE_M571C:  #如果是魅族
            device.swipe(deviceId,
                         577,
                         1780,
                         577,
                         355,
                         150,
                         infor='向上滑动',
                         beforeTime=1)
            device.swipe(deviceId,
                         577,
                         1780,
                         577,
                         355,
                         150,
                         infor='向上滑动',
                         beforeTime=1)
            device.swipe(deviceId,
                         577,
                         1780,
                         577,
                         355,
                         150,
                         infor='向上滑动',
                         beforeTime=1)
            device.tapXY(deviceId, 607, 1686, infor='点击立即开启', beforeTime=1)
        if ui.waitOpenByText('化繁为简', 2, 1, infor='是否出现化繁为简字样?'):
            ui.swipeFromIdToId('com.kingroot.kinguser:id/guide_arrow',
                               'com.kingroot.kinguser:id/guide_title',
                               time=200,
                               infor='向上滑动')
            ui.swipeFromIdToId('com.kingroot.kinguser:id/guide_arrow',
                               'com.kingroot.kinguser:id/guide_title',
                               time=200,
                               infor='向上滑动')
            if ui.waitOpenByText('立即开启', 2, 1, infor='立即开启是否可见') == False:
                return
            ui.tapByText('立即开启', infor='点击立即开启')
    if ui.waitOpenByText('化繁为简', 2, 1, infor='是否出现化繁为简字样?'):
        ui.swipeFromIdToId('com.kingroot.kinguser:id/guide_arrow',
                           'com.kingroot.kinguser:id/guide_title',
                           time=200,
                           infor='向上滑动')
        ui.swipeFromIdToId('com.kingroot.kinguser:id/guide_arrow',
                           'com.kingroot.kinguser:id/guide_title',
                           time=200,
                           infor='向上滑动')
        if ui.waitOpenByText('立即开启', 2, 1, infor='立即开启是否可见') == False:
            return
        ui.tapByText('立即开启', infor='点击立即开启')
    if ui.waitOpenByText('KingRoot', 2, 1, infor='等待【KingRoot】字样可见') == False:
        return
    if ui.waitOpenByText('立即修复', 2, 1, infor='是否出现立即修复'):
        ui.tapByText('立即修复', infor='点击立即修复')
    if ui.waitOpenByText('立即处理', 100, 2, infor='立即处理是否出现') == False:
        print('kingroot主界面打开失败')
    #检查是否有root授权
    if ui.waitOpenById('com.kingroot.kinguser:id/left_button_device',
                       2,
                       1,
                       infor='是否出现菜单按钮'):
        ui.tapById('com.kingroot.kinguser:id/left_button_device',
                   infor='点击菜单按钮')
        if ui.waitOpenByText('已成功获取Root权限', 2, 1,
                             infor='是否出现已成功获取Root权限字样') == False:
            if ui.waitOpenByText('重试', 3, 1, infor='是否出现重试?'):
                raise BaseException('获取ROOT失败,请手动获取后再继续执行。')
            if ui.waitOpenByText('立即修复', 5, 1, infor='是否出现立即修复'):
                ui.tapByText('立即修复', infor='点击立即修复')
                if ui.waitOpenByText('立即处理', 100, 2,
                                     infor='立即处理是否出现') == False:
                    print('权限修复失败,手动处理')
                    return
        ui.tapById('com.kingroot.kinguser:id/left_iv', infor='点击返回')
    #检查root授权结束

    ui.tapById('com.kingroot.kinguser:id/right_iv', 1, infor='点击右上角菜单')
    if phoneProuct == config.PHONE_COOLPAD:
        device.tapXY(deviceId, 558, 228, infor='酷派,使用坐标点击【通用设置】')
    else:
        ui.tapByText('通用设置', infor='点击【通用设置】')
    if ui.ifCheckedById('com.kingroot.kinguser:id/checkbox',
                        infor='检查root授权是否开启'):
        print('root授权已开启')
    else:
        ui.tapById('com.kingroot.kinguser:id/checkbox', 1, infor='打开root授权')
    if ui.ifCheckedById('com.kingroot.kinguser:id/checkbox',
                        2,
                        infor='检查【智能授权】是否开启'):
        print('智能授权已开启')
    else:
        ui.tapById('com.kingroot.kinguser:id/checkbox', 2, infor='开启【智能授权】')
    ui.tapByText('授权弹窗', infor='点击【授权弹窗】')
    ui.tapById('com.kingroot.kinguser:id/radio_button',
               infor='设置授权时间10s',
               beforeTime=2)
    ui.tapById('com.kingroot.kinguser:id/radio_button',
               5,
               infor='设置授权【允许】',
               beforeTime=2)
    ui.tapById('com.kingroot.kinguser:id/left_iv', infor='点击【返回】按钮')
    if ui.waitOpenByText('高级权限管理', 1, 1, infor='等待高级权限管理字样可见') == False:
        ui.tapById('com.kingroot.kinguser:id/left_iv', infor='点击【返回】按钮')
    if ui.waitOpenByText('高级权限管理', 2, 1, infor='等待高级权限管理字样可见') == False:
        return
    ui.tapByText('高级权限管理', infor='点击高级权限管理')
    ui.tapByText('静默安装监控', infor='点击静默安装监控')
    if ui.waitOpenByText('立即开启', infor='检查是否有立即开启字样'):
        return
    ui.tapById('com.kingroot.kinguser:id/right_iv', infor='点击右上角菜单')
    ui.tapByText('停用监控', infor='点击停用监控')
    ui.tapByText('确定', infor='点击确定', beforeTime=2)
    ui.tapById('com.kingroot.kinguser:id/left_iv', infor='点击【返回】按钮')
    device.returnHome(deviceId, infor='回到桌面', beforeTime=1)
Пример #5
0
def installAllPluags(deviceId, phoneProuct):
    ui = device.getUiAnazaed(deviceId)
    device.returnHome(deviceId, infor='回到桌面')
    if device.pushFile(deviceId,
                       config.plugins,
                       '/mnt/sdcard/',
                       infor='推送plugins文件夹'):
        print(deviceId + ':推送成功')
    else:
        print(deviceId+':推送失败')\
    #推送所有需要安装的软件

    device.pushFile(deviceId,
                    config.new_chatproxy,
                    config.pushFileLocition,
                    infor='推送插件到手机')
    device.pushFile(deviceId,
                    config.new_app,
                    config.pushFileLocition,
                    infor='推送APP到手机')
    #推送代码段结束
    device.installApkFromPath(deviceId,
                              config.new_chatproxy,
                              infor='安装chatproxy')

    device.installApkFromPath(deviceId, config.new_app, infor='安装有客到APP')

    print(deviceId + ':安装其他软件')
    for key, value in config.otherKeys:
        print(deviceId + ':正在安装' + key + ":" + value)
        device.pushFile(deviceId, value, config.pushFileLocition)
        device.installApkFromPath(deviceId, value)
    print(deviceId + ':其他软件安装结束')
    if phoneProuct == config.PHONE_M571C:  # 魅族
        device.pushFile(deviceId,
                        config.new_Link2SD,
                        config.pushFileLocition,
                        infor='推送LINK2SD到手机')
        device.pushFile(deviceId,
                        config.new_assisetScreen,
                        config.pushFileLocition,
                        infor='推送亮屏助手到手机')
        device.installApkFromPath(deviceId,
                                  config.new_Link2SD,
                                  infor='安装Link2SD')
        device.installApkFromPath(deviceId,
                                  config.new_assisetScreen,
                                  infor='安装屏幕助手')
    device.pushFile(deviceId,
                    config.new_wechat,
                    config.pushFileLocition,
                    infor='推送微信到手机')
    device.installApkFromPath(deviceId, config.new_wechat, infor='更新微信')
    device.returnHome(deviceId, infor='回到桌面')