[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] fix pdnsd/VPN support



commit 7ae000d0c2a59c2257f2779de42ad48b4b4080d0
Author: n8fr8 <nathan@xxxxxxxxxxxxxxxxxxxx>
Date:   Fri May 31 14:28:26 2019 -0400

    fix pdnsd/VPN support
---
 .gitignore                                         |   8 +-
 .../org/torproject/android/service/TorService.java |   5 +-
 .../android/service/TorServiceConstants.java       |   3 -
 .../android/service/util/CustomNativeLoader.java   |  32 ---
 .../service/util/CustomTorResourceInstaller.java   |  57 +-----
 .../service/util/OtherResourceInstaller.java       | 228 ---------------------
 .../android/service/vpn/OrbotVpnManager.java       |  21 +-
 .../android/service/vpn/PDNSDInstaller.java        | 195 ++++++++++++++++++
 .../android/service/vpn/TorVpnService.java         |  11 +-
 .../src/main/libs/arm64-v8a/libtun2socks.so        | Bin 0 -> 196640 bytes
 orbotservice/src/main/libs/arm64-v8a/pdnsd.so      | Bin 0 -> 207224 bytes
 .../src/main/libs/armeabi-v7a/libtun2socks.so      | Bin 0 -> 137836 bytes
 orbotservice/src/main/libs/armeabi-v7a/pdnsd.so    | Bin 0 -> 169824 bytes
 orbotservice/src/main/libs/armeabi/libtun2socks.so | Bin 0 -> 146024 bytes
 orbotservice/src/main/libs/armeabi/pdnsd.so        | Bin 0 -> 178012 bytes
 orbotservice/src/main/libs/x86/libtun2socks.so     | Bin 0 -> 195120 bytes
 orbotservice/src/main/libs/x86/pdnsd.so            | Bin 0 -> 202532 bytes
 orbotservice/src/main/libs/x86_64/libtun2socks.so  | Bin 0 -> 196920 bytes
 orbotservice/src/main/libs/x86_64/pdnsd.so         | Bin 0 -> 219696 bytes
 19 files changed, 225 insertions(+), 335 deletions(-)

diff --git a/.gitignore b/.gitignore
index a8f09edc..a6294876 100644
--- a/.gitignore
+++ b/.gitignore
@@ -64,10 +64,10 @@ obj
 
 app/src/main/jniLibs/
 app/src/main/libs/
-orbotservice/src/main/libs/
-orbotservice/src/main/jniLibs/
-orbotservice/src/main/assets/armeabi/
-orbotservice/src/main/assets/x86/
+#orbotservice/src/main/libs/
+#orbotservice/src/main/jniLibs/
+#orbotservice/src/main/assets/armeabi/
+#orbotservice/src/main/assets/x86/
 
 # emacs
 *~
diff --git a/orbotservice/src/main/java/org/torproject/android/service/TorService.java b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
index 6f9f6c12..2561a132 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/TorService.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
@@ -44,7 +44,7 @@ import org.torproject.android.control.TorControlConnection;
 import org.torproject.android.service.util.CustomShell;
 import org.torproject.android.service.util.CustomTorResourceInstaller;
 import org.torproject.android.service.util.DummyActivity;
-import org.torproject.android.service.util.OtherResourceInstaller;
+import org.torproject.android.service.vpn.PDNSDInstaller;
 import org.torproject.android.service.util.Prefs;
 import org.torproject.android.service.util.TorServiceUtils;
 import org.torproject.android.service.util.Utils;
@@ -603,9 +603,6 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
             if (!fileTorRc.exists())
                 return false;
 
-            OtherResourceInstaller oInstaller = new OtherResourceInstaller(this, appBinHome);
-            oInstaller.installResources();
-
             isTorUpgradeAndConfigComplete = true;
 
             return true;
diff --git a/orbotservice/src/main/java/org/torproject/android/service/TorServiceConstants.java b/orbotservice/src/main/java/org/torproject/android/service/TorServiceConstants.java
index b557de80..e02c8f81 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/TorServiceConstants.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/TorServiceConstants.java
@@ -143,9 +143,6 @@ public interface TorServiceConstants {
     
    //  String MEEK_ASSET_KEY = "meek-client";
 
-	//DNS daemon for TCP DNS over TOr
-	String PDNSD_ASSET_KEY = "pdnsd";
-
 	//EXIT COUNTRY CODES
 	String[] COUNTRY_CODES = {"DE","AT","SE","CH","IS","CA","US","ES","FR","BG","PL","AU","BR","CZ","DK","FI","GB","HU","NL","JP","RO","RU","SG","SK"};
 
diff --git a/orbotservice/src/main/java/org/torproject/android/service/util/CustomNativeLoader.java b/orbotservice/src/main/java/org/torproject/android/service/util/CustomNativeLoader.java
index bae4b068..0df6784a 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/util/CustomNativeLoader.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/util/CustomNativeLoader.java
@@ -74,38 +74,6 @@ public class CustomNativeLoader {
         try {
             String folder = Build.CPU_ABI;
 
-            /**
-             try {
-
-             if (Build.CPU_ABI.equalsIgnoreCase("arm64-v8a")) {
-             folder = "arm64-v8a";
-             }
-             else if (Build.CPU_ABI.equalsIgnoreCase("arm64")) {
-             folder = "arm64";
-             }
-             else if (Build.CPU_ABI.equalsIgnoreCase("x86_64")) {
-             folder = "x86_64";
-             }
-             else if (Build.CPU_ABI.equalsIgnoreCase("armeabi-v7a")) {
-             folder = "armeabi-v7a";
-             }
-             else if (Build.CPU_ABI.equalsIgnoreCase("armeabi")) {
-             folder = "armeabi";
-             } else if (Build.CPU_ABI.equalsIgnoreCase("x86")) {
-             folder = "x86";
-             } else if (Build.CPU_ABI.equalsIgnoreCase("mips")) {
-             folder = "mips";
-             } else {
-             folder = "armeabi";
-             //FileLog.e("tmessages", "Unsupported arch: " + Build.CPU_ABI);
-             }
-
-             } catch (Exception e) {
-             //  FileLog.e("tmessages", e);
-             Log.e(TAG, e.getMessage(),e);
-             folder = "armeabi";
-             }**/
-
 
             String javaArch = System.getProperty("os.arch");
             if (javaArch != null && javaArch.contains("686")) {
diff --git a/orbotservice/src/main/java/org/torproject/android/service/util/CustomTorResourceInstaller.java b/orbotservice/src/main/java/org/torproject/android/service/util/CustomTorResourceInstaller.java
index 043987e2..7e9dcc55 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/util/CustomTorResourceInstaller.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/util/CustomTorResourceInstaller.java
@@ -4,30 +4,26 @@ import android.content.Context;
 import android.content.pm.ApplicationInfo;
 import android.util.Log;
 
-import org.torproject.android.binary.NativeLoader;
 import org.torproject.android.binary.TorServiceConstants;
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.PrintStream;
 import java.util.concurrent.TimeoutException;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
-
 public class CustomTorResourceInstaller implements TorServiceConstants {
 
 
-    File installFolder;
-    Context context;
+    private File installFolder;
+    private Context context;
 
-    File fileTorrc;
-    File fileTor;
+    private File fileTorrc;
+    private File fileTor;
 
     public CustomTorResourceInstaller (Context context, File installFolder)
     {
@@ -35,35 +31,6 @@ public class CustomTorResourceInstaller implements TorServiceConstants {
         this.context = context;
     }
 
-    public File getTorrcFile ()
-    {
-        return fileTorrc;
-    }
-
-    public File getTorFile ()
-    {
-        return fileTor;
-    }
-
-    /**
-     private void deleteDirectory(File file) {
-     if( file.exists() ) {
-     if (file.isDirectory()) {
-     File[] files = file.listFiles();
-     for(int i=0; i<files.length; i++) {
-     if(files[i].isDirectory()) {
-     deleteDirectory(files[i]);
-     }
-     else {
-     files[i].delete();
-     }
-     }
-     }
-
-     file.delete();
-     }
-     }**/
-
     //
     /*
      * Extract the Tor resources from the APK file using ZIP
@@ -127,23 +94,7 @@ public class CustomTorResourceInstaller implements TorServiceConstants {
     }
 
 
-    public boolean updateTorConfigCustom (File fileTorRcCustom, String extraLines) throws IOException, FileNotFoundException, TimeoutException
-    {
-        if (fileTorRcCustom.exists())
-        {
-            fileTorRcCustom.delete();
-            Log.d("torResources","deleting existing torrc.custom");
-        }
-        else
-            fileTorRcCustom.createNewFile();
 
-        FileOutputStream fos = new FileOutputStream(fileTorRcCustom, false);
-        PrintStream ps = new PrintStream(fos);
-        ps.print(extraLines);
-        ps.close();
-
-        return true;
-    }
 
     /*
      * Extract the Tor binary from the APK file using ZIP
diff --git a/orbotservice/src/main/java/org/torproject/android/service/util/OtherResourceInstaller.java b/orbotservice/src/main/java/org/torproject/android/service/util/OtherResourceInstaller.java
deleted file mode 100644
index 241f6c7e..00000000
--- a/orbotservice/src/main/java/org/torproject/android/service/util/OtherResourceInstaller.java
+++ /dev/null
@@ -1,228 +0,0 @@
-package org.torproject.android.service.util;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.StringBufferInputStream;
-import java.util.ArrayList;
-import java.util.concurrent.TimeoutException;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.os.Build;
-import android.util.Log;
-
-import org.torproject.android.service.OrbotConstants;
-import org.torproject.android.service.R;
-import org.torproject.android.service.TorServiceConstants;
-
-public class OtherResourceInstaller implements TorServiceConstants {
-
-
-    File installFolder;
-    Context context;
-
-    public OtherResourceInstaller (Context context, File installFolder)
-    {
-        this.installFolder = installFolder;
-
-        this.context = context;
-    }
-
-    public void deleteDirectory(File file) {
-        if( file.exists() ) {
-            if (file.isDirectory()) {
-                File[] files = file.listFiles();
-                for(int i=0; i<files.length; i++) {
-                    if(files[i].isDirectory()) {
-                        deleteDirectory(files[i]);
-                    }
-                    else {
-                        files[i].delete();
-                    }
-                }
-            }
-
-            file.delete();
-        }
-    }
-
-    private final static String COMMAND_RM_FORCE = "rm -f ";
-    private final static String MP3_EXT = ".mp3";
-    //
-    /*
-     * Extract the Tor resources from the APK file using ZIP
-     */
-    public boolean installResources () throws IOException
-    {
-
-        File outFile;
-
-        if (!installFolder.exists())
-            installFolder.mkdirs();
-
-        outFile = new File(installFolder, PDNSD_ASSET_KEY);
-        NativeLoader.initNativeLibs(context,PDNSD_ASSET_KEY,outFile);
-
-//        outFile = new File(installFolder, OBFSCLIENT_ASSET_KEY);
- //       NativeLoader.initNativeLibs(context,OBFSCLIENT_ASSET_KEY,outFile);
-
-        return true;
-    }
-
-    // Return Full path to the directory where native JNI libraries are stored.
-    public static String getNativeLibraryDir(Context context) {
-        ApplicationInfo appInfo = context.getApplicationInfo();
-        return appInfo.nativeLibraryDir;
-    }
-
-    public boolean updateTorConfigCustom (File fileTorRcCustom, String extraLines) throws IOException, FileNotFoundException, TimeoutException
-    {
-        if (fileTorRcCustom.exists())
-        {
-            fileTorRcCustom.delete();
-            Log.d("torResources","deleting existing torrc.custom");
-        }
-        else
-            fileTorRcCustom.createNewFile();
-
-        FileOutputStream fos = new FileOutputStream(fileTorRcCustom, false);
-        PrintStream ps = new PrintStream(fos);
-        ps.print(extraLines);
-        ps.close();
-
-        return true;
-    }
-
-
-    /*
-     * Write the inputstream contents to the file
-     */
-    public static boolean streamToFile(InputStream stm, File outFile, boolean append, boolean zip) throws IOException
-
-    {
-        byte[] buffer = new byte[FILE_WRITE_BUFFER_SIZE];
-
-        int bytecount;
-
-        OutputStream stmOut = new FileOutputStream(outFile.getAbsolutePath(), append);
-        ZipInputStream zis = null;
-
-        if (zip)
-        {
-            zis = new ZipInputStream(stm);
-            ZipEntry ze = zis.getNextEntry();
-            stm = zis;
-
-        }
-
-        while ((bytecount = stm.read(buffer)) > 0)
-        {
-
-            stmOut.write(buffer, 0, bytecount);
-
-        }
-
-        stmOut.close();
-        stm.close();
-
-        if (zis != null)
-            zis.close();
-
-
-        return true;
-
-    }
-
-    //copy the file from inputstream to File output - alternative impl
-    public static boolean copyFile (InputStream is, File outputFile)
-    {
-
-        try {
-            if (outputFile.exists())
-                outputFile.delete();
-
-            boolean newFile = outputFile.createNewFile();
-            DataOutputStream out = new DataOutputStream(new FileOutputStream(outputFile));
-            DataInputStream in = new DataInputStream(is);
-
-            int b = -1;
-            byte[] data = new byte[1024];
-
-            while ((b = in.read(data)) != -1) {
-                out.write(data);
-            }
-
-            if (b == -1); //rejoice
-
-            //
-            out.flush();
-            out.close();
-            in.close();
-            // chmod?
-
-            return newFile;
-
-
-        } catch (IOException ex) {
-            Log.e(OrbotConstants.TAG, "error copying binary", ex);
-            return false;
-        }
-
-    }
-
-
-
-
-    /**
-     * Copies a raw resource file, given its ID to the given location
-     * @param ctx context
-     * @param resid resource id
-     * @param file destination file
-     * @param mode file permissions (E.g.: "755")
-     * @throws IOException on error
-     * @throws InterruptedException when interrupted
-     */
-    public static void copyRawFile(Context ctx, int resid, File file, String mode, boolean isZipd) throws IOException, InterruptedException
-    {
-        final String abspath = file.getAbsolutePath();
-        // Write the iptables binary
-        final FileOutputStream out = new FileOutputStream(file);
-        InputStream is = ctx.getResources().openRawResource(resid);
-
-        if (isZipd)
-        {
-            ZipInputStream zis = new ZipInputStream(is);
-            ZipEntry ze = zis.getNextEntry();
-            is = zis;
-        }
-
-        byte buf[] = new byte[1024];
-        int len;
-        while ((len = is.read(buf)) > 0) {
-            out.write(buf, 0, len);
-        }
-        out.close();
-        is.close();
-        // Change the permissions
-        Runtime.getRuntime().exec("chmod "+mode+" "+abspath).waitFor();
-    }
-
-
-    private void setExecutable(File fileBin) {
-        fileBin.setReadable(true);
-        fileBin.setExecutable(true);
-        fileBin.setWritable(false);
-        fileBin.setWritable(true, true);
-    }
-
-}
diff --git a/orbotservice/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java b/orbotservice/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java
index 90a13336..b5f294f4 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java
@@ -87,12 +87,10 @@ public class OrbotVpnManager implements Handler.Callback {
     private VpnService mService;
     
 
-    public OrbotVpnManager (VpnService service)
-    {
+    public OrbotVpnManager (VpnService service) throws IOException, TimeoutException {
     	mService = service;
 
-		File fileBinHome = service.getFilesDir();//mService.getDir(TorServiceConstants.DIRECTORY_TOR_BINARY, Application.MODE_PRIVATE);
-		filePdnsd = new File(fileBinHome,TorServiceConstants.PDNSD_ASSET_KEY);
+		filePdnsd = new PDNSDInstaller(service.getApplicationContext(),service.getFilesDir()).installResources();
 
 		Tun2Socks.init();
 
@@ -344,13 +342,13 @@ public class OrbotVpnManager implements Handler.Callback {
 
 		        	mInterface = newInterface;
 			        
-		        	Tun2Socks.Start(mInterface, VPN_MTU, virtualIP, virtualNetMask, localSocks , localDNS , localDnsTransparentProxy);
-		        	
 		        	isRestart = false;
 
 					//start PDNSD daemon pointing to actual DNS
 					startDNS("127.0.0.1",localDns);
 
+					Tun2Socks.Start(mInterface, VPN_MTU, virtualIP, virtualNetMask, localSocks , localDNS , localDnsTransparentProxy);
+
 
 				}
 		        catch (Exception e)
@@ -411,11 +409,11 @@ public class OrbotVpnManager implements Handler.Callback {
     private void startDNS (String dns, int port) throws IOException, TimeoutException
     {
 
-		makePdnsdConf(mService, dns, port,filePdnsd.getParentFile());
+		File fileConf = makePdnsdConf(mService, dns, port,mService.getFilesDir());
     	
-        ArrayList<String> customEnv = new ArrayList<String>();
+      //  ArrayList<String> customEnv = new ArrayList<String>();
 
-        String[] cmdString = {filePdnsd.getCanonicalPath(),"-c",filePdnsd.getParent() + "/pdnsd.conf"};
+        String[] cmdString = {filePdnsd.getCanonicalPath(),"-c",fileConf.toString()};
         ProcessBuilder pb = new ProcessBuilder(cmdString);
         pb.redirectErrorStream(true);
 		Process proc = pb.start();
@@ -425,6 +423,7 @@ public class OrbotVpnManager implements Handler.Callback {
 
         if (proc.exitValue() != 0)
         {
+
             BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
 
             String line = null;
@@ -437,7 +436,7 @@ public class OrbotVpnManager implements Handler.Callback {
         
     }
     
-    public static void makePdnsdConf(Context context, String dns, int port, File fileDir) throws FileNotFoundException, IOException {
+    public static File makePdnsdConf(Context context, String dns, int port, File fileDir) throws FileNotFoundException, IOException {
         String conf = String.format(context.getString(R.string.pdnsd_conf), dns, port, fileDir.getCanonicalPath());
 
         File f = new File(fileDir,"pdnsd.conf");
@@ -460,6 +459,8 @@ public class OrbotVpnManager implements Handler.Callback {
 
                 }
         }
+
+        return f;
 	}
 
     
diff --git a/orbotservice/src/main/java/org/torproject/android/service/vpn/PDNSDInstaller.java b/orbotservice/src/main/java/org/torproject/android/service/vpn/PDNSDInstaller.java
new file mode 100644
index 00000000..58caffad
--- /dev/null
+++ b/orbotservice/src/main/java/org/torproject/android/service/vpn/PDNSDInstaller.java
@@ -0,0 +1,195 @@
+package org.torproject.android.service.vpn;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.StringBufferInputStream;
+import java.util.ArrayList;
+import java.util.concurrent.TimeoutException;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.os.Build;
+import android.util.Log;
+
+import org.torproject.android.service.OrbotConstants;
+import org.torproject.android.service.R;
+import org.torproject.android.service.TorServiceConstants;
+import org.torproject.android.service.util.CustomNativeLoader;
+import org.torproject.android.service.util.NativeLoader;
+
+public class PDNSDInstaller implements TorServiceConstants {
+
+    private final static String LIB_NAME = "pdnsd";
+    private final static String LIB_SO_NAME = "pdnsd.so";
+
+    private final static String TAG = "TorNativeLoader";
+
+    private File installFolder;
+    private Context context;
+    private File filePdnsd;
+
+     public PDNSDInstaller (Context context, File installFolder)
+    {
+        this.installFolder = installFolder;
+        this.context = context;
+    }
+
+    //
+    /*
+     * Extract the Tor resources from the APK file using ZIP
+     *
+     * @File path to the Tor executable
+     */
+    public File installResources () throws IOException, TimeoutException
+    {
+
+        filePdnsd = new File(installFolder, LIB_NAME);
+
+        if (!installFolder.exists())
+            installFolder.mkdirs();
+
+        File fileNativeDir = new File(getNativeLibraryDir(context));
+        filePdnsd = new File(fileNativeDir,LIB_NAME + ".so");
+
+        if (filePdnsd.exists())
+        {
+            if (filePdnsd.canExecute())
+                return filePdnsd;
+            else
+            {
+                setExecutable(filePdnsd);
+
+                if (filePdnsd.canExecute())
+                    return filePdnsd;
+            }
+        }
+
+        if (filePdnsd.exists()) {
+            InputStream is = new FileInputStream(filePdnsd);
+            streamToFile(is, filePdnsd, false, true);
+            setExecutable(filePdnsd);
+
+            if (filePdnsd.exists() && filePdnsd.canExecute())
+                return filePdnsd;
+        }
+
+        //let's try another approach
+        filePdnsd = new File(installFolder, LIB_NAME);
+        //fileTor = NativeLoader.initNativeLibs(context,fileTor);
+        CustomNativeLoader.initNativeLibs(context,filePdnsd);
+
+        setExecutable(filePdnsd);
+
+        if (filePdnsd != null && filePdnsd.exists() && filePdnsd.canExecute())
+            return filePdnsd;
+
+        return null;
+    }
+
+
+    // Return Full path to the directory where native JNI libraries are stored.
+    private static String getNativeLibraryDir(Context context) {
+        ApplicationInfo appInfo = context.getApplicationInfo();
+        return appInfo.nativeLibraryDir;
+    }
+
+
+
+
+
+
+    /*
+     * Reads file from assetPath/assetKey writes it to the install folder
+     */
+    private File assetToFile(String assetPath, String assetKey, boolean isZipped, boolean isExecutable) throws IOException {
+        InputStream is = context.getAssets().open(assetPath);
+        File outFile = new File(installFolder, assetKey);
+        streamToFile(is, outFile, false, isZipped);
+        if (isExecutable) {
+            setExecutable(outFile);
+        }
+        return outFile;
+    }
+
+
+    /*
+     * Write the inputstream contents to the file
+     */
+    private static boolean streamToFile(InputStream stm, File outFile, boolean append, boolean zip) throws IOException
+
+    {
+        byte[] buffer = new byte[FILE_WRITE_BUFFER_SIZE];
+
+        int bytecount;
+
+        OutputStream stmOut = new FileOutputStream(outFile.getAbsolutePath(), append);
+        ZipInputStream zis = null;
+
+        if (zip)
+        {
+            zis = new ZipInputStream(stm);
+            ZipEntry ze = zis.getNextEntry();
+            stm = zis;
+
+        }
+
+        while ((bytecount = stm.read(buffer)) > 0)
+        {
+
+            stmOut.write(buffer, 0, bytecount);
+
+        }
+
+        stmOut.close();
+        stm.close();
+
+        if (zis != null)
+            zis.close();
+
+
+        return true;
+
+    }
+
+
+
+    private void setExecutable(File fileBin) {
+        fileBin.setReadable(true);
+        fileBin.setExecutable(true);
+        fileBin.setWritable(false);
+        fileBin.setWritable(true, true);
+    }
+
+    private static File[] listf(String directoryName) {
+
+        // .............list file
+        File directory = new File(directoryName);
+
+        // get all the files from a directory
+        File[] fList = directory.listFiles();
+
+        if (fList != null)
+            for (File file : fList) {
+                if (file.isFile()) {
+                    Log.d(TAG,file.getAbsolutePath());
+                } else if (file.isDirectory()) {
+                    listf(file.getAbsolutePath());
+                }
+            }
+
+        return fList;
+    }
+
+
+}
diff --git a/orbotservice/src/main/java/org/torproject/android/service/vpn/TorVpnService.java b/orbotservice/src/main/java/org/torproject/android/service/vpn/TorVpnService.java
index 34d89b49..b02fd71a 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/vpn/TorVpnService.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/vpn/TorVpnService.java
@@ -4,6 +4,9 @@ import android.app.Service;
 import android.content.Intent;
 import android.net.VpnService;
 
+import java.io.IOException;
+import java.util.concurrent.TimeoutException;
+
 /**
  * Created by n8fr8 on 9/26/16.
  */
@@ -13,7 +16,13 @@ public class TorVpnService extends VpnService {
     @Override
     public void onCreate() {
         super.onCreate();
-        mVpnManager = new OrbotVpnManager(this);
+        try {
+            mVpnManager = new OrbotVpnManager(this);
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (TimeoutException e) {
+            e.printStackTrace();
+        }
     }
 
     /* (non-Javadoc)
diff --git a/orbotservice/src/main/libs/arm64-v8a/libtun2socks.so b/orbotservice/src/main/libs/arm64-v8a/libtun2socks.so
new file mode 100755
index 00000000..8aaedda7
Binary files /dev/null and b/orbotservice/src/main/libs/arm64-v8a/libtun2socks.so differ
diff --git a/orbotservice/src/main/libs/arm64-v8a/pdnsd.so b/orbotservice/src/main/libs/arm64-v8a/pdnsd.so
new file mode 100755
index 00000000..1bc4487d
Binary files /dev/null and b/orbotservice/src/main/libs/arm64-v8a/pdnsd.so differ
diff --git a/orbotservice/src/main/libs/armeabi-v7a/libtun2socks.so b/orbotservice/src/main/libs/armeabi-v7a/libtun2socks.so
new file mode 100755
index 00000000..74b86bdf
Binary files /dev/null and b/orbotservice/src/main/libs/armeabi-v7a/libtun2socks.so differ
diff --git a/orbotservice/src/main/libs/armeabi-v7a/pdnsd.so b/orbotservice/src/main/libs/armeabi-v7a/pdnsd.so
new file mode 100755
index 00000000..573b5e42
Binary files /dev/null and b/orbotservice/src/main/libs/armeabi-v7a/pdnsd.so differ
diff --git a/orbotservice/src/main/libs/armeabi/libtun2socks.so b/orbotservice/src/main/libs/armeabi/libtun2socks.so
new file mode 100755
index 00000000..55ef663a
Binary files /dev/null and b/orbotservice/src/main/libs/armeabi/libtun2socks.so differ
diff --git a/orbotservice/src/main/libs/armeabi/pdnsd.so b/orbotservice/src/main/libs/armeabi/pdnsd.so
new file mode 100755
index 00000000..95a5269d
Binary files /dev/null and b/orbotservice/src/main/libs/armeabi/pdnsd.so differ
diff --git a/orbotservice/src/main/libs/x86/libtun2socks.so b/orbotservice/src/main/libs/x86/libtun2socks.so
new file mode 100755
index 00000000..af9a3ccc
Binary files /dev/null and b/orbotservice/src/main/libs/x86/libtun2socks.so differ
diff --git a/orbotservice/src/main/libs/x86/pdnsd.so b/orbotservice/src/main/libs/x86/pdnsd.so
new file mode 100755
index 00000000..c078cc38
Binary files /dev/null and b/orbotservice/src/main/libs/x86/pdnsd.so differ
diff --git a/orbotservice/src/main/libs/x86_64/libtun2socks.so b/orbotservice/src/main/libs/x86_64/libtun2socks.so
new file mode 100755
index 00000000..8861e585
Binary files /dev/null and b/orbotservice/src/main/libs/x86_64/libtun2socks.so differ
diff --git a/orbotservice/src/main/libs/x86_64/pdnsd.so b/orbotservice/src/main/libs/x86_64/pdnsd.so
new file mode 100755
index 00000000..68721cc2
Binary files /dev/null and b/orbotservice/src/main/libs/x86_64/pdnsd.so differ



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits