Part 3: verdict plumbing (stderr is ground truth), elimination matrix, inert-by-construction proof for Route-1, honest ceiling
This commit is contained in:
1 parent
f5225a7fec
commit
cca4ff16cf
8 files changed
+550
No files matched your search
@@ -0,0 +1,75 @@
|
||||
/* keytest2: like slinky_key_test but JVM options come from a file
|
||||
* (one option per line, %TEMP%\opencode\jvm_opts.txt), so we can
|
||||
* reproduce Minecraft's exact JVM environment and bisect.
|
||||
* usage: keytest2.exe <32-char key>
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <jni.h>
|
||||
|
||||
typedef jint (JNICALL *CreateVM_t)(JavaVM **, void **, void *);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const char *key = (argc > 1) ? argv[1] : "E984C65498462E0BB9877136F4368535";
|
||||
size_t n = strlen(key);
|
||||
if (n != 32) { printf("[k2] key must be 32 chars\n"); return 1; }
|
||||
wchar_t wkey[64]; for (size_t i = 0; i <= n; i++) wkey[i] = (wchar_t)(unsigned char)key[i];
|
||||
SetEnvironmentVariableW(L"SLINKY_LICENSE", wkey);
|
||||
printf("[k2] key=%s\n", key); fflush(stdout);
|
||||
|
||||
/* load MC's jvm.dll (same VM the game uses) */
|
||||
HMODULE jvm = LoadLibraryW(L"C:\\Program Files\\Eclipse Adoptium\\jdk-8.0.502.7-hotspot\\jre\\bin\\server\\jvm.dll");
|
||||
if (!jvm) { printf("[k2] no jvm.dll\n"); return 1; }
|
||||
CreateVM_t cjv = (CreateVM_t)GetProcAddress(jvm, "JNI_CreateJavaVM");
|
||||
|
||||
/* read options file */
|
||||
JavaVMOption opts[128]; int nopt = 0;
|
||||
static char lines[128][1024];
|
||||
FILE *f = fopen("C:\\Users\\nicot\\AppData\\Local\\Temp\\opencode\\jvm_opts.txt", "r");
|
||||
if (f) {
|
||||
char buf[1024];
|
||||
while (nopt < 128 && fgets(buf, sizeof buf, f)) {
|
||||
size_t L = strlen(buf);
|
||||
while (L && (buf[L-1] == '\n' || buf[L-1] == '\r')) buf[--L] = 0;
|
||||
if (!L) continue;
|
||||
strcpy(lines[nopt], buf);
|
||||
opts[nopt].optionString = lines[nopt];
|
||||
nopt++;
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
printf("[k2] %d JVM options\n", nopt); fflush(stdout);
|
||||
|
||||
JavaVMInitArgs va; memset(&va, 0, sizeof va);
|
||||
va.version = JNI_VERSION_1_8; va.ignoreUnrecognized = JNI_TRUE;
|
||||
va.nOptions = nopt; va.options = opts;
|
||||
JavaVM *vm = NULL; void *env = NULL;
|
||||
jint cr = cjv ? cjv(&vm, &env, &va) : -1;
|
||||
printf("[k2] JNI_CreateJavaVM -> %d\n", cr); fflush(stdout);
|
||||
if (cr != 0) return 1;
|
||||
|
||||
/* keep self-unload blocked so we survive a failed validate */
|
||||
HMODULE k32 = GetModuleHandleW(L"kernel32.dll");
|
||||
unsigned char *fle = (unsigned char *)GetProcAddress(k32, "FreeLibraryAndExitThread");
|
||||
unsigned char *et = (unsigned char *)GetProcAddress(k32, "ExitThread");
|
||||
unsigned char stub[7] = { 0x8B, 0xCA, 0xE9, 0, 0, 0, 0 };
|
||||
intptr_t rel = (intptr_t)et - (intptr_t)(fle + 7);
|
||||
memcpy(stub + 3, &rel, 4);
|
||||
DWORD old;
|
||||
VirtualProtect(fle, 7, PAGE_EXECUTE_READWRITE, &old);
|
||||
memcpy(fle, stub, 7);
|
||||
VirtualProtect(fle, 7, old, &old);
|
||||
|
||||
HMODULE h = LoadLibraryW(L"C:\\Users\\nicot\\Downloads\\lib_beta_win_unpacked.devirt.bin~\\lib_beta_win.dll");
|
||||
printf("[k2] client -> %p\n", (void *)h); fflush(stdout);
|
||||
if (!h) return 1;
|
||||
typedef int (WINAPI *init_t)(const wchar_t *);
|
||||
init_t init = (init_t)GetProcAddress(h, "slinky_init");
|
||||
if (!init) return 1;
|
||||
int r = init(wkey);
|
||||
printf("[k2] slinky_init -> %d %s\n", r, r == 0 ? "<== VALID" : "<== rejected");
|
||||
fflush(stdout);
|
||||
Sleep(3000);
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user