前言
需要手機和電腦在同一區域網下
重要提醒
僅供學習使用,請勿用做商業用途
怎麼抓包
- 1.下載安裝Fiddler
下載連結,需要填寫郵箱和選擇國家,然後下一步
- 2.配置
開啟Tools
-Connections
,選中Allow remote computers to connect
,將請求資訊傳送至電腦端,並設定埠,一般用預設8888
即可。

- 3.配置手機代理
在cmd中輸入
ipconfig
,檢視本機ip 然後在手機的wifi設定下選擇代理,填寫電腦的ip和第2步中設定的埠

開啟目標app,即可在電腦上看到請求資訊


- 4.HTTPS
電腦端需要下載certificates 外掛,選擇CertMaker for iOS and Android
,下載後安裝。

在手機瀏覽器開啟http://192.168.10.221:8888
,也就是電腦端的ip和第二步中設定的埠

選擇You can download the FiddlerRoot certificate
,下載https 證照下載到手機,安裝證照。
需要注意的是,一般只能在手機自帶的檔案管理中找到證照,然後開啟安裝。 開啟目標app,即可看到https請求資訊



重要提示 僅供學習使用,請勿用做商業用途
怎麼防止被抓包
- 1.okhttp 設定無代理
client = new OkHttpClient.Builder()
.proxy(Proxy.NO_PROXY)
.connectTimeout(10, TimeUnit.SECONDS)
.readTimeout(10, TimeUnit.SECONDS)
.build();
複製程式碼
- 2.目前抓包基本上都是通過代理,只要使用了代理,就不請求介面即可。
public static boolean isWifiProxy(Context context) {
final boolean IS_ICS_OR_LATER = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
String proxyAddress;
int proxyPort;
if (IS_ICS_OR_LATER) {
proxyAddress = System.getProperty("http.proxyHost");
String portStr = System.getProperty("http.proxyPort");
proxyPort = Integer.parseInt((portStr != null ? portStr : "-1"));
} else {
proxyAddress = android.net.Proxy.getHost(context);
proxyPort = android.net.Proxy.getPort(context);
}
return (!TextUtils.isEmpty(proxyAddress)) && (proxyPort != -1);
}
複製程式碼