简体   繁体   English

Android : 使用非 root 的 android 设备捕获 HTTP 请求

[英]Android : Capturing HTTP Requests with non-rooted android device

I have an android application which uses a third party jar in it.我有一个使用第三方 jar 的 android 应用程序。 Http request is sent from third party jar to server when application is running.应用程序运行时,从第三方 jar 向服务器发送 Http 请求。 I need to capture HTTP Request that is sent from third party jar.我需要捕获从第三方 jar 发送的 HTTP 请求。 I am wondering if there is an easy way to implement with non-rooted device我想知道是否有一种简单的方法可以使用非根设备实现

To start up : I tried downloading "proxyDroid" but it need rooted phone I have also tried downloading "shark for root" with "shark reader" which also need rooted device I tried many other applications which could capture the complete request but all it need is rooted device启动:我尝试下载“proxyDroid”,但它需要 root 手机我也尝试使用“shark reader”下载“shark for root”,这也需要 root 设备是根设备

I need something what fiddler/wireshark can do for windows.我需要 fiddler/wireshark 可以为 Windows 做的事情。 A network packet analyzer which could be easily integrated with android application that could give request object with all header fields in it.一个网络数据包分析器,可以很容易地与 android 应用程序集成,它可以提供包含所有头字段的请求对象。

You could install Charles - an HTTP proxy / HTTP monitor / Reverse Proxy that enables a developer to view all of the HTTP and SSL / HTTPS traffic between their machine and the Internet - on your PC or MAC.您可以在您的 PC 或 MAC 上安装Charles——一个 HTTP 代理/HTTP 监视器/反向代理,使开发人员能够查看他们的机器和 Internet 之间的所有 HTTP 和 SSL/HTTPS 流量。

Config steps:配置步骤:

  • Let your phone and PC or MAC in a same LAN让您的手机和 PC 或 MAC 在同一个局域网
  • Launch Charles which you installed (default proxy port is 8888)启动您安装的 Charles(默认代理端口为 8888)
  • Setup your phone's wifi configuration: set the ip of delegate to your PC or MAC's ip, port of delegate to 8888设置手机的wifi配置:将delegate的ip设置为您的PC或MAC的ip,delegate的端口设置为8888
  • Lauch your app in your phone.在手机中启动您的应用程序。 And monitor http requests on Charles.并监控 Charles 上的 http 请求。

There are many ways to do that but one of them is fiddler有很多方法可以做到这一点,但其中之一是提琴手

Fiddler Configuration提琴手配置

  1. Go to options转到选项
  2. In HTTPS tab, enable Capture HTTPS Connects and Decrypt HTTPS trafficHTTPS选项卡中,启用捕获 HTTPS 连接解密 HTTPS 流量
  3. In Connections tab, enable Allow remote computers to connect连接选项卡中,启用允许远程计算机连接
  4. Restart fiddler重启提琴手

Android Configuration安卓配置

  1. Connect to same network连接到同一个网络
  2. Modify network settings修改网络设置
  3. Add proxy for connection with your PC's IP address ( or hostname ) and default fiddler's port ( 8888 / you can change that in settings )添加代理以连接您的 PC 的 IP 地址(或主机名)和默认提琴手的端口(8888/您可以在设置中更改)

Now you can see the full log from your device in fiddler现在您可以在 fiddler 中查看您设备的完整日志

Also, you can find a full instructions here此外,您可以在此处找到完整说明

I just installed Drony.我刚刚安装了 Drony。 It's not shareware and does not require root on a phone with Android 3.x or above.它不是共享软件,并且在 Android 3.x 或更高版本的手机上不需要 root。

https://play.google.com/store/apps/details?id=org.sandrob.drony https://play.google.com/store/apps/details?id=org.sandrob.drony

It can intercept and log requests.它可以拦截和记录请求。

It's 2020 now, for the latest solution, you can use Burp Suite to sniffing https traffic without rooting your Android device.现在是 2020 年,对于最新的解决方案,您可以使用 Burp Suite 来嗅探 https 流量,而无需对您的 Android 设备进行 root。

Steps:脚步:

  1. Install Burp Suite安装 Burp 套件

  2. Enable Proxy启用代理

  3. Import the certification in your Android phone在您的 Android 手机中导入认证

  4. Change you Wifi configuration to listening to proxy将您的 Wifi 配置更改为监听代理

  5. Profit!利润!

I wrote the full tutorial and screenshot on how to do it at here: https://www.yodiw.com/monitor-android-network-traffic-with-burp/我在这里写了完整的教程和截图:https: //www.yodiw.com/monitor-android-network-traffic-with-burp/

You can use fiddler as webdebugger http://www.telerik.com/fiddler/web-debugging您可以将提琴手用作网络调试器http://www.telerik.com/fiddler/web-debugging

Fiddler is a debugging tool from telerik software, which helps you to intercept every request that is initiated from your machine. Fiddler是 Telerik 软件的调试工具,它可以帮助您拦截从您的机器发起的每个请求。

you can use burp-suite.你可以使用打嗝套件。 do follow below procedure.请遵循以下程序。

Configure the Burp Proxy listener配置 Burp 代理侦听器

In Burp, go to the “Proxy” tab and then the “Options” tab.In the “Proxy Listeners" section, click the “Add” button.在 Burp 中,转到“代理”选项卡,然后转到“选项”选项卡。在“代理侦听器”部分中,单击“添加”按钮。

In the "Binding" tab, in the “Bind to port:” box, enter a port number that is not currently in use, eg “8082”.Then select the “All interfaces” option, and click "OK".在“绑定”选项卡的“绑定到端口:”框中,输入一个当前未使用的端口号,例如“8082”。然后选择“所有接口”选项,然后单击“确定”。

Configure your device to use the proxy配置您的设备以使用代理

In your Android device, go to the“Settings” menu.在您的 Android 设备中,转到“设置”菜单。

If your device is not already connected to the wireless network you are using, then switch the "Wi-Fi" button on, and tap the “Wi-Fi” button to access the "Wi-Fi" menu.如果您的设备尚未连接到您正在使用的无线网络,请打开“Wi-Fi”按钮,然后点击“Wi-Fi”按钮以访问“Wi-Fi”菜单。

In the "Wi-Fi networks" table, find your network and tap it to bring up the connection menu.在“Wi-Fi 网络”表中,找到您的网络并点击它以调出连接菜单。

Tap "Connect".If you have configured a password, enter it and continue.点击“连接”。如果您已配置密码,请输入密码并继续。

Once you are connected hold down on the network button to bring up the context menu.Tap “Modify network config”.连接后,按住网络按钮以调出上下文菜单。点击“修改网络配置”。

Ensure that the “Show advanced options” box is ticked.确保勾选“显示高级选项”框。

Change the “Proxy settings” to “Manual” by tapping the button.通过点击按钮将“代理设置”更改为“手动”。

Then enter the IP of the computer running Burp into the “Proxy hostname”.Enter the port number configured in the “Proxy Listeners” section earlier, in this example “8082”.Tap "Save".然后将运行 Burp 的计算机的 IP 输入到“代理主机名”中。输入之前在“代理侦听器”部分中配置的端口号,在本例中为“8082”。点击“保存”。

Test the configuration测试配置

In Burp, go to the "Proxy Intercept" tab, and ensure that intercept is “on” (if the button says “Intercept is off" then click it to toggle the interception status).在 Burp 中,转到“代理拦截”选项卡,并确保拦截处于“打开”状态(如果按钮显示“拦截已关闭”,则单击它以切换拦截状态)。

Open the browser on your Android device and go to an HTTP web page (you can visit an HTTPS web page when you have installed Burp's CA Certificate in your Android device.)在你的安卓设备上打开浏览器并进入一个 HTTP 网页(当你在你的安卓设备中安装了 Burp 的 CA 证书后,你可以访问一个 HTTPS 网页。)

The request should be intercepted in Burp.该请求应该在 Burp 中被拦截。

Set a https://mitmproxy.org/ as proxy on a same LANhttps://mitmproxy.org/设置为同一 LAN 上的代理

  • Open Source开源
  • Built in python 3内置python 3
  • Installable via pip可通过 pip 安装
  • Have a Docker image有一个Docker 镜像

SandroProxy seems to be better than Drony (by the same developer): You can (but do not have to) conveniently view and analyze the traffic in your PC's browser. SandroProxy似乎比 Drony 更好(由同一开发者开发):您可以(但不必)方便地查看和分析 PC 浏览器中的流量。

Should work in emulators as well.也应该在模拟器中工作。

If you're willing to use Genymotion (or another supported emulated device) you can use HTTP Toolkit , which can analyze and intercept/rewrite HTTP calls.如果您愿意使用 Genymotion(或其他受支持的模拟设备),您可以使用HTTP Toolkit ,它可以分析和拦截/重写 HTTP 调用。 For HTTPS you will need a rooted device, to be able to trust the root CA certificate as a system certificate.对于 HTTPS,您将需要一个有根设备,以便能够将根 CA 证书作为系统证书信任。 Genymotion devices are rooted by default. Genymotion 设备默认植根。

To install the app you want to investigate, Genymotion supports Open GApps (for Google Play support) and drag-and-drop for APK files.要安装您要调查的应用程序,Genymotion 支持 Open GApps(用于 Google Play 支持)和拖放 APK 文件。

HTTP Toolkit also works on real devices, but then root privileges are required (most Android phones are not rooted). HTTP Toolkit 也可以在真实设备上运行,但需要 root 权限(大多数 Android 手机没有 root 权限)。

https://httptoolkit.tech/docs/guides/android/#intercepting-traffic-from-your-own-android-app https://httptoolkit.tech/docs/guides/android/#intercepting-traffic-from-your-own-android-app

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android:在非根目录设备上运行脚本 - Android: run a script on non-rooted device 非root用户设备上的Android用户空间文件系统驱动程序? - Android userspace filesystem driver on non-rooted device? 以编程方式在Android设备上创建Google帐户(非root用户设备) - Creating a google account on android programatically (non-rooted device) 在非root用户的Android上模拟主机文件 - Emulate hosts file on non-rooted Android 通过Google TV(Android非根设备)从端口查找pid - find pid from port over Google TV (Android non-rooted device) 是否真的有一种方法可以在不使用电缆的情况下将 ADB 命令发送到非 root 的 android 设备? - Is there truly a way to send ADB commands without the usage of a cable to a non-rooted android device? 外部指纹扫描仪,用于无根Android平板电脑 - External fingerprint scanner for non-rooted Android tablets 是否可以在非 root android 手机上添加属性? - Is it possible to add a property on a non-rooted android phone? 是否可以在非 root 的 android 手机上运行本机 arm 二进制文件? - Is it possible to run a native arm binary on a non-rooted android phone? 如何重新启动非root用户的设备? - how to restart a non-rooted device?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM