package com.stericson.RootTools.internal;

import android.content.Context;
import android.util.Log;
import com.stericson.RootShell.execution.Command;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

class Installer
{
  static final String BOGUS_FILE_NAME = "bogus";
  static final String LOG_TAG = "RootTools::Installer";
  Context context;
  String filesPath;
  
  public Installer(Context paramContext)
    throws IOException
  {
    this.context = paramContext;
    this.filesPath = paramContext.getFilesDir().getCanonicalPath();
  }
  
  private void commandWait(Command paramCommand)
  {
    try
    {
      if (!paramCommand.isFinished()) {
        paramCommand.wait(2000L);
      }
      return;
    }
    catch (InterruptedException localInterruptedException)
    {
      for (;;)
      {
        Log.e("RootTools::Installer", localInterruptedException.toString());
      }
    }
    finally {}
  }
  
  protected String getFileSignature(File paramFile)
  {
    try
    {
      paramFile = getStreamSignature(new FileInputStream(paramFile));
      return paramFile;
    }
    catch (FileNotFoundException paramFile)
    {
      Log.e("RootTools::Installer", paramFile.toString());
    }
    return "";
  }
  
  /* Error */
  protected String getStreamSignature(java.io.InputStream paramInputStream)
  {
    // Byte code:
    //   0: ldc 84
    //   2: invokestatic 90	java/security/MessageDigest:getInstance	(Ljava/lang/String;)Ljava/security/MessageDigest;
    //   5: astore_3
    //   6: new 92	java/security/DigestInputStream
    //   9: dup
    //   10: aload_1
    //   11: aload_3
    //   12: invokespecial 95	java/security/DigestInputStream:<init>	(Ljava/io/InputStream;Ljava/security/MessageDigest;)V
    //   15: astore 4
    //   17: sipush 4096
    //   20: newarray <illegal type>
    //   22: astore 5
    //   24: iconst_m1
    //   25: aload 4
    //   27: aload 5
    //   29: invokevirtual 99	java/security/DigestInputStream:read	([B)I
    //   32: if_icmpne -8 -> 24
    //   35: aload_3
    //   36: invokevirtual 103	java/security/MessageDigest:digest	()[B
    //   39: astore_3
    //   40: new 105	java/lang/StringBuffer
    //   43: dup
    //   44: invokespecial 106	java/lang/StringBuffer:<init>	()V
    //   47: astore 4
    //   49: iconst_0
    //   50: istore_2
    //   51: iload_2
    //   52: aload_3
    //   53: arraylength
    //   54: if_icmpge +26 -> 80
    //   57: aload 4
    //   59: aload_3
    //   60: iload_2
    //   61: baload
    //   62: sipush 255
    //   65: iand
    //   66: invokestatic 112	java/lang/Integer:toHexString	(I)Ljava/lang/String;
    //   69: invokevirtual 116	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   72: pop
    //   73: iload_2
    //   74: iconst_1
    //   75: iadd
    //   76: istore_2
    //   77: goto -26 -> 51
    //   80: aload 4
    //   82: invokevirtual 117	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   85: astore_3
    //   86: aload_1
    //   87: invokevirtual 122	java/io/InputStream:close	()V
    //   90: aload_3
    //   91: areturn
    //   92: astore_3
    //   93: ldc 11
    //   95: aload_3
    //   96: invokevirtual 123	java/io/IOException:toString	()Ljava/lang/String;
    //   99: invokestatic 64	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;)I
    //   102: pop
    //   103: aload_1
    //   104: invokevirtual 122	java/io/InputStream:close	()V
    //   107: ldc 80
    //   109: areturn
    //   110: astore_1
    //   111: ldc 80
    //   113: areturn
    //   114: astore_3
    //   115: ldc 11
    //   117: aload_3
    //   118: invokevirtual 124	java/security/NoSuchAlgorithmException:toString	()Ljava/lang/String;
    //   121: invokestatic 64	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;)I
    //   124: pop
    //   125: aload_1
    //   126: invokevirtual 122	java/io/InputStream:close	()V
    //   129: ldc 80
    //   131: areturn
    //   132: astore_1
    //   133: ldc 80
    //   135: areturn
    //   136: astore_3
    //   137: aload_1
    //   138: invokevirtual 122	java/io/InputStream:close	()V
    //   141: aload_3
    //   142: athrow
    //   143: astore_1
    //   144: aload_3
    //   145: areturn
    //   146: astore_1
    //   147: goto -6 -> 141
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	150	0	this	Installer
    //   0	150	1	paramInputStream	java.io.InputStream
    //   50	27	2	i	int
    //   5	86	3	localObject1	Object
    //   92	4	3	localIOException	IOException
    //   114	4	3	localNoSuchAlgorithmException	java.security.NoSuchAlgorithmException
    //   136	9	3	str	String
    //   15	66	4	localObject2	Object
    //   22	6	5	arrayOfByte	byte[]
    // Exception table:
    //   from	to	target	type
    //   0	24	92	java/io/IOException
    //   24	49	92	java/io/IOException
    //   51	73	92	java/io/IOException
    //   80	86	92	java/io/IOException
    //   103	107	110	java/io/IOException
    //   0	24	114	java/security/NoSuchAlgorithmException
    //   24	49	114	java/security/NoSuchAlgorithmException
    //   51	73	114	java/security/NoSuchAlgorithmException
    //   80	86	114	java/security/NoSuchAlgorithmException
    //   125	129	132	java/io/IOException
    //   0	24	136	finally
    //   24	49	136	finally
    //   51	73	136	finally
    //   80	86	136	finally
    //   93	103	136	finally
    //   115	125	136	finally
    //   86	90	143	java/io/IOException
    //   137	141	146	java/io/IOException
  }
  
  /* Error */
  protected boolean installBinary(int paramInt, String paramString1, String paramString2)
  {
    // Byte code:
    //   0: new 31	java/io/File
    //   3: dup
    //   4: new 130	java/lang/StringBuilder
    //   7: dup
    //   8: invokespecial 131	java/lang/StringBuilder:<init>	()V
    //   11: aload_0
    //   12: getfield 37	com/stericson/RootTools/internal/Installer:filesPath	Ljava/lang/String;
    //   15: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   18: getstatic 137	java/io/File:separator	Ljava/lang/String;
    //   21: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   24: aload_2
    //   25: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   28: invokevirtual 138	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   31: invokespecial 141	java/io/File:<init>	(Ljava/lang/String;)V
    //   34: astore 14
    //   36: aload 14
    //   38: invokevirtual 144	java/io/File:exists	()Z
    //   41: ifeq +30 -> 71
    //   44: aload_0
    //   45: aload 14
    //   47: invokevirtual 146	com/stericson/RootTools/internal/Installer:getFileSignature	(Ljava/io/File;)Ljava/lang/String;
    //   50: aload_0
    //   51: aload_0
    //   52: getfield 23	com/stericson/RootTools/internal/Installer:context	Landroid/content/Context;
    //   55: invokevirtual 150	android/content/Context:getResources	()Landroid/content/res/Resources;
    //   58: iload_1
    //   59: invokevirtual 156	android/content/res/Resources:openRawResource	(I)Ljava/io/InputStream;
    //   62: invokevirtual 77	com/stericson/RootTools/internal/Installer:getStreamSignature	(Ljava/io/InputStream;)Ljava/lang/String;
    //   65: invokevirtual 162	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   68: ifne +229 -> 297
    //   71: ldc 11
    //   73: new 130	java/lang/StringBuilder
    //   76: dup
    //   77: invokespecial 131	java/lang/StringBuilder:<init>	()V
    //   80: ldc -92
    //   82: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   85: aload_2
    //   86: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   89: invokevirtual 138	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   92: invokestatic 64	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;)I
    //   95: pop
    //   96: aload_0
    //   97: getfield 23	com/stericson/RootTools/internal/Installer:context	Landroid/content/Context;
    //   100: ldc 8
    //   102: invokevirtual 168	android/content/Context:openFileInput	(Ljava/lang/String;)Ljava/io/FileInputStream;
    //   105: invokevirtual 169	java/io/FileInputStream:close	()V
    //   108: aload_0
    //   109: getfield 23	com/stericson/RootTools/internal/Installer:context	Landroid/content/Context;
    //   112: invokevirtual 150	android/content/Context:getResources	()Landroid/content/res/Resources;
    //   115: iload_1
    //   116: invokevirtual 156	android/content/res/Resources:openRawResource	(I)Ljava/io/InputStream;
    //   119: astore 15
    //   121: aload 15
    //   123: invokestatic 175	java/nio/channels/Channels:newChannel	(Ljava/io/InputStream;)Ljava/nio/channels/ReadableByteChannel;
    //   126: astore 16
    //   128: aconst_null
    //   129: astore 11
    //   131: aconst_null
    //   132: astore 13
    //   134: new 177	java/io/FileOutputStream
    //   137: dup
    //   138: aload 14
    //   140: invokespecial 178	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   143: astore 12
    //   145: aload 12
    //   147: invokevirtual 182	java/io/FileOutputStream:getChannel	()Ljava/nio/channels/FileChannel;
    //   150: astore 11
    //   152: lconst_0
    //   153: lstore 4
    //   155: aload 15
    //   157: invokevirtual 186	java/io/InputStream:available	()I
    //   160: i2l
    //   161: lstore 8
    //   163: aload 11
    //   165: aload 16
    //   167: lload 4
    //   169: lload 8
    //   171: lload 4
    //   173: lsub
    //   174: invokevirtual 192	java/nio/channels/FileChannel:transferFrom	(Ljava/nio/channels/ReadableByteChannel;JJ)J
    //   177: lstore 6
    //   179: lload 4
    //   181: lload 6
    //   183: ladd
    //   184: lstore 6
    //   186: lload 6
    //   188: lstore 4
    //   190: lload 6
    //   192: lload 8
    //   194: lcmp
    //   195: iflt -32 -> 163
    //   198: aload 12
    //   200: ifnull +21 -> 221
    //   203: aload 12
    //   205: invokevirtual 195	java/io/FileOutputStream:flush	()V
    //   208: aload 12
    //   210: invokevirtual 199	java/io/FileOutputStream:getFD	()Ljava/io/FileDescriptor;
    //   213: invokevirtual 204	java/io/FileDescriptor:sync	()V
    //   216: aload 12
    //   218: invokevirtual 205	java/io/FileOutputStream:close	()V
    //   221: aload 15
    //   223: invokevirtual 122	java/io/InputStream:close	()V
    //   226: new 45	com/stericson/RootShell/execution/Command
    //   229: dup
    //   230: iconst_0
    //   231: iconst_0
    //   232: iconst_1
    //   233: anewarray 158	java/lang/String
    //   236: dup
    //   237: iconst_0
    //   238: new 130	java/lang/StringBuilder
    //   241: dup
    //   242: invokespecial 131	java/lang/StringBuilder:<init>	()V
    //   245: ldc -49
    //   247: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   250: aload_3
    //   251: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   254: ldc -47
    //   256: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   259: aload_0
    //   260: getfield 37	com/stericson/RootTools/internal/Installer:filesPath	Ljava/lang/String;
    //   263: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   266: getstatic 137	java/io/File:separator	Ljava/lang/String;
    //   269: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   272: aload_2
    //   273: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   276: invokevirtual 138	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   279: aastore
    //   280: invokespecial 212	com/stericson/RootShell/execution/Command:<init>	(IZ[Ljava/lang/String;)V
    //   283: astore_2
    //   284: invokestatic 218	com/stericson/RootShell/execution/Shell:startRootShell	()Lcom/stericson/RootShell/execution/Shell;
    //   287: aload_2
    //   288: invokevirtual 222	com/stericson/RootShell/execution/Shell:add	(Lcom/stericson/RootShell/execution/Command;)Lcom/stericson/RootShell/execution/Command;
    //   291: pop
    //   292: aload_0
    //   293: aload_2
    //   294: invokespecial 224	com/stericson/RootTools/internal/Installer:commandWait	(Lcom/stericson/RootShell/execution/Command;)V
    //   297: iconst_1
    //   298: istore 10
    //   300: iload 10
    //   302: ireturn
    //   303: astore 11
    //   305: aconst_null
    //   306: astore 12
    //   308: aconst_null
    //   309: astore 11
    //   311: aload_0
    //   312: getfield 23	com/stericson/RootTools/internal/Installer:context	Landroid/content/Context;
    //   315: ldc 8
    //   317: iconst_0
    //   318: invokevirtual 228	android/content/Context:openFileOutput	(Ljava/lang/String;I)Ljava/io/FileOutputStream;
    //   321: astore 13
    //   323: aload 13
    //   325: astore 11
    //   327: aload 13
    //   329: astore 12
    //   331: aload 13
    //   333: ldc -26
    //   335: invokevirtual 233	java/lang/String:getBytes	()[B
    //   338: invokevirtual 237	java/io/FileOutputStream:write	([B)V
    //   341: aload 13
    //   343: ifnull -235 -> 108
    //   346: aload 13
    //   348: invokevirtual 205	java/io/FileOutputStream:close	()V
    //   351: aload_0
    //   352: getfield 23	com/stericson/RootTools/internal/Installer:context	Landroid/content/Context;
    //   355: ldc 8
    //   357: invokevirtual 241	android/content/Context:deleteFile	(Ljava/lang/String;)Z
    //   360: pop
    //   361: goto -253 -> 108
    //   364: astore 11
    //   366: goto -258 -> 108
    //   369: astore_2
    //   370: aload 11
    //   372: astore 12
    //   374: getstatic 247	com/stericson/RootTools/RootTools:debugMode	Z
    //   377: ifeq +17 -> 394
    //   380: aload 11
    //   382: astore 12
    //   384: ldc 11
    //   386: aload_2
    //   387: invokevirtual 248	java/lang/Exception:toString	()Ljava/lang/String;
    //   390: invokestatic 64	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;)I
    //   393: pop
    //   394: iconst_0
    //   395: istore 10
    //   397: aload 11
    //   399: ifnull -99 -> 300
    //   402: aload 11
    //   404: invokevirtual 205	java/io/FileOutputStream:close	()V
    //   407: aload_0
    //   408: getfield 23	com/stericson/RootTools/internal/Installer:context	Landroid/content/Context;
    //   411: ldc 8
    //   413: invokevirtual 241	android/content/Context:deleteFile	(Ljava/lang/String;)Z
    //   416: pop
    //   417: iconst_0
    //   418: ireturn
    //   419: astore_2
    //   420: iconst_0
    //   421: ireturn
    //   422: astore_2
    //   423: aload 12
    //   425: ifnull +18 -> 443
    //   428: aload 12
    //   430: invokevirtual 205	java/io/FileOutputStream:close	()V
    //   433: aload_0
    //   434: getfield 23	com/stericson/RootTools/internal/Installer:context	Landroid/content/Context;
    //   437: ldc 8
    //   439: invokevirtual 241	android/content/Context:deleteFile	(Ljava/lang/String;)Z
    //   442: pop
    //   443: aload_2
    //   444: athrow
    //   445: astore_2
    //   446: getstatic 247	com/stericson/RootTools/RootTools:debugMode	Z
    //   449: ifeq +13 -> 462
    //   452: ldc 11
    //   454: aload_2
    //   455: invokevirtual 123	java/io/IOException:toString	()Ljava/lang/String;
    //   458: invokestatic 64	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;)I
    //   461: pop
    //   462: iconst_0
    //   463: ireturn
    //   464: astore_2
    //   465: getstatic 247	com/stericson/RootTools/RootTools:debugMode	Z
    //   468: ifeq +13 -> 481
    //   471: ldc 11
    //   473: aload_2
    //   474: invokevirtual 123	java/io/IOException:toString	()Ljava/lang/String;
    //   477: invokestatic 64	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;)I
    //   480: pop
    //   481: iconst_0
    //   482: istore 10
    //   484: aload 12
    //   486: ifnull -186 -> 300
    //   489: aload 12
    //   491: invokevirtual 195	java/io/FileOutputStream:flush	()V
    //   494: aload 12
    //   496: invokevirtual 199	java/io/FileOutputStream:getFD	()Ljava/io/FileDescriptor;
    //   499: invokevirtual 204	java/io/FileDescriptor:sync	()V
    //   502: aload 12
    //   504: invokevirtual 205	java/io/FileOutputStream:close	()V
    //   507: iconst_0
    //   508: ireturn
    //   509: astore_2
    //   510: iconst_0
    //   511: ireturn
    //   512: astore_3
    //   513: aload 13
    //   515: astore_2
    //   516: aload_2
    //   517: astore 11
    //   519: getstatic 247	com/stericson/RootTools/RootTools:debugMode	Z
    //   522: ifeq +16 -> 538
    //   525: aload_2
    //   526: astore 11
    //   528: ldc 11
    //   530: aload_3
    //   531: invokevirtual 78	java/io/FileNotFoundException:toString	()Ljava/lang/String;
    //   534: invokestatic 64	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;)I
    //   537: pop
    //   538: iconst_0
    //   539: istore 10
    //   541: aload_2
    //   542: ifnull -242 -> 300
    //   545: aload_2
    //   546: invokevirtual 195	java/io/FileOutputStream:flush	()V
    //   549: aload_2
    //   550: invokevirtual 199	java/io/FileOutputStream:getFD	()Ljava/io/FileDescriptor;
    //   553: invokevirtual 204	java/io/FileDescriptor:sync	()V
    //   556: aload_2
    //   557: invokevirtual 205	java/io/FileOutputStream:close	()V
    //   560: iconst_0
    //   561: ireturn
    //   562: astore_2
    //   563: iconst_0
    //   564: ireturn
    //   565: astore_2
    //   566: aload 11
    //   568: ifnull +21 -> 589
    //   571: aload 11
    //   573: invokevirtual 195	java/io/FileOutputStream:flush	()V
    //   576: aload 11
    //   578: invokevirtual 199	java/io/FileOutputStream:getFD	()Ljava/io/FileDescriptor;
    //   581: invokevirtual 204	java/io/FileDescriptor:sync	()V
    //   584: aload 11
    //   586: invokevirtual 205	java/io/FileOutputStream:close	()V
    //   589: aload_2
    //   590: athrow
    //   591: astore_2
    //   592: getstatic 247	com/stericson/RootTools/RootTools:debugMode	Z
    //   595: ifeq +13 -> 608
    //   598: ldc 11
    //   600: aload_2
    //   601: invokevirtual 123	java/io/IOException:toString	()Ljava/lang/String;
    //   604: invokestatic 64	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;)I
    //   607: pop
    //   608: iconst_0
    //   609: ireturn
    //   610: astore_2
    //   611: goto -314 -> 297
    //   614: astore_3
    //   615: goto -26 -> 589
    //   618: astore_2
    //   619: aload 12
    //   621: astore 11
    //   623: goto -57 -> 566
    //   626: astore_3
    //   627: aload 12
    //   629: astore_2
    //   630: goto -114 -> 516
    //   633: astore 11
    //   635: goto -414 -> 221
    //   638: astore_3
    //   639: goto -196 -> 443
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	642	0	this	Installer
    //   0	642	1	paramInt	int
    //   0	642	2	paramString1	String
    //   0	642	3	paramString2	String
    //   153	36	4	l1	long
    //   177	14	6	l2	long
    //   161	32	8	l3	long
    //   298	242	10	bool	boolean
    //   129	35	11	localFileChannel	java.nio.channels.FileChannel
    //   303	1	11	localFileNotFoundException	FileNotFoundException
    //   309	17	11	localObject1	Object
    //   364	39	11	localIOException	IOException
    //   517	105	11	localObject2	Object
    //   633	1	11	localException	Exception
    //   143	485	12	localObject3	Object
    //   132	382	13	localFileOutputStream	java.io.FileOutputStream
    //   34	105	14	localFile	File
    //   119	103	15	localInputStream	java.io.InputStream
    //   126	40	16	localReadableByteChannel	java.nio.channels.ReadableByteChannel
    // Exception table:
    //   from	to	target	type
    //   96	108	303	java/io/FileNotFoundException
    //   346	361	364	java/io/IOException
    //   311	323	369	java/lang/Exception
    //   331	341	369	java/lang/Exception
    //   402	417	419	java/io/IOException
    //   311	323	422	finally
    //   331	341	422	finally
    //   374	380	422	finally
    //   384	394	422	finally
    //   96	108	445	java/io/IOException
    //   155	163	464	java/io/IOException
    //   163	179	464	java/io/IOException
    //   489	507	509	java/lang/Exception
    //   134	145	512	java/io/FileNotFoundException
    //   545	560	562	java/lang/Exception
    //   134	145	565	finally
    //   519	525	565	finally
    //   528	538	565	finally
    //   221	226	591	java/io/IOException
    //   226	297	610	java/lang/Exception
    //   571	589	614	java/lang/Exception
    //   145	152	618	finally
    //   155	163	618	finally
    //   163	179	618	finally
    //   465	481	618	finally
    //   145	152	626	java/io/FileNotFoundException
    //   155	163	626	java/io/FileNotFoundException
    //   163	179	626	java/io/FileNotFoundException
    //   465	481	626	java/io/FileNotFoundException
    //   203	221	633	java/lang/Exception
    //   428	443	638	java/io/IOException
  }
  
  protected boolean isBinaryInstalled(String paramString)
  {
    boolean bool = false;
    if (new File(this.filesPath + File.separator + paramString).exists()) {
      bool = true;
    }
    return bool;
  }
}


/* Location:              /home/enzo/Documents/hacking/malwares/viking-horde/classes.jar!/com/stericson/RootTools/internal/Installer.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */