# Charles & WSA 使用 Charles 查看 Windwos Subsystem for Android 裝置如何處理 HTTP request & response。 ## Prerequisites - [Charles proxy](https://www.charlesproxy.com/) - [Windows Subsystem for Android](https://learn.microsoft.com/zh-tw/windows/android/wsa/) - [Android Debug Bridge(adb)](https://developer.android.com/studio/command-line/adb) ## Instructions 1. 查詢本機 IP ```shell ipconfig ``` 2. 啟動 app 和 Charles 3. 使用 adb 連線至 WSA ![WSA setting](https://hackmd.io/_uploads/By3DY5Hu6.png) ```shell adb connect 127.0.0.1:58526 ``` 4. 更改 Android 裝置 proxy 為 Charles server 位置 (本機IP加上 Charles proxy default port) ```shell adb shell settings put global http_proxy 192.168.1.101:8888 ``` 如果有多台裝置,則先列出裝置,再指定該裝置 (`-s`) ```shell adb devices ``` 5. 在 app 上執行會發送 request 的操作,並在 Charles 確認是否正常紀錄 ### Reset 1. 重設 Android 裝置 proxy ```shell adb shell settings put global http_proxy :0 ``` 2. adb 離線 ```shell adb disconnect ``` 3. 關閉 adb server ```shell adb kill-server ```