问题描述
我已将 android 手机(三星 Galaxy S8)配置为使用代理.我可以连接到 mitm.it.我还可以看到 Mitmproxy 捕获的一些请求.
I have configured the android Phone (Samsung Galaxy S8) to use proxy. I can connect to mitm.it. I can also see some requests captured by Mitmproxy.
但是,当我尝试在 Google 中搜索任何内容时,我无法连接到互联网.
However, I got no internet connection when I try to search anything in Google.
关于发生了什么以及如何解决它的任何提示?
Any hints on what happened and how to fix it?
推荐答案
Android 7.1 及更高版本 不再允许使用用户手动添加的自定义证书,但如果您的手机具有超级用户访问权限,则可以通过 ADB 使其工作.
Android 7.1 and higher do not longer allow the use of custom certificates manually added by the user but if you have a phone with super user access, you can make it work via ADB.
Android 将其系统证书存储在 /system/etc/security/cacerts/
中.如果您查看您的设备,您将看到证书具有散列名称,例如.a1234b0d.0".要拦截应用流量,您需要找出证书的哈希值
Android stores its system certificates in /system/etc/security/cacerts/
. If you take a look at your device, you will see that the certificates have hashed names, eg. "a1234b0d.0". To intercept app traffic, you need to find out the hash of your certificate
openssl x509 -inform PEM -subject_hash_old -in mitmproxy-ca-cert.pem | head -1
然后相应地重命名您的证书
Then rename your certificate accordingly
mv mitmproxy-ca-cert.pem <your_hash_value_in_here_without_carets>.0
最后将其移动到您设备的系统证书所在的位置.但是,为此,您需要先重新挂载系统目录才能获得写入权限
And finally move it to where your device's system certificates are. For this, however, you need to remount the system directory first in order to get write access
adb shell su -c "mount -o rw,remount,rw /system"
adb push your_certificate /sdcard/your_certificate
adb shell su -c "mv /sdcard/your_certificate /system/etc/security/cacerts/your_certificate"
adb shell su -c "chmod 644 /system/etc/security/cacerts/your_certificate"
adb reboot
如果这不起作用,我可以记住(虽然不是来源)阅读有关 Android Nougat 的文章,但也没有关于过期超过 2 年的证书.mitmproxy 创建的证书应该没问题.但是 Burpsuite 或 Fiddler 对我不起作用.
If that doesn't work, I can remember (not the source, though) reading about Android Nougat also not regarding certificates that expire in more than 2 years. The certificates created by mitmproxy should be fine. Burpsuite or Fiddler ones did not work for me though.
这篇关于使用 Mitmproxy 后,Android 中没有互联网连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!