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

Commit ac836f7

Browse files
committed
new windows
1 parent 4242080 commit ac836f7

File tree

8 files changed

+19
-16
lines changed

8 files changed

+19
-16
lines changed

native/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ if (WIN32)
2222
add_custom_target(
2323
native_encrypt_asm ALL
2424
COMMAND ml64 /c /Fo${CMAKE_CURRENT_BINARY_DIR}/native_encrypt_asm.obj
25-
${CMAKE_CURRENT_SOURCE_DIR}/encrypt.asm
25+
${CMAKE_CURRENT_SOURCE_DIR}/encrypt_windows.asm
2626
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/native_encrypt_asm.obj
2727
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
2828
)
2929

3030
add_custom_target(
3131
native_decrypt_asm ALL
3232
COMMAND ml64 /c /Fo${CMAKE_CURRENT_BINARY_DIR}/native_decrypt_asm.obj
33-
${CMAKE_CURRENT_SOURCE_DIR}/decrypt.asm
33+
${CMAKE_CURRENT_SOURCE_DIR}/decrypt_windows.asm
3434
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/native_decrypt_asm.obj
3535
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
3636
)
@@ -51,7 +51,7 @@ if (WIN32)
5151
add_library(
5252
decrypter SHARED
5353
core_de.h
54-
start.c
54+
start_windows.c
5555

5656
xxtea_common.c
5757
xxtea_common.h

native/core_de.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55

66
#define DE_LOG(msg) printf("[JVMTI-LOG] %s\n", msg)
77

8-
// SEE decrypt.asm
8+
// SEE decrypt_windows.asm
99
extern void decrypt(unsigned char *, long);

native/core_en.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55

66
#define EN_LOG(msg) printf("[ENCRYPT] %s\n", msg)
77

8-
// SEE encrypt.asm
8+
// SEE encrypt_windows.asm
99
extern void encrypt(unsigned char *, long);
File renamed without changes.
File renamed without changes.

native/start.c renamed to native/start_windows.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ 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);
7170
unsigned char *key_part1 = key;
7271
unsigned char *key_part2 = key + 4;
7372
unsigned char *key_part3 = key + 8;
@@ -113,16 +112,18 @@ void JNICALL ClassDecryptHook(
113112
for (int i = 0; i < class_data_len; i++) {
114113
_data[i] = class_data[i];
115114
}
116-
if (class_data_len < 34) {
115+
if (class_data_len < 18) {
117116
return;
118117
}
119-
// 1. {[10:14],[14:18]}
120-
internal(_data, 10, KEY);
121-
// 2. {[18:22],[22:26]}
122-
internal(_data, 18, KEY);
123-
// 3. {[26:30],[30:34]}
124-
internal(_data, 26, KEY);
125-
// 4. asm encrypt
118+
119+
DE_LOG("START DECRYPT");
120+
// 1. all xxtea
121+
int total = (class_data_len - 10) / 8;
122+
for (int i = 0; i < total; i++) {
123+
internal(_data, 10 + i * 8, KEY);
124+
}
125+
126+
// 2. asm encrypt
126127
decrypt((unsigned char *) _data, class_data_len);
127128
} else {
128129
for (int i = 0; i < class_data_len; i++) {
@@ -259,12 +260,14 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) {
259260
uintptr_t baseAddress = (uintptr_t) moduleHandle;
260261
uintptr_t functionRVA = (uintptr_t) functionAddress - baseAddress;
261262

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

265266
*(size_t *) functionAddress = 0;
266267

267268
FreeLibrary(moduleHandle);
268269

270+
DE_LOG("HACK JVM FINISH");
271+
269272
return JNI_OK;
270273
}

src/main/resources/decrypter.dll

512 Bytes
Binary file not shown.

src/main/resources/encryptor.dll

512 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)