helpers.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // helpers.h
  3. // Meridian
  4. //
  5. // Created by Ben Sparkes on 30/12/2017.
  6. // Copyright © 2017 Ben Sparkes. All rights reserved.
  7. //
  8. #ifndef helpers_h
  9. #define helpers_h
  10. #include <stdio.h>
  11. #define CS_GET_TASK_ALLOW 0x0000004 /* has get-task-allow entitlement */
  12. #define CS_INSTALLER 0x0000008 /* has installer entitlement */
  13. #define CS_HARD 0x0000100 /* don't load invalid pages */
  14. #define CS_RESTRICT 0x0000800 /* tell dyld to treat restricted */
  15. #define CS_PLATFORM_BINARY 0x4000000 /* this is a platform binary */
  16. #define JAILBREAKD_COMMAND_ENTITLE 1
  17. #define JAILBREAKD_COMMAND_ENTITLE_AND_SIGCONT 2
  18. #define JAILBREAKD_COMMAND_ENTITLE_AND_SIGCONT_FROM_XPCPROXY 3
  19. #define JAILBREAKD_COMMAND_FIXUP_SETUID 4
  20. int call_jailbreakd(int command, pid_t pid);
  21. uint64_t find_proc_by_name(char* name);
  22. uint64_t find_proc_by_pid(uint32_t pid);
  23. uint32_t get_pid_for_name(char* name);
  24. int uicache(void);
  25. int start_launchdaemon(const char *path);
  26. int respring(void);
  27. int inject_library(pid_t pid, const char *path);
  28. int killall(const char *procname, const char *kill);
  29. int check_for_jailbreak(void);
  30. char *itoa(long n);
  31. int file_exists(const char *path);
  32. void read_file(const char* path);
  33. int cp(const char *from, const char *to);
  34. int num_files(const char *path);
  35. char* bundled_file(const char *filename);
  36. char* bundle_path(void);
  37. int extract_bundle(const char* bundle_name, const char* directory);
  38. int extract_bundle_tar(const char *bundle_name);
  39. void touch_file(char *path);
  40. char* concat(const char *s1, const char *s2);
  41. void grant_csflags(pid_t pd);
  42. int execprog(const char *prog, const char* args[]);
  43. void restart_device(void);
  44. double uptime(void);
  45. void suspend_all_threads(void);
  46. void resume_all_threads(void);
  47. #endif