如何在 Android 上连接到代理?
我有一台三星 Galaxy S,运行 Android 2.2 我想使用 Charles(我的计算机上安装的代理)跟踪所有 HTTP 请求(来自浏览器和应用程序)。
我希望它类似于 iPhone 上的设置、wifi,然后在正确的连接上选择 HTTP 代理设置
I have a Samsung Galaxy S, running on Android 2.2
I want to track all HTTP requests (from both browsers AND apps) with Charles (proxy installed on my computer).
I would like it similar to how it is on the iPhone where you go to settings, wifi, and on the right connection you can select the HTTP proxy settings
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可以使用 Wireshark 来完成此操作:http://www.wireshark.org/download.html
此处适用于 Mac + Android 设备的说明:
启动终端并运行以下命令:
使用以太网电缆连接到互联网
单击屏幕右上角的 Airport/Wi-Fi 图标,然后选择创建网络;记住您为该网络指定的名称
转至“系统偏好设置”,打开“共享”窗格,突出显示(但不选中)“互联网共享”
选择“共享连接”:以太网,至使用的计算机:检查 AirPort/Wi-Fi
单击“AirPort/Wi-Fi”选项,然后输入您在上面选择的网络名称(它应该会自动显示,因此只需单击“确定”)
检查“Internet 共享”框
单击“开始”
将您的 Android 设备连接到您刚刚创建的网络
启动 Wireshark
从菜单中选择“捕获”->“网络共享”接口。单击 en1 旁边的“选项”(或显示 Wi-Fi 图标的选项)
单击“捕获过滤器:”按钮
如果需要,请选择其中一个过滤器,例如 HTTP TCP 端口 (80),然后单击“确定”
单击“开始”
You can do it with Wireshark: http://www.wireshark.org/download.html
Here are instructions for Mac + Android device:
Launch Terminal and run the following commands:
Connect to the internet using an Ethernet cable
Click on the Airport/Wi-Fi icon at the top right of the screen and select Create Network; remember the name you give this network
Go to System Preferences, open the Sharing pane, highlight (but don’t check) Internet Sharing
Select Share connection from: Ethernet, To computers using: check AirPort/Wi-Fi
Click AirPort/Wi-Fi Options, and enter the network name you chose above (it should be displayed automatically, so just click OK)
Check the Internet Sharing box
Click Start
Connect your Android device to the network you just created
Launch Wireshark
From the menu, select Capture -> Interfaces. Click on Options next to en1 (or whichever one shows a Wi-Fi icon)
Click the Capture Filter: button
If you want, choose one of the filters, such as HTTP TCP Port (80) and click OK
Click Start
目前 Android 中没有开箱即用的代理。 本页讨论了几种替代方案。还可以在谷歌上搜索“Android 代理”,看看还有哪些其他替代方案。
There is currently no out-of-the box proxy in Android. Several alternatives are discussed in this page. Also google for "Android proxy" to see what other alternatives are out there.
ProxySelector
ProxySelector
此处列出了在 Android 中部分支持代理的一些替代方案:http://issue1273.blogspot.com。还有一个 Android 代理库,它尝试抽象每个 Android 版本对代理设置的访问。
Some alternatives to have partial support of proxy in Android are listed here: http://issue1273.blogspot.com. There is also an Android Proxy Library that try to abstract the access to proxy settings for every Android version.
可以在此处找到有关使用 Android 设置 Charles 的过程的非常好的文章,包括安装证书,以便您还可以调试/代理 SSL 流量:
http://jaanus.com/post/17476995356/debugging-http-on-an-android-phone-or -平板电脑-带有
A very nice write up on the procedure for setting up Charles with Android can be found here, including installing the certificate so you can also debug / proxy your SSL traffic:
http://jaanus.com/post/17476995356/debugging-http-on-an-android-phone-or-tablet-with
自 Android Studio 3.0 发布开始,android 现在支持设置原生代理。
请参阅文档。
Since Android Studio 3.0 release, android now support setting proxy natively.
See documentation.