Fiddler + Android Thunderbolt Simulator + solve the problem of not being able to capture packets, just look at me, one-stop solution to the problem, bid farewell to searching for articles everywhere

Preface: This article describes how fiddler captures data packets in the simulator, let's not talk much about the text.

Table of contents

Environment preparation: lightning simulator, fiddler, adb

adb and fiddler download address:

 1. Fiddler settings

1. HTTPS: decrypt https traffic, ignore insecure certificates

2. Connection settings: Allow remote computer connections

 3. Root certificate installation: Export the desktop installation certificate

 2. Simulator settings

1. Network settings: bridge driver installation, and open bridge

 2. WLAN settings: set fiddler proxy

 3. Set the trust certificate: Use the adb command to move the installed certificate to the system directory.

Solve the problem of the lightning simulator directly from here, the above is the error handling, for other simulators to refer to and analyze.

other:

Question: The fiddler thunderbolt simulator can't capture packets, can't get data?


Environment preparation: lightning simulator, fiddler, adb

adb and fiddler download address: fiddler+adb.zip - Lanzuoyun

Idea: This article can solve 99%. Compared with solving the problem, it is more important to let everyone understand the principle of the fiddler simulator packet capture problem. The following is a flow chart of the idea for your reference.

 1. Fiddler settings

1. HTTPS: decrypt https traffic, ignore insecure certificates

2. Connection settings: Allow remote computer connections

Click to allow remote computer connections, click OK to save

 3. Root certificate installation: Export the desktop installation certificate

Click the exported certificate on the desktop to proceed to the next step of installation, and click all the defaults until the import is successful.

 

 After the Fiddler configuration is complete, close it and restart it .

 2. Simulator settings

1. Network settings: bridge driver installation, and open bridge

 

 Install the bridge driver, and the installation is successful.

After the installation is complete, click Save Settings to restart automatically. 

 2. WLAN settings: set fiddler proxy

Open the emulator settings - open the WiFi menu - modify the wifi configuration (some emulators have a small pen modification key, some emulators will appear "modify network" after long pressing the mouse, which is similar, you can refer to it yourself, the core is to modify the manual proxy connected to wifi, The ip is written to this machine, the port is written to 8888 for drinking in the fiddler software, if the port is occupied in fiddler, modify it here and change it to be the same) and finally click save!

 2. Certificate installation: physical machine ip: 8888

Open the emulator browser, enter the physical machine ip in the address bar to keep up with port 8888, that is, enter the proxy ip and port. It will jump to the certificate installation page.

Why install the certificate in this way 1. Simple and convenient 2. Can detect whether the connection with the physical machine is normal in disguise

 The picture is a bit long, please click patiently according to the steps.

 3. Set the trust certificate: Use the adb command to move the installed certificate to the system directory.

Direct viewing using a thunderbolt simulator

Original - user certificate directory: /data/misc/user/0/cacerts-added/
New - system certificate directory: /system/etc/security/cacerts/

If you do not move the installed certificate, untrusted certificates will appear here and pop up frequently (you can see that the organizational unit is our installation of fiddler).

This needs to be enabled in advance, the root authority of the emulator, otherwise you cannot switch users with su (the specifics vary depending on the emulator: some root permissions need to be enabled in the emulator, some do not need it, and if you encounter problems that cannot su, look for the emulator reason)

-------------------------------------------------- ------------Error analysis ------------------------------------ -------------------
 Then we continue to operate and move the certificate file of /data/misc/user/0/cacerts-added/ to /system/etc/security /cacerts/ to make it a trusted certificate.

# 进入adb shell 工具
adb shell

# 切换root用户
gracelte:/ $ su

# 查看用户证书安装的名称
127|gracelte:/ # ls /data/misc/user/0/cacerts-added/
e5c3944b.0

# 将用户证书挪至系统证书目录 /system/etc/security/cacerts/
gracelte:/ # mv /data/misc/user/0/cacerts-added/e5c3944b.0 /system/etc/security/cacerts/
mv: /system/etc/security/cacerts//e5c3944b.0: Read-only file system

A problem will be reported when moving the certificate to /system/etc/security/cacerts/

Error: mv: /system/etc/security/cacerts//e5c3944b.0: Read-only file system

Reason for error: /system is mounted as read-only, so no matter how you chmod it, you cannot modify its permissions.

Solution: remount, mount read, write and execute permissions

gracelte:/ $ su

# 重新挂载/system 文件夹
:/ #  mount -o rw,remount /system
mount: '/system' not in /proc/mounts

Error: mount: '/system' not in /proc/mounts

Reason for error: After Android 8.0 and above, through the above mount command, the node represented by /system and the permission information cannot be found. This is because after Android 8.0, Google added the A/B system feature, and the system partition is packaged with the ramdisk partition Together, so after the system is up, there is no system partition, but the system image is directly mounted on the / root directory. Therefore, the /proc/mounts file does not contain the permission information of /system.

 View the Android version of the emulator:

# 进入adb shell 工具
adb shell

# 切换root用户
gracelte:/ $ su

# 查看安卓版本
gracelte:/ # getprop ro.build.version.release
9

                       

Solution: Unlock the disk and mount it again

# 在windows窗口运行以下命令,不要进到adb shell 里面运行
D:\platform-tools> adb root

# 解锁分区(需要升级到最新版本adb,才有disable-verity工具)
D:\platform-tools> adb disable-verity

# 重新挂载,没加权限 表示rwx全部挂上
D:\platform-tools> adb remount

Error: If it is an old version of adb, the following information will be displayed

networking:
  adb ppp <tty> [parameters]   - Run PPP over USB.
 Note: you should not automatically start a PPP connection.
 <tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
 [parameters] - Eg. defaultroute debug dump local notty usepeerdns

adb sync notes: adb sync [ <directory> ]
  <localdir> can be interpreted in several ways:

  - If <directory> is not specified, both /system and /data partitions will be updated.

  - If it is "system" or "data", only the corresponding partition
    is updated.

environmental variables:
  ADB_TRACE                    - Print debug information. A comma separated list of the following values
                                 1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
  ANDROID_SERIAL               - The serial number to connect to. -s takes priority over this if given.
  ANDROID_LOG_TAGS             - When used with the logcat option, only these debug tags are printed.

Reason: The old version of adb does not contain the disable-verity toolkit

Solution: Install the latest adb tool

报错:Failed to read fstab Maybe run adb root?

Reason: There are 9 Thunderbolt simulators, this one is directly interfaced, and there is no need to unlock the disk through disable-verity, but other types of simulators will use this function, which is similar, so decide it yourself

Solution: In the emulator settings, disk management enables system.vmdk to be writable

-------------------------------------------------------------------------------------------------------------------------------

Solve the problem of the lightning simulator directly from here, the above is the error handling, for other simulators to refer to and analyze.

# 在windows窗口运行以下命令,不要进到adb shell 里面运行
D:\platform-tools> adb root

# 雷电模拟器,直接在设置打开磁盘写入功能

# 重新挂载,没加权限 表示rwx全部挂上
D:\platform-tools> adb remount

# 进入adb shell
D:platform-tools>adb shell

# 查看用户证书位置
gracelte:/ # ls /data/misc/user/0/cacerts-added/
e5c3944b.0

# 拷贝证书到目标文件夹
gracelte:/ # mv /data/misc/user/0/cacerts-added/e5c3944b.0 /system/etc/security/cacerts/

# Thunderbolt simulator, directly open the disk writing function in the settings

After configuring the above, restart the emulator and fiddler to capture packets 

 

other:

Question: The fiddler thunderbolt simulator can't capture packets, can't get data?

Answer: Some of them follow my steps, but they still cannot capture packets. It should be an emulator version problem. Just use the adb tool to push the proxy to the global.

# adb.exe shell settings put global http_proxy 本机ip:fiddler端口
adb.exe shell settings put global http_proxy 192.168.0.102:8888

Guess you like

Origin blog.csdn.net/weixin_43391813/article/details/130850778