寫了個簡單的內聯API鉤子類

2021-06-09 13:46:07 字數 1746 閱讀 2825

class capihook

bool initial(lpvoid lpoldprocaddr, lpvoid lpnewprocaddr)

m_lpoldprocaddr = lpoldprocaddr;

m_lpnewprocaddr = lpnewprocaddr;

#ifdef _win64

m_szjmpcode[0] = 0x48;

m_szjmpcode[1] = 0xb8;

m_szjmpcode[2] = (uchar)(((ulong_ptr)lpnewprocaddr) & 0xff);

m_szjmpcode[3] = (uchar)(((ulong_ptr)lpnewprocaddr >> 8) & 0xff);

m_szjmpcode[4] = (uchar)(((ulong_ptr)lpnewprocaddr >> 16) & 0xff);

m_szjmpcode[5] = (uchar)(((ulong_ptr)lpnewprocaddr >> 24) & 0xff);

m_szjmpcode[6] = (uchar)(((ulong_ptr)lpnewprocaddr >> 32) & 0xff);

m_szjmpcode[7] = (uchar)(((ulong_ptr)lpnewprocaddr >> 40) & 0xff);

m_szjmpcode[8] = (uchar)(((ulong_ptr)lpnewprocaddr >> 48) & 0xff);

m_szjmpcode[9] = (uchar)(((ulong_ptr)lpnewprocaddr >> 56) & 0xff);

m_szjmpcode[10] = 0xff;

m_szjmpcode[11] = 0xe0;

#else

m_szjmpcode[0] = 0x68;

m_szjmpcode[1] = (uchar)(((ulong_ptr)lpnewprocaddr) & 0xff);

m_szjmpcode[2] = (uchar)(((ulong_ptr)lpnewprocaddr >> 8) & 0xff);

m_szjmpcode[3] = (uchar)(((ulong_ptr)lpnewprocaddr >> 16) & 0xff);

m_szjmpcode[4] = (uchar)(((ulong_ptr)lpnewprocaddr >> 24) & 0xff);

m_szjmpcode[5] = 0xc3;

#endif

memcpy(m_szoldcode, m_lpoldprocaddr, sizeof(m_szoldcode));

return true;

} bool hook()

bool unhook()

lpvoid getoldfuncaddr()

lpvoid getnewfuncaddr()

private:

#ifdef _win64

uchar m_szjmpcode[12];

uchar m_szoldcode[12];

#else

uchar m_szjmpcode[6];

uchar m_szoldcode[6];

#endif

lpvoid m_lpoldprocaddr;

lpvoid m_lpnewprocaddr;

};

寫了個賊簡單的爬蟲

import urllib.request import re 內庫 標準庫 import json from bs4 import beautifulsoup url index url html urllib.request.urlopen index url bsobj beautifulso...

簡單的寫了乙個列印Lua Table的函式

簡單的寫了乙個將lua table 列印成json的格式,當然這個函式還是有點bug的,就是不能區分 同時存在陣列和key vlaue,如 local test 會被當做陣列處理,由於專案中沒有匯入json庫,不能使用json.encode 所以自己隨便了乙個,基本上滿足需求,後面也就沒有管了,如果...

寫了乙個簡單實用的PHP模板引擎

php模板引擎很多,但要麼很龐大,要麼效率很低,如果只是要實現php 與程式分離,就只要乙個簡單的模板引擎就行了。今天抽空寫了乙個。xt.class.php created on 2011 10 08 author xyl this is template engine for your site ...