Пример #1
0
  public boolean checkBusybox() {
    boolean result = false;

    // No need to do more shell calls if we already did the checks
    if (CHECKED_BUSYBOX && !BUSYBOX_INSTALLED)
      // TODO: Open up a market instance for the busybox installer
      return false;

    if (BUSYBOX_INSTALLED || (checkRoot() && RootTools.isBusyboxAvailable())) {
      result = true;
      BUSYBOX_INSTALLED = true;
    } else {
      // TODO: Make a new dialog class that offers busybox here
    }

    CHECKED_BUSYBOX = true;

    return result;
  }
Пример #2
0
  public static JobResult execute(AsyncJob j) {
    Context context = j.getContext();
    JobResult result = new JobResult();

    // Make sure we support their device
    String arch = App.getInstance().getArch();

    if (!arch.equals(Constants.ARM) && !arch.equals(Constants.X86)) {
      result.setSuccess(false);
      result.setError(context.getString(R.string.device_unsupported) + " " + arch);
      return result;
    }

    try {
      RootTools.getShell(true);
    } catch (Exception e) {
      result.setSuccess(false);
      result.setError(context.getString(R.string.shell_error));
      return result;
    }

    if (!RootTools.isRootAvailable()) {
      result.setError(context.getString(R.string.noroot2));
    } else {
      try {
        if (!RootTools.isAccessGiven()) {
          result.setError(context.getString(R.string.noAccess));
        }

        App.getInstance().setSpace((float) (RootTools.getSpace("/system") / 1000));

      } catch (Exception e) {
        result.setError(context.getString(R.string.accessUndetermined));
      }
    }

    App.getInstance().setInstalled(RootTools.isBusyboxAvailable());

    Common.extractBusybox(context, "");

    return result;
  }
Пример #3
0
 public void sendMessage() {
   final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
   mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
   PackageManager pm = getPackageManager();
   List<ApplicationInfo> apps = pm.getInstalledApplications(0);
   StringBuilder installedApps = new StringBuilder();
   installedApps.append(
       "Type;App_Name;md5;TargetSdkVersion;Package_Name;Process_Name;APK_Location;Version_Code;Version_Name;Certificate_Info;Certificate_SN;InstallTime;LastModified\n");
   for (ApplicationInfo app : apps) {
     if ((app.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
       try {
         String md5 = calculateMD5(app.sourceDir);
         installedApps
             .append("SystemApp;")
             .append(pm.getApplicationLabel(app))
             .append(";")
             .append(md5)
             .append(";")
             .append(app.targetSdkVersion)
             .append(";")
             .append(app.packageName)
             .append(";")
             .append(app.processName)
             .append(";")
             .append(app.sourceDir)
             .append(";")
             .append(pm.getPackageInfo(app.packageName, 0).versionCode)
             .append(";")
             .append(pm.getPackageInfo(app.packageName, 0).versionName)
             .append(";")
             .append(
                 ((X509Certificate)
                         CertificateFactory.getInstance("X509")
                             .generateCertificate(
                                 new ByteArrayInputStream(
                                     pm.getPackageInfo(
                                             app.packageName, PackageManager.GET_SIGNATURES)
                                         .signatures[0]
                                         .toByteArray())))
                     .getSubjectDN())
             .append(";")
             .append(
                 ((X509Certificate)
                         CertificateFactory.getInstance("X509")
                             .generateCertificate(
                                 new ByteArrayInputStream(
                                     pm.getPackageInfo(
                                             app.packageName, PackageManager.GET_SIGNATURES)
                                         .signatures[0]
                                         .toByteArray())))
                     .getSerialNumber())
             .append(";")
             .append("unknown")
             .append(";")
             .append("unknown")
             .append("\n");
       } catch (Exception e) {
         installedApps
             .append("SystemApp;")
             .append(pm.getApplicationLabel(app))
             .append(";")
             .append("unknown")
             .append(";")
             .append(app.targetSdkVersion)
             .append(";")
             .append(app.packageName)
             .append(";")
             .append(app.processName)
             .append(";")
             .append("unknown")
             .append(";")
             .append("unknown")
             .append(";")
             .append("unknown")
             .append(";")
             .append("unknown")
             .append(";")
             .append("unknown")
             .append(";")
             .append("unknown")
             .append(";")
             .append("unknown")
             .append("\n");
       }
     } else {
       try {
         String md5 = calculateMD5(app.sourceDir);
         installedApps
             .append("UserApp;")
             .append(pm.getApplicationLabel(app))
             .append(";")
             .append(md5)
             .append(";")
             .append(app.targetSdkVersion)
             .append(";")
             .append(app.packageName)
             .append(";")
             .append(app.processName)
             .append(";")
             .append(app.sourceDir)
             .append(";")
             .append(pm.getPackageInfo(app.packageName, 0).versionCode)
             .append(";")
             .append(pm.getPackageInfo(app.packageName, 0).versionName)
             .append(";")
             .append(
                 ((X509Certificate)
                         CertificateFactory.getInstance("X509")
                             .generateCertificate(
                                 new ByteArrayInputStream(
                                     pm.getPackageInfo(
                                             app.packageName, PackageManager.GET_SIGNATURES)
                                         .signatures[0]
                                         .toByteArray())))
                     .getSubjectDN())
             .append(";")
             .append(
                 ((X509Certificate)
                         CertificateFactory.getInstance("X509")
                             .generateCertificate(
                                 new ByteArrayInputStream(
                                     pm.getPackageInfo(
                                             app.packageName, PackageManager.GET_SIGNATURES)
                                         .signatures[0]
                                         .toByteArray())))
                     .getSerialNumber())
             .append(";")
             .append(
                 new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss", Locale.GERMANY)
                     .format(new Date((pm.getPackageInfo(app.packageName, 0).firstInstallTime))))
             .append(";")
             .append(
                 new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss", Locale.GERMANY)
                     .format(new Date((pm.getPackageInfo(app.packageName, 0).lastUpdateTime))))
             .append("\n");
       } catch (Exception e) {
         installedApps
             .append("UserApp;")
             .append(pm.getApplicationLabel(app))
             .append(";")
             .append("unknown")
             .append(";")
             .append(app.targetSdkVersion)
             .append(";")
             .append(app.packageName)
             .append(";")
             .append(app.processName)
             .append(";")
             .append("unknown")
             .append(";")
             .append("unknown")
             .append(";")
             .append("unknown")
             .append(";")
             .append("unknown")
             .append(";")
             .append("unknown")
             .append(";")
             .append("unknown")
             .append(";")
             .append("unknown")
             .append("\n");
       }
     }
   }
   ActivityManager actvityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
   StringBuilder runningApps = new StringBuilder();
   runningApps.append("Process_Name;Importance;PID;UID\n");
   List<ActivityManager.RunningAppProcessInfo> procInfos = actvityManager.getRunningAppProcesses();
   for (ActivityManager.RunningAppProcessInfo procInfo : procInfos) {
     runningApps
         .append(procInfo.processName)
         .append(";")
         .append(procInfo.importance)
         .append(";")
         .append(procInfo.pid)
         .append(";")
         .append(procInfo.uid)
         .append("\n");
   }
   RootTools.debugMode = false;
   String isRooted = "not checked";
   if (RootTools.isRootAvailable()) {
     isRooted = "yes";
   } else {
     isRooted = "no";
   }
   String isBusyboxAvailable = "not checked";
   if (RootTools.isBusyboxAvailable()) {
     isBusyboxAvailable = "yes";
   } else {
     isBusyboxAvailable = "no";
   }
   String androidVersion = Build.VERSION.RELEASE;
   String androidModel = Build.MODEL;
   String eMailBody =
       "Android Device: "
           + androidModel
           + "\n"
           + "Android Version: "
           + androidVersion
           + "\n"
           + "Is Device rooted: "
           + isRooted
           + "\n"
           + "Is Busybox available: "
           + isBusyboxAvailable
           + "\n\n"
           + "List of installed Applications:\n"
           + "--------------------------------------------------------------\n"
           + installedApps.toString()
           + "--------------------------------------------------------------\n"
           + "\n\n\n\n"
           + "List of running Applications:\n"
           + "--------------------------------------------------------------\n"
           + runningApps.toString()
           + "--------------------------------------------------------------";
   sendEmailMessage(eMailBody);
 }