小编Ren*_*nes的帖子

从VPN Service + Packets阻止[Android]检测应用程序请求

我试图找出我的设备上的哪个应用程序已经发出任何互联网使用请求(称为任何api等).为此我创建了一个从"VpnService"类扩展的类,以确保我的设备流量通过我,虽然我实际上并没有连接到VPN,而是假装它让流量通过我到0.0.0.0.代码如下,它工作正常,但我想弄清楚哪个应用程序已启动使用互联网的请求或其数据包是在下面的主循环中进/出.另外,有没有办法可以阻止来自任何应用程序的请求 - 无论是[传入还是传出]?

    *private Thread mThread;
private ParcelFileDescriptor mInterface;
//a. Configure a builder for the interface.
Builder builder = new Builder();
// Services interface
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    this.getApplicationInfo();
    // Start a new session by creating a new thread.
    mThread = new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                //a. Configure the TUN and get the interface.
                mInterface = builder.setSession("MyVPNService")
                        .setMtu(1500)
                        .addAddress("192.168.1.66", 32)
                        .addRoute("0.0.0.0", 0).establish();
                //b. Packets to be sent are …
Run Code Online (Sandbox Code Playgroud)

java vpn android

10
推荐指数
1
解决办法
2492
查看次数

标签 统计

android ×1

java ×1

vpn ×1