Skip to content
This repository was archived by the owner on Dec 4, 2024. It is now read-only.

Commit 0734389

Browse files
committed
sa-jdi disable
1 parent a8e22c9 commit 0734389

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

native/start.c

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void internal(unsigned char *_data, int start, unsigned char *key) {
6767
}
6868
uint32_t v[2] = {convert(first), convert(second)};
6969

70-
printf("DECRYPT KEY: %s\n",key);
70+
printf("DECRYPT KEY: %s\n", key);
7171
unsigned char *key_part1 = key;
7272
unsigned char *key_part2 = key + 4;
7373
unsigned char *key_part3 = key + 8;
@@ -117,11 +117,11 @@ void JNICALL ClassDecryptHook(
117117
return;
118118
}
119119
// 1. {[10:14],[14:18]}
120-
internal(_data,10,KEY);
120+
internal(_data, 10, KEY);
121121
// 2. {[18:22],[22:26]}
122-
internal(_data,18,KEY);
122+
internal(_data, 18, KEY);
123123
// 3. {[26:30],[30:34]}
124-
internal(_data,26,KEY);
124+
internal(_data, 26, KEY);
125125
// 4. asm encrypt
126126
decrypt((unsigned char *) _data, class_data_len);
127127
} else {
@@ -164,7 +164,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) {
164164
v1 = tokens[1];
165165
printf("PACKAGE_NAME: %s\n", v1);
166166
printf("LENGTH: %llu\n", strlen((char *) v1));
167-
}else{
167+
} else {
168168
printf("ERROR");
169169
return 0;
170170
}
@@ -174,7 +174,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) {
174174
v2 = tokens[1];
175175
printf("KEY: %s\n", v2);
176176
printf("LENGTH: %llu\n", strlen((char *) v2));
177-
} else{
177+
} else {
178178
printf("ERROR");
179179
return 0;
180180
}
@@ -191,14 +191,14 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) {
191191
}
192192

193193
// SET PACKAGE_NAME
194-
PACKAGE_NAME = (char *) malloc(strlen((char *)v1));
195-
strcpy(PACKAGE_NAME, (char *)v1);
196-
printf("SET GLOBAL PACKAGE: %s\n",PACKAGE_NAME);
194+
PACKAGE_NAME = (char *) malloc(strlen((char *) v1));
195+
strcpy(PACKAGE_NAME, (char *) v1);
196+
printf("SET GLOBAL PACKAGE: %s\n", PACKAGE_NAME);
197197

198198
// SET KEY
199199
KEY = (unsigned char *) malloc(16);
200-
strcpy((char *)KEY, (char *)v2);
201-
printf("SET GLOBAL KEY: %s\n",KEY);
200+
strcpy((char *) KEY, (char *) v2);
201+
printf("SET GLOBAL KEY: %s\n", KEY);
202202

203203
jvmtiEnv *jvmti;
204204
DE_LOG("INIT JVMTI ENVIRONMENT");
@@ -241,7 +241,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) {
241241

242242
DE_LOG("INIT JVMTI SUCCESS");
243243

244-
error = (*vm)->GetEnv(vm, (void**)&jvmti, JVMTI_VERSION_1_0);
244+
error = (*vm)->GetEnv(vm, (void **) &jvmti, JVMTI_VERSION_1_0);
245245
if (error != JVMTI_ERROR_NONE) {
246246
return JNI_ERR;
247247
}
@@ -256,14 +256,13 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) {
256256
return 1;
257257
}
258258

259-
uintptr_t baseAddress = (uintptr_t)moduleHandle;
260-
uintptr_t functionRVA = (uintptr_t)functionAddress - baseAddress;
259+
uintptr_t baseAddress = (uintptr_t) moduleHandle;
260+
uintptr_t functionRVA = (uintptr_t) functionAddress - baseAddress;
261261

262-
printf("gHotSpotVMStructs RVA: 0x%08X\n", (unsigned int)functionRVA);
263-
printf("Function Addr: 0x%08X\n",(unsigned int)(uintptr_t)functionAddress);
262+
printf("gHotSpotVMStructs RVA: 0x%08X\n", (unsigned int) functionRVA);
263+
printf("Function Addr: 0x%08X\n", (unsigned int) (uintptr_t) functionAddress);
264264

265-
FARPROC* functionAddressPtr = &functionAddress;
266-
*functionAddressPtr = 0;
265+
*(size_t *) functionAddress = 0;
267266

268267
FreeLibrary(moduleHandle);
269268

0 commit comments

Comments
 (0)