def reinstalls(deviceId): logout(deviceId) #登陆 ui = device.getUiAnazaed(deviceId) phoneProduct = device.getPhoneProduct(deviceId) login(deviceId, phoneProduct)
def getQR(deviceId): device.mkPath(deviceId, 'd:\\QR\\') phone = device.getPhoneProduct(deviceId) if phone == config.PHONE_XIAOMI_4A or phone == config.PHONE_RED_3 or phone == config.PHONE_RED_3S: device.export(deviceId, '/mnt/sdcard/DCIM/Screenshots/', 'd:\\QR\\') else: device.export(deviceId, '/mnt/sdcard/pictures/Screenshots/', 'd:\\QR\\')
def test(deviceId): try: ui = device.getUiAnazaed(deviceId) phoneProduct = device.getPhoneProduct(deviceId) finMath(deviceId, phoneProduct) except BaseException as e: print(e) finally: print('结束')
def _makeGroupMethod(deviceId, realGroupName, ms1, ms2, qrname): #获取建群信息 phone = device.getPhoneProduct(deviceId) device.startApp(deviceId, 'com.tencent.mm/com.tencent.mm.ui.LauncherUI', infor='打开微信', endTime=2) ui = device.getUiAnazaed(deviceId) if not ui.waitOpenById('com.tencent.mm:id/gd', 20, 1, infor='等待【+】出现'): raise BaseException(deviceId + '未出现微信主界面') ui.tapById('com.tencent.mm:id/gd', 1, infor='点击【+】') ui.tapByText('发起群聊', infor='点击【发起群聊】') if not ui.waitOpenByIDAndText( 'android:id/text1', '发起群聊', 40, 1, infor='等待【发起群聊界面出现】'): raise BaseException(deviceId + '未出现发起群聊界面') ui.tapById('com.tencent.mm:id/arx', 1, infor='点击【搜索】框') device.inputTextForChinese(deviceId, ms1, infor='输入小号1') device.tapXY(deviceId, 400, 574, infor='点击小号1', beforeTime=2) device.inputTextForChinese(deviceId, ms2, infor='输入小号2') device.tapXY(deviceId, 400, 574, infor='点击小号2', beforeTime=2) ui.tapById('com.tencent.mm:id/hh', 1, infor='点击【确定】') if not ui.waitOpenByText('群聊', 35, 2, infor='等待【群聊建立成功'): raise BaseException(deviceId + '群聊建立失败') ui.tapById('com.tencent.mm:id/hi', 1, infor='点击【小人】') if not ui.waitOpenByText('聊天信息', 30, 1, infor='等待【聊天信息界面】开启'): raise BaseException(deviceId + '聊天信息界面开启失败') ui.tapByText('群聊名称', infor='点击【群聊名称】') if not ui.waitOpenByText('群名片', 30, 1, infor='等待【群名片】打开'): raise BaseException(deviceId + '群名片界面开启失败') ui.tapById('com.tencent.mm:id/cbt', 1, infor='点击输入框') device.inputTextForChinese(deviceId, realGroupName, infor='输入群名') ui.tapByText('保存', infor='点击【保存】') if not ui.waitOpenByText('聊天信息', 30, 1, infor='等待【聊天信息界面】开启'): raise BaseException(deviceId + '聊天信息界面开启失败') ui.tapByText('群二维码', infor='点击【群二维码】') if not ui.waitOpenByText('该二维码7天内', 50, 2, infor='等待二维码出现'): raise BaseException(deviceId + '二维码生成失败') device.getScreenpicture(deviceId, 'd:\\temp\\', qrname, infor='二维码截屏成功') device.tapReturn(deviceId, beforeTime=1) device.swipe(deviceId, 588, 1644, 590, 329, 500, infor='向下滑动', beforeTime=1) ui.tapById('com.tencent.mm:id/gt', 2, infor='点击置顶聊天') ui.tapById('com.tencent.mm:id/gt', 3, infor='点击保存到通讯录') device.tapReturn(deviceId, beforeTime=1) device.tapReturn(deviceId, beforeTime=1) device.tapReturn(deviceId, beforeTime=1) device.returnHome(deviceId, infor='回到桌面', beforeTime=1) pass
def installNewSofter(deviceId): ui = device.getUiAnazaed(deviceId) phoneProduct = device.getPhoneProduct(deviceId) startRoot(deviceId, phoneProduct) installAllPluags(deviceId, phoneProduct) xpCheck(deviceId, phoneProduct) device.startApp( deviceId, 'de.robv.android.xposed.installer/de.robv.android.xposed.installer.WelcomeActivity', infor='打开xp框架') if ui.waitOpenByPackage('de.robv.android.xposed.installer', 3, 1, infor='等待xp管理器打开') == False: print('xp管理器打开失败') if ui.waitOpenByPackage('de.robv.android.xposed.installer', 3, 1, infor='等待xp管理器打开') == False: print('xp管理器打开失败') return if phoneProduct == config.PHONE_COOLPAD: # 酷派特殊处理 if ui.waitOpenByText('最新版本的 Xposed 当前未激活', 3, 1, infor='xp框架是否安装'): ui.tapById('android:id/text2', 1, infor='点击框架') if ui.waitOpenByText('小心!', 2, 1, infor='是否出现小心提示框?'): ui.tapByText('不要再显示这个', infor='点击不要再显示这个') ui.tapByText('确定', infor='点击确定') ui.tapById('de.robv.android.xposed.installer:id/btnInstall', infor='点击安装/更新') if ui.waitOpenByPackage('com.kingroot.kinguser', 3, 1, infor='等待授权窗口打开'): ui.tapByClass('android.widget.Button', 2, infor='点击允许') if ui.waitOpenByText('您现在要重启吗', 3, 1, infor='是否出现重启提示框'): ui.tapByText('确定', infor='点击确定') return if ui.waitOpenByText('小心!', 3, 1, infor='提示框是否存在?'): ui.tapById('de.robv.android.xposed.installer:id/md_promptCheckbox', infor='点击不再显示这个') ui.tapById( 'de.robv.android.xposed.installer:id/md_buttonDefaultPositive', infor='点击确定') if ui.waitOpenByText('已激活', 2, 1, infor='是否安装xp框架'): print("已安装XP框架") return if ui.waitOpenByText('Version 89', 5, 2, infor='89版是否可见?') == False: print('网络可能存在问题,请手动安装') return ui.tapByText('Version 89', infor='安装89框架') ui.tapByText('Install', infor='点击刷入')
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('结束')
def band_phone(deviceId): ui = device.getUiAnazaed(deviceId) device.startApp( deviceId, "com.ykt.app.master/com.youkedao.app.master.activity.IndexActivity", infor='打开app') ui.waitOpenByText("有客团", 50, 1, infor="等待有客团打开") ui.tapByText("配置", infor='点击配置') if not ui.waitOpenByText("已暂停", 2, 1): ui.tapByText("暂停任务引擎", infor='点击暂停任务引擎') ui.tapByText("确认", infor="点击确认") device.killApp(deviceId, "com.tencent.mm", infor='关闭微信') device.startApp(deviceId, 'com.tencent.mm/com.tencent.mm.ui.LauncherUI', infor='打开微信', endTime=2) if not ui.waitOpenByText("微信", 50, 1, infor='等待微信打开'): raise BaseException("微信打开失败") ui.tapById("com.tencent.mm:id/b0w", 4, infor='点击我') if not ui.waitOpenByText("设置", 3, 1, infor="等待设置打开"): ui.tapById("com.tencent.mm:id/cw2", 4, infor="点击我") wechatid = ui.getText("微信号:", infor='获取微信号') wechatid = wechatid.split(":")[1] count = 1 phone_n = None while True: rsponse = requests.get("http://www.junx.ink/get_phone.html") resault = json.loads(rsponse.text) if not resault["state"] == "success": count += 1 time.sleep(5) if count >= 100: raise BaseException("得到手机号超时") print("%s:等待获取手机号中。。" % deviceId) continue phone_n = resault["phone"] # 输入验证码 break if wechatid: #写日志 rsponse = requests.get( "http://www.junx.ink/add_log.html?foot_name=绑定手机号&log_infor=【%s】%s" % (wechatid, phone_n)) json.loads(rsponse.text) else: #写日志 rsponse = requests.get( "http://www.junx.ink/add_log.html?foot_name=绑定手机号&log_infor=【%s】%s" % ("未知", phone_n)) json.loads(rsponse.text) ui.tapByText("设置", infor="点击设置", endTime=1) ui.tapByText("帐号与安全", infor="点击账号与安全", beforeTime=1) ui.tapByText("手机号", infor="点击手机号", beforeTime=1) ui.tapByText("绑定手机号", 2, infor="点击绑定手机号", beforeTime=1) ui.tapByText("中国", infor="点击中国", beforeTime=1) ui.tapById("com.tencent.mm:id/bc", infor="点击搜索", beforeTime=1) ui.tapById("com.tencent.mm:id/bq", infor="点击搜索", beforeTime=1) phone = device.getPhoneProduct(deviceId) device.inputText(deviceId, "95", phone, infor="输入95", beforeTime=1) ui.tapByText("缅甸", infor='点击缅甸', beforeTime=1) ui.tapByText("你本人的手机号", infor='点击输入框', beforeTime=1) device.inputText(deviceId, phone_n, phone, infor='输入手机号', beforeTime=1) #device-之前的ui解析方式,停用.inputText(deviceId,"09763388078",phone,infor='输入手机号',beforeTime=1) ui.tapByText("下一步", infor='点击下一步', beforeTime=1) ui.tapByText("确定", infor='点击确定', beforeTime=2) while True: ui.waitOpenByText("填写验证码", re=120, times=3, infor='等待输入框') ui.tapById("com.tencent.mm:id/xa", infor='点击输入框') count = 1 while True: rsponse = requests.get( "http://www.junx.ink/get_check_code.html?phone=%s" % phone_n) resault = json.loads(rsponse.text) if not resault["state"] == "success": count += 1 time.sleep(5) if count >= 100: raise BaseException("输入验证码超时") print("%s:等待【%s】获取验证码中。。" % (deviceId, phone_n)) continue code = resault["code"] #输入验证码 device.inputText(deviceId, str(code), phone, infor='输入验证码') break ui.tapByText("下一步", infor='点击下一步') if ui.waitOpenByText("确定", 3, 1, infor="验证码是否错误?"): ui.tapByText("确定", infor="点击确定") device.tapDel(deviceId) device.tapDel(deviceId) device.tapDel(deviceId) device.tapDel(deviceId) device.tapDel(deviceId) requests.get( "http://www.junx.ink/set_check_able.html?phone=%s&able=2" % phone_n) json.loads(rsponse.text) else: requests.get( "http://www.junx.ink/set_check_able.html?phone=%s&able=1" % phone_n) json.loads(rsponse.text) break if ui.waitOpenByText("完成", 5, 2, infor="等待完成"): device.returnHome(deviceId, beforeTime=2, infor="回到桌面") device.startApp( deviceId, "com.ykt.app.master/com.youkedao.app.master.activity.IndexActivity", infor='打开app') ui.waitOpenByText("有客团", 50, 1, infor="等待有客团打开") ui.tapByText("配置", infor='点击配置') if ui.waitOpenByText("已暂停", 2, 1): ui.tapByText("恢复任务引擎", infor='点击恢复任务引擎') ui.tapByText("确认", infor="点击确认")
def star(deviceId): ui = device.getUiAnazaed(deviceId) phoneProduct = device.getPhoneProduct(deviceId) setChat(deviceId, phoneProduct) login(deviceId, phoneProduct)