Fiddler mobile phone packet capture/simulator packet capture configuration agent has no network problems

Recent work requires network packet capture for the app. I installed the fiddler tool and used the Yeshen simulator to simulate mobile phone packet capture. All configurations have been configured, but the app still cannot connect to the Internet. The solution is recorded as follows:


【problem causes】

When we install the fiddler certificate on the phone or simulator, the certificate is installed in the user certificate directory. Applications after Android 7.0 only trust the system certificate by default and do not trust the user certificate, so we have two methods. solve this problem. 1. Install the Fiddler certificate into the system certificate directory and disguise it as a system certificate. 2. Use Android 5.0 version mobile phone or simulator. Use the first method below.

1. Export fiddler certificate

1. Before doing this, please make sure that your fiddler has been installed and configured!
2. First close fiddler, then download the fiddlercertmaker.exe tool, double-click the downloaded fiddlercertmaker.exe (make sure Fiddler is closed), a dialog box will pop up prompting that the certificate import was successful, click OK
Insert image description here

3. Export the fiddler certificate to the computer desktop, Tools -> Options -> HTTPS -> Actions -> Export Root Certificate to Desktop

Insert image description here

After completion, a FiddlerRoot.cer certificate will appear on the computer desktop.
Insert image description here

2. Install openssl

1. Go to the openssl download address to download the windows version of openssl.

Insert image description here
2. Click Install and click Next
3. After the installation is completed, you need to configure the environment variables . Configure the bin directory of the installation directory to the environment variables.
Insert image description here

4. Open the terminal and enter openssl versionor enter and opensslthe following message will appear, indicating that the installation is successful.

Insert image description here
Insert image description here

3. Certificate format conversion

1. Convert the Fiddler cercertificate to pema certificate and enter the following command in cmd:openssl x509 -inform DER -in 电脑桌面证书路径.cer -out 电脑桌面证书路径.pem

openssl x509 -inform DER -in C:\Users\Administrator\Desktop\FiddlerRoot.cer -out C:\Users\Administrator\Desktop\FiddlerRoot.pem

2. To calculate the value pemof the certificate hash, enter the following command:openssl x509 -inform PEM -subject_hash_old -in 电脑桌面证书路径

openssl x509 -inform PEM -subject_hash_old -in C:\Users\Administrator\Desktop\FiddlerRoot.pem

Insert image description here
The picture above e5c3944bis pemthe hash value of the certificate.

3. Use the following command e5c3944bto pemrename the certificate:ren 电脑桌面证书路径 证书hash值.0

ren C:\Users\Administrator\Desktop\FiddlerRoot.pem e5c3944b.0

4. Install the certificate to the system directory

Here I am using the Night God simulator

1. Open the terminal input adb connect 127.0.0.1:62001and connect to the Yeshen simulator (if it appears, 'adb' 不是内部或外部命令,也不是可运行的程序 或批处理文件。you need to find the platform-tools path under the SDK installation path and enter cmd to open the terminal)
2. cmd input adb shell
3, cmd input cd /system/etc/security,
4. cmd input ls -lview permission, this does not have write permission

Insert image description here
5. Enter cmd. chmod 777 cacertsNow you have write permissions on the directory. You can enter the old permissions again ls -lto view the directory permissions.
Insert image description here
Now you have write permissions.

If the input chmod 777 cacerts"Read-only file system" appears and
Insert image description here
you need to remount the system, enter mount -o remount,rw /systemit again chmod 777 cacertsand it will be successful.

6. Enter cmd to exitexit the shell terminal, then enter adb push C:\Users\Administrator\Desktop\e5c3944b.0 /system/etc/security/cacerts, and push the pre-converted Fiddler certificate to /system/ of the Yeshen simulator. In the etc/security/cacerts directory,
Insert image description here
the fiddler certificate has been installed in the system certificate directory of the simulator. Open the Yeshen simulator.

Insert image description here
Insert image description here
Insert image description here

You're done! You can see that the fiddler certificate has been installed in the system directory.
Make sure that the simulator has set up the proxy IP and port. At this time, open fiddler to capture the simulator's package and there will be no problem of no network.

Finally, special thanks! Detailed tutorial on Android 7.0+ emulator Fiddler packet capture

Guess you like

Origin blog.csdn.net/m0_61427728/article/details/128351139