OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

以下内容为反编译后的 OurPlayVpnService.java 源代码,内容仅作参考


package com.excelliance.kxqp.gs.service;

import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.VpnService;
import android.os.Build;
import android.os.ParcelFileDescriptor;
import android.util.Log;
import com.excean.ab_builder.c.a;
import com.excelliance.kxqp.gs.l.f;
import com.excelliance.kxqp.gs.util.bq;
import java.io.IOException;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;

public class OurPlayVpnService extends VpnService {

    private ParcelFileDescriptor f8209a;

    @Override
    public int onStartCommand(Intent intent, int i, int i2) {
        if (intent == null) {
            return super.onStartCommand(intent, i, i2);
        }
        Log.d("OurPlayVpnService", "action:" + intent.getAction());
        String action = intent.getAction();
        char c = 65535;
        int hashCode = action.hashCode();
        if (hashCode != -1837334752) {
            if (hashCode == -586979122 && action.equals("action_start_vpn")) {
                c = 0;
            }
        } else if (action.equals("action_stop_vpn")) {
            c = 1;
        }
        switch (c) {
            case 0:
                d();
                return 1;
            case 1:
                b();
                stopSelf();
                return 2;
            default:
                return 1;
        }
    }

    private void b() {
        if (this.f8209a != null) {
            try {
                this.f8209a.close();
                this.f8209a = null;
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    @Override
    public void onRevoke() {
        b();
        c();
        super.onRevoke();
    }

    private void c() {
        if (a.at(getApplicationContext())) {
            getApplication().sendBroadcast(new Intent("com.excelliance.kxqp.OurPlayVpnService.stop.acc.app"));
        }
    }

    private void d() {
        VpnService.Builder builder = new VpnService.Builder(this);
        getPackageManager();
        if (this.f8209a != null) {
            return;
        }
        String a2 = a();
        if (a2 == null) {
            a2 = "192.168.0.1";
            if (Build.VERSION.SDK_INT >= 21) {
                List<PackageInfo> arrayList = new ArrayList<>();
                if (bq.h(getApplicationContext())) {
                    arrayList = f.a(getApplicationContext()).b(getApplicationContext(), true);
                }
                try {
                    Iterator<PackageInfo> it = arrayList.iterator();
                    while (it.hasNext()) {
                        builder.addDisallowedApplication(it.next().packageName);
                    }
                } catch (PackageManager.NameNotFoundException unused) {
                }
            }
        }
        builder.addAddress(a2, 24);
        this.f8209a = builder.establish();
    }

    public static String a() {
        try {
            Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
            while (networkInterfaces.hasMoreElements()) {
                Enumeration<InetAddress> inetAddresses = networkInterfaces.nextElement().getInetAddresses();
                while (inetAddresses.hasMoreElements()) {
                    InetAddress nextElement = inetAddresses.nextElement();
                    if ((nextElement instanceof Inet4Address) && !nextElement.isLoopbackAddress()) {
                        return nextElement.getHostAddress();
                    }
                }
            }
            return null;
        } catch (SocketException e) {
            e.printStackTrace();
            return null;
        }
    }

    @Override
    public void onDestroy() {
        b();
        super.onDestroy();
    }
}