Android VPN抓包
2021-04-06 本文已影响0人
Sharkchilli
前言
有些时候你使用Charles可能会抓不到手机的包,原因是app中做了一些代理检测。所以本次介绍一下VPN抓包
对抗代理抓包
在aap中使用System.getProperty("http.proxyHost");和System.getProperty("http.proxyPort");即可获得代理ip和端口。去检测是否为null就可以知道app是否被代理抓包了。
public class MainActivity extends AppCompatActivity {
private TextView proxyHostText;
private TextView proxyPortText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
proxyHostText = findViewById(R.id.host);
proxyPortText = findViewById(R.id.port);
String proxyHost = System.getProperty("http.proxyHost");
String proxyPort = System.getProperty("http.proxyPort");
if (proxyHost != null) {
proxyHostText.setText("代理Host:"+proxyHost);
}
if (proxyHost != null) {
proxyPortText.setText("代理Port:"+proxyPort);
}
}
}
如果使用了代理效果如下:

VPN抓包
先去git上下载postern安装
postern下载地址
配置Charles
修改Proxy-->Proxy Settings如下,开启SOCKS proxy

配置postern
首先记得关闭你的wifi代理
1.添加代理服务器

这里的ip写Charles所在的电脑ip,端口写Charles配置的端口,代理类型为SOCKS5
2.配置规则

删除其中原本的规则,添加一个自己的规则

保存后打开VPN

手机、Charles匹配成功后,Charles工具显示弹窗,询问是否允许,点击Allow按钮

至此Charles就可以抓取到手机是的包了
并且可以看到我们前面的检测是无效的了
