-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathsupport.h
More file actions
156 lines (129 loc) · 5.13 KB
/
support.h
File metadata and controls
156 lines (129 loc) · 5.13 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/* libSupport - Powerful app modification library
* Copyright (c) 2022-2025 Rednick16 (Red16)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef support_h
#define support_h
#include "wrapper.h"
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
// Provides compatibility for Just-In-Time (JIT) compilation and debug mode.
LS_EXPORT
int SupportCodePatchEx(void* addr, const uint8_t* buffer, size_t size);
LS_EXPORT
const char* SupportGetLibraryPath(void);
typedef enum _SupportHookFlags
{
SupportHookFlagNone = 0,
SupportHookFlagObjCRuntime = 1 << 0,
SupportHookFlagDynamicLibraries = 1 << 1,
SupportHookFlagFilesystem = 1 << 2,
SupportHookFlagCoreFoundation = 1 << 3,
SupportHookFlagFoundation = 1 << 4,
SupportHookFlagURLScheme = 1 << 5,
SupportHookFlagSyscall = 1 << 6,
SupportHookFlagSymLookup = 1 << 7,
SupportHookFlagDeviceCheck = 1 << 8,
SupportHookFlagAntiDebugging = 1 << 9,
SupportHookFlagAntiProxyAndVPN = 1 << 10,
SupportHookFlagSecurity = 1 << 11,
/* 1<<12 (anti exit) */
// Enable all hooking options :)
SupportHookFlagEnableAll = ~SupportHookFlagNone
} SupportHookFlags;
typedef struct _SupportEntryInfo
{
const char *teamIdentifier;
const char *bundleIdentifier;
SupportHookFlags hookFlags;
const char **restrictedFiles;
size_t restrictedFileCount;
const char **restrictedURLSchemes;
size_t restrictedURLSchemeCount;
} SupportEntryInfo;
LS_EXPORT
void SupportInitialize(SupportEntryInfo* info);
LS_EXPORT
int SupportMemoryProtectEx(void* addr, size_t size, int protection);
typedef struct _SupportHookInfo
{
void *address;
void *replacement;
void **original;
} SupportHookInfo;
// Provides compatibility for Just-In-Time (JIT) compilation.
LS_EXPORT
int LS_DEPRECATED(SupportHookFunctionEx(SupportHookInfo hookInfo),
"Please use Dobby instead.");
LS_EXPORT
int LS_DEPRECATED(SupportDestroy(SupportHookInfo hookInfo),
"Please use Dobby instead.");
#define SupportHookFunction(_address, _replacement, _original) \
SupportHookFunctionEx((SupportHookInfo){ \
.address = (_address), \
.replacement = (_replacement), \
.original = (_original) \
})
LS_EXPORT
void SupportHookSymbolEx(const char* symbol, void* replacement, void** replaced);
typedef struct _SupportDetectionInfo
{
int isJailbroken; // ret: 0 || 1
int isDebuggerPresent; // ret: 0 || 1
} SupportDetectionInfo;
LS_EXPORT
void SupportGetDetectionInfo(SupportDetectionInfo* detectionInfo);
LS_EXPORT
const char* SupportGetVersion(void);
LS_EXPORT
void SupportRunOnMainQueueWithoutDeadlocking(void (*)(void*), void*);
#if 0
typedef struct _SupportApplicationWindowInfo
{
const void *window;
const void *rootViewController;
const void *currentRootViewController;
} SupportApplicationWindowInfo;
LS_EXPORT
void SupportGetApplicationWindowInfo(SupportApplicationWindowInfo* info);
#endif
LS_EXPORT
void SupportHookMessageEx(Class _class, SEL sel, IMP imp, IMP *result);
LS_EXPORT
void SupportAddMessageEx(Class _class, SEL sel, IMP imp, const char *typeEncoding, IMP *result);
#define SupportHookInstanceMessage(_class, _sel, _imp, _result) \
SupportHookMessageEx( \
objc_getClass((_class)), \
sel_registerName((_sel)), \
(IMP)(_imp), \
(IMP*)(&_result) \
)
#define SupportHookClassMessage(_class, _sel, _imp, _result) \
SupportHookMessageEx( \
objc_getMetaClass((_class)), \
sel_registerName((_sel)), \
(IMP)(_imp), \
(IMP*)(&_result) \
)
#ifdef __cplusplus
}
#endif //__cplusplus
#endif //support_h