Advertisement
Al-Azif

Untitled

Sep 3rd, 2020
1,898
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <errno.h>
  4. #include <sys/types.h>
  5. #include <sys/stat.h>
  6. #include <fcntl.h>
  7. #include <sys/ioctl.h>
  8.  
  9. #include <orbis/Sysmodule.h>
  10. #include <sys/types.h>
  11. #include <unistd.h>
  12. #include <orbis/libkernel.h>
  13.  
  14. #include "mira_header.h"
  15.  
  16. #define JAILBREAK_FAILED -1
  17. #define SUCCESS 0
  18.  
  19. int jailbreak()
  20. {
  21.     MiraThreadCredentials get_param;
  22.     get_param.State = GSState::Get;
  23.     get_param.ThreadId = 0;
  24.     get_param.ProcessId = getpid();
  25.  
  26.     MiraThreadCredentials param;
  27.     param.State = GSState::Set;
  28.     param.ThreadId = 0;
  29.     param.RealUserId = 0;
  30.     param.RealGroupId = 0;
  31.     param.EffectiveUserId = 0;
  32.     param.ProcessId = getpid();
  33.     param.Prison = MiraThreadCredentialsPrison::Root;
  34.  
  35.     int mira_fd = open("/dev/mira", 0x000, 0x000);
  36.     if (mira_fd >= 0)
  37.     {
  38.         printf("opened mira now doing a ioctl\n");
  39.         int io_ret = ioctl(mira_fd, 0xC0704D01, &get_param);
  40.         io_ret = ioctl(mira_fd, 0xC0704D01, &param);
  41.  
  42.         if (io_ret == 0)
  43.         {
  44.             int ret = sceKernelOpen("/user/.test", 0x0001 | 0x0200, 0777);
  45.             printf("ret %d\n", ret);
  46.  
  47.             if (ret >= 0)
  48.             {
  49.                 close(ret);
  50.                 unlink("/user/.test");
  51.  
  52.                 printf("Jailbreak Successfully\n");
  53.                 return SUCCESS;
  54.             }
  55.         }
  56.     }
  57.  
  58.     return JAILBREAK_FAILED;
  59. }
  60.  
  61. int main(void)
  62. {
  63.     setvbuf(stdout, NULL, _IONBF, 0);
  64.  
  65.     if (jailbreak() == SUCCESS)
  66.     {
  67.         printf("Success\n");
  68.     }
  69.  
  70.     for (;;) {}
  71. }
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement