先說一哈 其實這個 惡意程序 大部分都是參考了 網上的資料 也就是說====
我這裏代碼都是 網上能找到的 出現了好長時間的代碼 沒有什麼創新性===
so 還請大佬們繞道了==
先說一下程序的大概情況===
其實 程序外表就是一個掃雷的輔助工具==
具體的原理可以參考
https://blog.csdn.net/qq_41071646/article/details/84920382
然後在程序初始化的時候 開啓了四個線程
其中 有個主線程是 輔助還有鍵盤記錄器
鍵盤記錄器是一個很久的東西了 簡單來說 有兩個方法
鉤子 或者 就是 創建設備
這裏參考了 《Windows黑客編程技術詳解》 裏面的代碼
(這本書 剛出我就買了 == 當時還沒有人說是一本圈錢書===== 算是我買的書裏面最。。。。。可惜的)
然後在消息機制裏面 調用 函數
然後 繼續說一下四個線程都幹了什麼
其中一個是 進行截圖 其實這個沒有啥用 算是我亂湊的===
主要的實現代碼
然後 有個是遍歷文件夾
然後就可以輸出到文件==
文件監控
然後獲取本機TIM 和WX的信息
其中有三個函數 ==
wchar_t * UTF8ToUnicode(const char* str)
{
int textlen = 0;
wchar_t * result;
textlen = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
result = (wchar_t *)malloc((textlen + 1) * sizeof(wchar_t));
memset(result, 0, (textlen + 1) * sizeof(wchar_t));
MultiByteToWideChar(CP_UTF8, 0, str, -1, (LPWSTR)result, textlen);
return result;
}
DWORD process_get_module_base_address(DWORD process_id, TCHAR* dll_name)
{
HANDLE hSnap; // Process snapshot handle.
MODULEENTRY32 xModule; // Module information structure.
hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, process_id); // Creates a module
if (hSnap == INVALID_HANDLE_VALUE) {
return 0;
}
// snapshot of the
// game process.
xModule.dwSize = sizeof(MODULEENTRY32); // Needed for Module32First/Next to work.
int count = 0;
if (Module32First(hSnap, &xModule)) // Gets the first module.
{
do {
if (lstrcmp(xModule.szModule, dll_name) == 0) // If this is the module we want...
{
//printf("%s %s\n", xModule.szModule,dll_name);
//printf("%x\n", xModule.modBaseAddr);
return (DWORD)xModule.modBaseAddr; // return the base address.
}
count++;
} while (Module32Next(hSnap, &xModule)); // Loops through the rest of the modules.
}
CloseHandle(hSnap); // Free the handle.
return 0; // If the result of the function is 0, it didn't find the base address.
}
DWORD GetProcessIDByName(LPCTSTR szProcessName)
{
STARTUPINFO st;
PROCESS_INFORMATION pi;
PROCESSENTRY32 ps;
HANDLE hSnapshot;
DWORD dwPID;
ZeroMemory(&st, sizeof(STARTUPINFO));
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
st.cb = sizeof(STARTUPINFO);
ZeroMemory(&ps, sizeof(PROCESSENTRY32));
ps.dwSize = sizeof(PROCESSENTRY32);
// 遍歷進程
hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot == INVALID_HANDLE_VALUE)
{
return 0;
}
if (!Process32First(hSnapshot, &ps))
{
return 0;
}
do
{
// 比較進程名
if (lstrcmpi(ps.szExeFile, szProcessName) == 0)
{
// 找到了
dwPID = ps.th32ProcessID;
CloseHandle(hSnapshot);
return dwPID;
}
} while (Process32Next(hSnapshot, &ps));
// 沒有找到
CloseHandle(hSnapshot);
return 0;
}
這裏的偏移 需要自己找 版本不一樣=== 偏移也不會一樣- 用CE直接搜就可以===
這裏的代碼就不放出來了==== 大部分都借鑑了別人的代碼 而且百度也能搜得到===
感覺東西很淺顯==== 根本就做不了事情 == 估計惡意都稱不上====
這都是 爛到大街上的代碼 === 感覺還是有必要聲明一哈
此博客只做技術交流而作 若用作其它用途 與本人無關----
參考資料
《Windows黑客編程技術詳解》