This commit is contained in:
恍兮惚兮 2024-07-28 01:34:40 +08:00
parent 5ed44c223f
commit 71683851b6
2 changed files with 111 additions and 65 deletions

View File

@ -1,76 +1,111 @@
#include"Jellyfish.h" #include "Jellyfish.h"
bool Jellyfish_attach_function() { bool Jellyfish::Jellyfish_attach_function()
//https://vndb.org/r13456 {
//GREEN秋空のスクリーン STANDARD EDITION // https://vndb.org/r13456
//https://vndb.org/r1136 // GREEN秋空のスクリーン STANDARD EDITION
//LOVERS恋に落ちたら… // https://vndb.org/r1136
// LOVERS恋に落ちたら…
auto ism=GetModuleHandle(L"ism.dll");
if(ism==0)return false;
auto [minaddr,maxaddr]=Util::QueryModuleLimits(ism);
const BYTE bytes[] = { const BYTE bytes[] = {
0x8a,XX,0x01, //mov cl, [ecx+1] 0x8a,
0x80,XX,0x6e, //cmp cl, 6Eh ; 'n' XX,
0x75,XX, 0x01, // mov cl, [ecx+1]
0x80,
XX,
0x6e, // cmp cl, 6Eh ; 'n'
0x75,
XX,
}; };
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), minaddr, maxaddr); ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), minaddr, maxaddr);
if (addr == 0)return false; if (addr == 0)
addr = MemDbg::findEnclosingAlignedFunction(addr,0x1000); return false;
if (addr == 0)return false; addr = MemDbg::findEnclosingAlignedFunction(addr, 0x1000);
if (addr == 0)
return false;
HookParam hp; HookParam hp;
hp.address = addr; hp.address = addr;
hp.offset=get_stack(1); hp.offset = get_stack(1);
hp.type = USING_STRING; hp.type = USING_STRING;
hp.filter_fun=[](LPVOID data, size_t *size, HookParam *){ hp.filter_fun = [](LPVOID data, size_t *size, HookParam *)
if(*size==2)return false; {
StringCharReplacer(reinterpret_cast<char*>(data), size, "\\n", 2, '\n'); if (*size == 2)
StringCharReplacer(reinterpret_cast<char*>(data), size, "\\N", 2, '\n'); return false;
StringCharReplacer(reinterpret_cast<char *>(data), size, "\\n", 2, '\n');
return write_string_overwrite(data,size,std::regex_replace(std::string(reinterpret_cast<char*>(data),*size), std::regex("\\\\[0-7a-zA-Z]"), "")); StringCharReplacer(reinterpret_cast<char *>(data), size, "\\N", 2, '\n');
return write_string_overwrite(data, size, std::regex_replace(std::string(reinterpret_cast<char *>(data), *size), std::regex("\\\\[0-7a-zA-Z]"), ""));
}; };
return NewHook(hp, "Jellyfish"); return NewHook(hp, "Jellyfish");
} }
bool Jellyfish_attach_function2() { bool Jellyfish::Jellyfish_attach_function2()
//https://vndb.org/r109826 {
//Sisters: Last Day of Summer // https://vndb.org/r109826
// Sisters: Last Day of Summer
auto ism=GetModuleHandle(L"ism.dll");
if(ism==0)return false;
auto [minaddr,maxaddr]=Util::QueryModuleLimits(ism);
const BYTE bytes[] = { const BYTE bytes[] = {
0x68,0xB0,0x04,0x00,0x00,0x68,0x40,0x06,0x00,0x00 0x68, 0xB0, 0x04, 0x00, 0x00, 0x68, 0x40, 0x06, 0x00, 0x00};
}; std::map<DWORD, int> count;
std::map<DWORD,int>count; DWORD maxa = 0;
DWORD maxa=0;int maxi=0; int maxi = 0;
for(auto _:Util::SearchMemory(bytes,sizeof(bytes),PAGE_EXECUTE,minaddr,maxaddr)){ for (auto _ : Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, minaddr, maxaddr))
{
_ = findfuncstart(_); _ = findfuncstart(_);
if(_==0)continue; if (_ == 0)
if(count.find(_)==count.end()) continue;
count[_]=0; if (count.find(_) == count.end())
count[_]+=1; count[_] = 0;
if(count[_]>=maxi){ count[_] += 1;
maxi=count[_]; if (count[_] >= maxi)
maxa=_; {
maxi = count[_];
maxa = _;
} }
} }
if (maxa == 0)return false; if (maxa == 0)
return false;
HookParam hp; HookParam hp;
hp.address = maxa;//0x2F2E1+(DWORD)ism; hp.address = maxa; // 0x2F2E1+(DWORD)ism;
hp.type =USING_CHAR|CODEC_UTF16; hp.type = USING_CHAR | CODEC_UTF16;
hp.text_fun=[](hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){ hp.text_fun = [](hook_stack *stack, HookParam *hp, uintptr_t *data, uintptr_t *split, size_t *len)
if(stack->ARG3==3)return; {
*split=(stack->ARG3)!=0;//多行文本 if (stack->ARG3 == 3)
*data=stack->ARG1; return;
*len=2; *split = (stack->ARG3) != 0; // 多行文本
//不可以快进,否则会有重复 *data = stack->ARG1;
*len = 2;
// 不可以快进,否则会有重复
}; };
return NewHook(hp, "Jellyfish"); return NewHook(hp, "Jellyfish");
} }
bool Jellyfish::attach_function(){
return Jellyfish_attach_function()||Jellyfish_attach_function2(); bool Jellyfish::Jellyfish_attach_function3()
{
// https://vndb.org/v2249
// DEEP VOICE
// 不可以快进,否则会有重复
const BYTE bytes[] = {
0x03, 0xd0,
0x81, 0xFA, 0xE0, 0x01, 0x00, 0x00,
0x0f, 0x8f, XX4};
auto addr = MemDbg::findBytes(bytes, sizeof(bytes), minaddr, maxaddr);
if (!addr)
return false;
addr = MemDbg::findEnclosingAlignedFunction(addr);
if (!addr)
return false;
HookParam hp;
hp.address = addr;
hp.offset = get_stack(1);
hp.type = USING_CHAR;
return NewHook(hp, "Jellyfish3");
}
bool Jellyfish::attach_function()
{
std::tie(minaddr, maxaddr) = Util::QueryModuleLimits(ism);
return Jellyfish_attach_function() || Jellyfish_attach_function2() || Jellyfish_attach_function3();
} }

View File

@ -1,13 +1,24 @@
class Jellyfish:public ENGINE{ class Jellyfish : public ENGINE
public: {
Jellyfish(){ public:
HMODULE ism;
is_engine_certain=false; DWORD minaddr, maxaddr;
check_by=CHECK_BY::FILE_ALL; Jellyfish()
check_by_target=check_by_list{L"ism.dll"};//,L"data.isa"}; {
is_engine_certain = false;
check_by = CHECK_BY::CUSTOM;
check_by_target = [this]()
{
ism = GetModuleHandle(L"ism.dll");
return ism;
};
// check_by_list{L"ism.dll"};//,L"data.isa"};
}; };
bool attach_function(); bool attach_function();
bool Jellyfish_attach_function();
bool Jellyfish_attach_function2();
bool Jellyfish_attach_function3();
}; };