iMisty的技术栈

iMisty的技术栈

adb 修改手机代理方式

2058
2019-09-11

使用全局命令

设置代理:

adb shell settings put global http_proxy 代理IP地址:端口号

adb shell settings put global https_proxy 代理IP地址:端口号

当然也有获取当前代理的命令:adb shell settings get global http_proxy,如果没有设置代理则输出**null**

如:

adb shell settings put global http_proxy 127.0.0.1:8888

移除代理:

  • adb shell settings delete global http_proxy

  • adb shell settings delete global global_http_proxy_host

  • adb shell settings delete global global_http_proxy_port

  • https_proxy也同上

特别需要注意的是:设置代理立即生效,但是移除代理需要重启设备才生效

使用第三方apk

AndroidProxySetter工具可以帮助我们使用adb命令可以快速进行wifi代理的设置和清除
GitHub地址:

https://github.com/jpkrause/AndroidProxySetter
下好apk后,安装到手机

adb install proxy-setter-debug-0.2.1.apk

设置代理:

adb shell am start -n tk.elevenk.proxysetter/.MainActivity -e host 代理IP地址 -e port 端口号 -e ssid WIFI名称 -e reset-wifi true -e key WIFI密码

如:

adb shell am start -n tk.elevenk.proxysetter/.MainActivity -e host 127.0.0.1 -e port 8888 -e ssid YOUR-WIFI-NAME -e reset-wifi true -e key YOUR-WIFI-PASSWORD