示例#1
0
 public static String runRoot(FTShell shell, boolean log) throws Exception {
   FTShell s = new FTShell("sysrun");
   s.save();
   push(s.getPath(), GlobalConfig.getProperty("deviceworkdir") + "/sysrun", false);
   s.clean();
   push(shell.getPath(), GlobalConfig.getProperty("deviceworkdir") + "/runscript", false);
   if (log) MyLogger.getLogger().info("Running " + shell.getName() + "  as root thru sysrun");
   else MyLogger.getLogger().debug("Running " + shell.getName() + "  as root thru sysrun");
   ProcessBuilderWrapper command;
   if (rootnative)
     command =
         new ProcessBuilderWrapper(
             new String[] {
               adbpath, "shell", "sh " + GlobalConfig.getProperty("deviceworkdir") + "/sysrun"
             },
             false);
   else
     command =
         new ProcessBuilderWrapper(
             new String[] {
               adbpath,
               "shell",
               "su -c 'sh " + GlobalConfig.getProperty("deviceworkdir") + "/sysrun'"
             },
             false);
   return command.getStdOut();
 }
示例#2
0
 public void doBusyboxHelper() throws Exception {
   if (!isBusyboxInstalled(false)) {
     AdbUtility.push(getBusybox(false), GlobalConfig.getProperty("deviceworkdir") + "/busybox");
     FTShell shell = new FTShell("busyhelper");
     shell.run(true);
   }
 }
示例#3
0
 public static void doRootpsneuter() {
   try {
     AdbUtility.push(
         Devices.getCurrent().getBusybox(false),
         GlobalConfig.getProperty("deviceworkdir") + "/busybox");
     Shell shell = new Shell("busyhelper");
     shell.run(true);
     AdbUtility.push(
         "." + fsep + "custom" + fsep + "root" + fsep + "psneuter.tar.uue",
         GlobalConfig.getProperty("deviceworkdir"));
     shell = new Shell("rootit");
     MyLogger.getLogger().info("Running part1 of Root Exploit, please wait");
     shell.run(false);
     Devices.waitForReboot(true);
     MyLogger.getLogger().info("Running part2 of Root Exploit");
     shell = new Shell("rootit2");
     shell.run(false);
     MyLogger.getLogger().info("Finished!.");
     MyLogger.getLogger().info("Root should be available after reboot!");
   } catch (Exception e) {
     MyLogger.getLogger().error(e.getMessage());
   }
 }
示例#4
0
 public static String run(FTShell shell, boolean debug) throws Exception {
   push(shell.getPath(), GlobalConfig.getProperty("deviceworkdir") + "/" + shell.getName(), false);
   if (debug) MyLogger.getLogger().debug("Running " + shell.getName());
   else MyLogger.getLogger().info("Running " + shell.getName());
   ProcessBuilderWrapper command =
       new ProcessBuilderWrapper(
           new String[] {
             adbpath,
             "shell",
             "sh " + GlobalConfig.getProperty("deviceworkdir") + "/" + shell.getName() + ";exit $?"
           },
           false);
   if (command.getStdOut().contains("FTError"))
     throw new Exception(command.getStdErr() + " " + command.getStdOut());
   return command.getStdOut();
 }
示例#5
0
 public static String getKernelVersion(boolean hasbusybox) {
   try {
     String result = "";
     if (!hasbusybox) {
       AdbUtility.push(
           Devices.getCurrent().getBusybox(false),
           GlobalConfig.getProperty("deviceworkdir") + "/busybox1",
           false);
       AdbUtility.run("chmod 755 " + GlobalConfig.getProperty("deviceworkdir") + "/busybox1");
       result = run(GlobalConfig.getProperty("deviceworkdir") + "/busybox1 uname -r");
       run("rm -r " + GlobalConfig.getProperty("deviceworkdir") + "/busybox1");
     } else result = run("busybox uname -r");
     return result;
   } catch (Exception e) {
     return "";
   }
 }
 protected IStatus run(IProgressMonitor monitor) {
   try {
     AdbUtility.push(bbpath, GlobalConfig.getProperty("deviceworkdir"));
     FTShell shell = new FTShell("busyhelper");
     shell.run(false);
     shell = new FTShell("instbusybox");
     shell.setProperty("BUSYBOXINSTALLPATH", Devices.getCurrent().getBusyBoxInstallPath());
     shell.runRoot();
     MyLogger.getLogger()
         .info(
             "Installed version of busybox : "
                 + Devices.getCurrent().getInstalledBusyboxVersion(true));
     MyLogger.getLogger().info("Finished");
     return Status.OK_STATUS;
   } catch (Exception e) {
     e.printStackTrace();
     MyLogger.getLogger().error(e.getMessage());
     return Status.CANCEL_STATUS;
   }
 }
示例#7
0
 public static void push(String source, String destination) throws Exception {
   push(source, destination, true);
 }
示例#8
0
 protected IStatus run(IProgressMonitor monitor) {
   try {
     DeviceEntry ent = new DeviceEntry(platform);
     if (!new File(
             ent.getDeviceDir()
                 + File.separator
                 + "blu"
                 + File.separator
                 + "files"
                 + File.separator
                 + "cert.properties")
         .exists()) throw new Exception("cert.properties is missing");
     Properties p = new Properties();
     try {
       p.load(
           new FileInputStream(
               new File(
                   ent.getDeviceDir()
                       + File.separator
                       + "blu"
                       + File.separator
                       + "files"
                       + File.separator
                       + "cert.properties")));
     } catch (Exception ex) {
     }
     String bootwrite = "";
     Enumeration<Object> e = p.keys();
     while (e.hasMoreElements()) {
       String key = (String) e.nextElement();
       if (p.getProperty(key).equals(phonecert)) {
         bootwrite = key;
         break;
       }
     }
     if (bootwrite.length() == 0) throw new Exception("Phone certificate not identified");
     bootwrite = "bootwrite_" + bootwrite + "SL";
     if (!new File(
             ent.getDeviceDir()
                 + File.separator
                 + "blu"
                 + File.separator
                 + "files"
                 + File.separator
                 + bootwrite)
         .exists()) throw new Exception(bootwrite + " is missing");
     if (!new File(
             ent.getDeviceDir()
                 + File.separator
                 + "blu"
                 + File.separator
                 + "files"
                 + File.separator
                 + "fixPart")
         .exists()) throw new Exception("fixPart is missing");
     if (!new File(
             ent.getDeviceDir()
                 + File.separator
                 + "blu"
                 + File.separator
                 + "files"
                 + File.separator
                 + "mapper_2.6.29.ko")
         .exists()) throw new Exception("mapper_2.6.29.ko is missing");
     if (platform.equals("X10"))
       if (!new File(
               ent.getDeviceDir()
                   + File.separator
                   + "blu"
                   + File.separator
                   + "files"
                   + File.separator
                   + "mapper_2.6.29-00054-g5f01537.ko")
           .exists()) throw new Exception("mapper_2.6.29-00054-g5f01537.ko is missing");
     MyLogger.getLogger().info("Waiting for device to reboot");
     Devices.waitForReboot(false);
     if (!Devices.getCurrent().getKernelVersion().equals("2.6.29-00054-g5f01537")
         && !Devices.getCurrent().getKernelVersion().equals("2.6.29"))
       throw new Exception("Kernel does not match a compatible one");
     if (!Devices.getCurrent().hasRoot()) throw new Exception("Device must be rooted first");
     String mapper = "mapper_" + Devices.getCurrent().getKernelVersion() + ".ko";
     AdbUtility.push(
         ent.getDeviceDir()
             + File.separator
             + "blu"
             + File.separator
             + "files"
             + File.separator
             + "fixPart",
         GlobalConfig.getProperty("deviceworkdir"));
     FTShell fixpart =
         new FTShell(
             new File(
                 ent.getDeviceDir()
                     + File.separator
                     + "blu"
                     + File.separator
                     + "shells"
                     + File.separator
                     + "runfixPart"));
     String output = fixpart.runRoot();
     if (!output.contains("success")) throw new Exception("Error applying fixpart: " + output);
     MyLogger.getLogger().info("Successfully applied fixPart. Rebooting");
     Devices.getCurrent().reboot();
     Devices.waitForReboot(false);
     AdbUtility.push(
         ent.getDeviceDir()
             + File.separator
             + "blu"
             + File.separator
             + "files"
             + File.separator
             + mapper,
         GlobalConfig.getProperty("deviceworkdir"));
     AdbUtility.push(
         ent.getDeviceDir()
             + File.separator
             + "blu"
             + File.separator
             + "files"
             + File.separator
             + bootwrite,
         GlobalConfig.getProperty("deviceworkdir"));
     FTShell runbootwrite =
         new FTShell(
             new File(
                 ent.getDeviceDir()
                     + File.separator
                     + "blu"
                     + File.separator
                     + "shells"
                     + File.separator
                     + "runbootwrite"));
     runbootwrite.setProperty("KVER", Devices.getCurrent().getKernelVersion());
     runbootwrite.setProperty("BOOTWRITEBIN", bootwrite);
     output = runbootwrite.runRoot();
     if (!output.contains("success")) throw new Exception("Error applying fixpart: " + output);
     MyLogger.getLogger()
         .info("Successfully applied bootwrite. Bootloader should be unlocked. Rebooting");
     Devices.getCurrent().reboot();
     return Status.OK_STATUS;
   } catch (Exception e) {
     e.printStackTrace();
     MyLogger.getLogger().error(e.getMessage());
     return Status.CANCEL_STATUS;
   }
 }