forked from The404Hacking/EggShell-RAT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrocketbootstrap_dynamic.h
More file actions
121 lines (114 loc) · 3.93 KB
/
Copy pathrocketbootstrap_dynamic.h
File metadata and controls
121 lines (114 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// DONT INCLUDE DIRECTLY
// Set ROCKETBOOTSTRAP_LOAD_DYNAMIC and then include rocketbootstrap.h
#include <dlfcn.h>
__attribute__((unused))
static kern_return_t rocketbootstrap_look_up(mach_port_t bp, const name_t service_name, mach_port_t *sp)
{
static kern_return_t (*impl)(mach_port_t bp, const name_t service_name, mach_port_t *sp);
if (!impl) {
void *handle = dlopen("/usr/lib/librocketbootstrap.dylib", RTLD_LAZY);
if (handle)
impl = (kern_return_t (*)(mach_port_t, const name_t, mach_port_t *))dlsym(handle, "rocketbootstrap_look_up");
if (!impl)
impl = bootstrap_look_up;
}
return impl(bp, service_name, sp);
}
__attribute__((unused))
static kern_return_t rocketbootstrap_unlock(const name_t service_name)
{
static kern_return_t (*impl)(const name_t service_name);
if (!impl) {
void *handle = dlopen("/usr/lib/librocketbootstrap.dylib", RTLD_LAZY);
if (handle)
impl = (kern_return_t (*)(const name_t))dlsym(handle, "rocketbootstrap_unlock");
if (!impl)
return -1;
}
return impl(service_name);
}
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
__attribute__((unused))
static kern_return_t rocketbootstrap_register(mach_port_t bp, name_t service_name, mach_port_t sp)
{
static kern_return_t (*impl)(mach_port_t bp, name_t service_name, mach_port_t sp);
if (!impl) {
void *handle = dlopen("/usr/lib/librocketbootstrap.dylib", RTLD_LAZY);
if (handle)
impl = (kern_return_t (*)(mach_port_t, name_t, mach_port_t))dlsym(handle, "rocketbootstrap_register");
if (!impl)
impl = bootstrap_register;
}
return impl(bp, service_name, sp);
}
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
#ifdef XPC_API_VERSION
kern_return_t rocketbootstrap_xpc_connection_apply(xpc_connection_t connection)
{
static kern_return_t (*impl)(xpc_connection_t connection);
if (!impl) {
void *handle = dlopen("/usr/lib/librocketbootstrap.dylib", RTLD_LAZY);
if (handle)
impl = (kern_return_t (*)(xpc_connection_t))dlsym(handle, "rocketbootstrap_xpc_connection_apply");
if (!impl)
return -1;
}
return impl(connection);
}
kern_return_t rocketbootstrap_xpc_unlock(xpc_connection_t listener)
{
static kern_return_t (*impl)(xpc_connection_t listener);
if (!impl) {
void *handle = dlopen("/usr/lib/librocketbootstrap.dylib", RTLD_LAZY);
if (handle)
impl = (kern_return_t (*)(xpc_connection_t))dlsym(handle, "rocketbootstrap_xpc_unlock");
if (!impl)
return -1;
}
return impl(listener);
}
#endif
#ifdef __COREFOUNDATION_CFMESSAGEPORT__
__attribute__((unused))
static CFMessagePortRef rocketbootstrap_cfmessageportcreateremote(CFAllocatorRef allocator, CFStringRef name)
{
static CFMessagePortRef (*impl)(CFAllocatorRef allocator, CFStringRef name);
if (!impl) {
void *handle = dlopen("/usr/lib/librocketbootstrap.dylib", RTLD_LAZY);
if (handle)
impl = (CFMessagePortRef (*)(CFAllocatorRef, CFStringRef))dlsym(handle, "rocketbootstrap_cfmessageportcreateremote");
if (!impl)
impl = CFMessagePortCreateRemote;
}
return impl(allocator, name);
}
__attribute__((unused))
static kern_return_t rocketbootstrap_cfmessageportexposelocal(CFMessagePortRef messagePort)
{
static kern_return_t (*impl)(CFMessagePortRef messagePort);
if (!impl) {
void *handle = dlopen("/usr/lib/librocketbootstrap.dylib", RTLD_LAZY);
if (handle)
impl = (kern_return_t (*)(CFMessagePortRef))dlsym(handle, "rocketbootstrap_cfmessageportexposelocal");
if (!impl)
return -1;
}
return impl(messagePort);
}
#endif
#ifdef __OBJC__
@class CPDistributedMessagingCenter;
__attribute__((unused))
static void rocketbootstrap_distributedmessagingcenter_apply(CPDistributedMessagingCenter *messaging_center)
{
static void (*impl)(CPDistributedMessagingCenter *messagingCenter);
if (!impl) {
void *handle = dlopen("/usr/lib/librocketbootstrap.dylib", RTLD_LAZY);
if (handle)
impl = (void (*)(CPDistributedMessagingCenter *))dlsym(handle, "rocketbootstrap_distributedmessagingcenter_apply");
if (!impl)
return;
}
impl(messaging_center);
}
#endif