Advertisement
Guest User

Untitled

a guest
May 27th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. package com.test.rootchecker;
  2.  
  3. import java.io.File;
  4. import java.util.List;
  5. import java.util.Map;
  6.  
  7. import android.content.Context;
  8. import android.content.pm.ApplicationInfo;
  9.  
  10. public class RootChecker {
  11.  
  12. Context ctx;
  13. RootChecker(Context context)
  14. {
  15. ctx = context;
  16. }
  17.  
  18. Boolean checkForSuperUserAPK()
  19. {
  20. //package:com.noshufou.android.su.elite
  21. //package:com.noshufou.android.su
  22. List<ApplicationInfo> localList = ctx.getPackageManager().getInstalledApplications(0x00);
  23. for (ApplicationInfo info : localList)
  24. {
  25. if(info.packageName.contains("com.noshufou"))
  26. return true;
  27. }
  28. return false;
  29. }
  30.  
  31. Boolean checkSuBinary()
  32. {
  33. //Iterate through all folders in PATH looking for su
  34. Map<String,String> env = System.getenv();
  35. String path = env.get("PATH");
  36. String [] dirs = path.split(":");
  37.  
  38. for (String dir : dirs){
  39. String suPath = dir + "/" + "su";
  40. File suFile = new File(suPath);
  41. if (suFile != null && suFile.exists()) {
  42. return true;
  43. }
  44. }
  45.  
  46. return false;
  47. }
  48.  
  49. Boolean check_ro_secure()
  50. {
  51. String roSecureProp = System.getProperty("ro.secure");
  52. if (roSecureProp != null && roSecureProp.contains("0"))
  53. return true;
  54.  
  55. return false;
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement