帝王谷资源网 Design By www.wdxyy.com
在实际测试工作中,经常要将安卓手机通过wifi代理的形式连接到本机的fiddler或charles服务器代理进行抓包测试。最近一直在想,有没有什么方法可以自动设置安卓手机的wifi代理,曾经想通过修改安卓系统配置文件的方式来修改但是没有找到解决方案。最后决定针对自己的手机进行私人订制,缺点是只能针对固定机型进行设置,不过优点是脚本很好编写,可以很快的对自己平时使用的测试机进行定制(非Windows下的脚本编写过程类似)。
利用adb命令编写PowerShell脚本
Windows下编写脚本用到了PowerShell和adb相关命令,脚本内容如下(坐标定位用uiautomatorviewer就可以):
Write-Host "更改设置中……" -ForegroundColor Green #点击Home键返回Home页并进入网络设置页面 adb shell input keyevent 3 adb shell am start -a android.settings.WIRELESS_SETTINGS adb shell input tap 421 570 adb shell input tap 421 570 adb shell input tap 605 1665 #手动设置代理 #删除主机名 adb shell input swipe 972 1687 972 1686 1500 #获取本机ip $ip = (ipconfig|findstr "IPv4"|findstr "10.234").split(":")[1] #修改主机名为本机ip adb shell input text $ip #收起软键盘 adb shell input tap 997 1250 #向上滑动屏幕 adb shell input swipe 813 1626 794 201 1000 #点击端口框 adb shell input tap 955 1461 #删除端口号 adb shell input swipe 986 1388 986 1386 1000 #输入端口号8888 adb shell input tap 547 1688 adb shell input tap 547 1688 adb shell input tap 547 1688 adb shell input tap 547 1688 #点击返回按钮 adb shell input tap 1009 1853 #下一项 adb shell input tap 1009 1853 #完成设置 adb shell input tap 1009 1853 #返回设置界面 adb shell input tap 77 126 #返回Home页 adb shell input keyevent 3 Write-Host "手机wifi代理设置完毕,已与本机相连,请开抓包工具!" -ForegroundColor Green Read-Host
将脚本编译为exe可执行文件
可以进一步将PowerShell脚本转化为可双击执行的exe文件。推荐使用Ps1 To Exe Online Converter这款在线应用上传脚本进行转化后下载。点击解压后的exe文件,运行效果如下:
以上就是自动设置安卓手机wifi代理的PowerShell脚本的详细内容,更多关于自动设置代理power shell脚本的资料请关注其它相关文章!
帝王谷资源网 Design By www.wdxyy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
帝王谷资源网 Design By www.wdxyy.com
暂无评论...
更新日志
2024年10月25日
2024年10月25日
- 群星2013-青春缤纷辑压箱宝大公开3CD2[新加坡限量版][WAV整轨]
- 林育群.2013-BalladShow(日本版)【环球】【WAV+CUE】
- 陈加洛.1992-痛到感觉不到【宝丽金】【WAV+CUE】
- 群星.2023-宿命之敌电视剧原声带【韶愔音乐】【FLAC分轨】
- 東京事変-大発見[FLAC+CUE]
- 椎名林檎-三文ゴシップ[FLAC+CUE]
- 2024年08月04日
- 裘德《裘德「最后的水族馆」演唱会LIVE》[320K/MP3][228.89MB]
- 裘德《裘德「最后的水族馆」演唱会LIVE》[24bit 48kHz][FLAC/分轨][2.08G]
- 基因三重奏《如果你什么都不说 音乐会现场录音》[320K/MP3][145.37MB]
- 孟庭苇.1996-月亮说话(2020环球24KGOLD限量版)【上华】【WAV+CUE】
- 群星.1997-新艺宝优质音响系列·国语精选监听版【新艺宝】【WAV+CUE】
- 阿桑.2005-寂寞在唱歌(星外星引进版)【华研国际】【WAV+CUE】
- 基因三重奏《如果你什么都不说 音乐会现场录音》[FLAC/分轨][287.43MB]
- 蔡题谦《我爱你,却依然要看你走》[320K/MP3][88.65MB]