仲天
首页
(current)
分类
Go
Python
自动化脚本
xTS(谷歌认证测试)
Selenium
软件测试
Redis
Mysql
Docker
MongoDB
Jquery
Nginx
Bootstrap
Linux
正则表达式
bat
cmd批处理
截图
作者分享
JSON
SEO
在线工具
搜索
python实现VTS和CTS-ON-GSI自动flash system.img脚本
2022-07-20 14:24:05
351
本文章为原创文章,转载请附上原文地址,谢谢。
```python import os import time import sys import re from colorama import init init(autoreset=True) a = sys.argv[1] try: boot = sys.argv[2] except: boot = " " system = "system.img" def flashGsi(a, boot, sn, s): os.system("adb -s {} reboot bootloader".format(sn)) time.sleep(1) if a == "vts": os.system("fastboot flash boot {}".format(boot)) time.sleep(1) os.system("fastboot -w") else: os.system("fastboot -w") time.sleep(1) os.system("fastboot reboot fastboot") time.sleep(2) os.system("fastboot flash system {}".format(system)) time.sleep(5) os.system("fastboot reboot") print("\n") #output = '*'*int((s/2-37)) + "\033[0;32;40m\t{}:此设备刷GSI成功,正在重启中\033[0m".format(sn) + '*'*int((s/2-37)) print("#####\033[0;32;40m{}:此设备刷GSI成功,正在重启中\033[0m#####".format(sn).center(s, '*')) def getDevicesSn(): SN_list = [] device_info = os.popen('adb devices').read() for line in device_info.splitlines(): if line == 'List of devices attached': continue else: com = re.compile('(.*?)\tde.*?') SN = re.findall(com, line) for i in SN: SN_list.append(i) return SN_list if __name__ == '__main__': width = os.get_terminal_size().columns sn = getDevicesSn() for i in sn: print("\n"+ "#####\033[0;32;40m{}:此设备正在刷GSI,请稍等!\033[0m#####".format(i).center(width, '*')) flashGsi(a, boot, i, width) time.sleep(10) print("\n"+ "#####\033[0;32;40m共{}台手机刷GSI完成!\033[0m#####".format(len(sn)).center(width, '*')) time.sleep(2) if a == 'gsi': print("\n"+ "#####\033[0;31;40m请手动点击Allow USB debugging弹框\033[0m#####".center(width)) time.sleep(75) os.system("python3 setting.py") time.sleep(1) os.system("python3 auto_media_push.py") else: time.sleep(75) os.system("python3 setting.py") ``` ``` 想了解,flash system.img开机后,VTS和CTS-on-GSI手机前期设置的小伙伴们,请关注我。
版权声明:本文为仲天原创文章,转载请附上原文出处链接和本声明。
本文链接:
文章分类
Go
Python
自动化脚本
xTS(谷歌认证测试)
Selenium
软件测试
Redis
Mysql
Docker
MongoDB
Jquery
Nginx
Bootstrap
Linux
正则表达式
bat
cmd批处理
截图
作者分享
JSON
SEO
推荐文章
bootstrap移动端时导航栏从左边滑出/弹出
206
青春之城活力之都是哪个城市,你知道吗?
90
Go实现千位分隔符,也就是每三位用逗号隔开
173
golang批量更新mysql数据
482
2023年网站真的不挣钱了,千万别在个人网站投入太多时间和精力...
271
优选网站
在线JSON工具
在线音频提取
Linux在线大全
PDF转WORD
TCP/IP端口大全