nkk71

Untitled

Mar 1st, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.65 KB | None | 0 0
  1. #ifdef TW_CRYPTO_SYSTEM_VOLD_DEBUG
  2. bool strace_ing(void) {
  3.     static int ret = -1;
  4.  
  5.     if (ret != -1)
  6.         return ret;
  7.  
  8.     if (!TWFunc::Path_Exists("/sbin/strace")) {
  9.         LOGDECRYPT("strace binary not found, disabling strace_ing vold_decrypt!\n");
  10.         ret = 0;
  11.     } else
  12.         ret = 1;
  13.  
  14.     return ret;
  15. }
  16.  
  17. pid_t strace_init(void) {
  18.     if (!strace_ing())
  19.         return -1;
  20.  
  21.     pid_t pid;
  22.     int status;
  23.     switch(pid = fork())
  24.     {
  25.         case -1:
  26.             LOGDECRYPT_KMSG("forking strace_init failed: %d!\n", errno);
  27.             return -1;
  28.         case 0: // child
  29.             execl("/sbin/strace", "strace", "-q", "-tt", "-ff", "-v", "-y", "-s", "1000", "-o", "/tmp/strace_init.log", "-p", "1" , NULL);
  30.             LOGDECRYPT_KMSG("strace_init fork failed: %d!\n", errno);
  31.             return -1;
  32.         default:
  33.             LOGDECRYPT_KMSG("Starting strace_init (pid=%d)\n", pid);
  34.             //strace_ing = true;
  35.             return pid;
  36.     }
  37. }
  38. #endif
  39.  
  40. bool timeout_ing(void) {
  41.     static int ret = -1;
  42.  
  43.     if (ret != -1)
  44.         return ret;
  45.  
  46.     if (!TWFunc::Path_Exists("/sbin/timeout")) {
  47.         LOGDECRYPT("timeout binary not found, disabling timeout_ing vold_decrypt!\n");
  48.         ret = 0;
  49.     } else
  50.         ret = 1;
  51.  
  52.     return ret;
  53. }
  54.  
  55. string vdc_cryptfs_cmd(string info_text) {
  56.     string cmd;
  57.  
  58.     cmd = "LD_LIBRARY_PATH=/system/lib64:/system/lib /system/bin/vdc cryptfs ";
  59.  
  60. #ifdef TW_CRYPTO_SYSTEM_VOLD_DEBUG
  61.     if (timeout_ing() && strace_ing())
  62.         cmd = "/sbin/timeout -t 30 /sbin/strace -q -tt -ff -v -y -s 1000 -o /tmp/strace_vdc_" + info_text + " -E " + cmd;
  63.     else if (strace_ing())
  64.         cmd = "/sbin/strace -q -tt -ff -v -y -s 1000 -o /tmp/strace_vdc_" + info_text + " -E " + cmd;
  65.     else
  66. #endif
  67.     if (timeout_ing())
  68.         cmd = "/sbin/timeout -t 30 env " + cmd;
  69.  
  70.     return cmd;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment