Created
January 15, 2025 03:32
-
-
Save 0xlane/00e2749be0e7df34fa931715bf2958c3 to your computer and use it in GitHub Desktop.
Calculate typora IV by calling main.node.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <iostream> | |
#include <iomanip> | |
typedef int64_t(*FunctionPtr)(int64_t* array, int64_t p2, int64_t p3); | |
int main() { | |
HMODULE hModule = LoadLibrary(L"./main.node"); | |
DWORD_PTR baseAddress = (DWORD_PTR)hModule; | |
DWORD_PTR functionOffset = 0x1992; | |
DWORD_PTR functionAddress = baseAddress + functionOffset; | |
FunctionPtr func = (FunctionPtr)functionAddress; | |
if (!func) { | |
std::cerr << "无法获取函数指针" << std::endl; | |
FreeLibrary(hModule); | |
return 1; | |
} | |
const int64_t arrayLength = 3; | |
int64_t inputArray[arrayLength] = { 0,0 ,0 }; | |
int64_t len = 139969; | |
int64_t param3 = 0x10; | |
byte last_byte = 0xb7; | |
int64_t result = func(inputArray, (len % 256) ^ last_byte, 0x10); | |
byte* res = (byte*)(inputArray[0]); | |
for (size_t i = 0; i < 16; i++) | |
{ | |
std::cout << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(res[i]); | |
} | |
FreeLibrary(hModule); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment