zoukankan      html  css  js  c++  java
  • C语言-郝斌笔记-002病毒程序示范

    病毒程序示范

     1 /*
     2 龌龊的程序!
     3 */
     4 # include <stdio.h>
     5 # include <windows.h>
     6 # include <malloc.h>
     7 #include<cstdlib>
     8 
     9 int main(void)
    10 {
    11     int c;
    12     int i;
    13     int j;
    14 
    15     Nihao:
    16     printf("1:死机
    ");
    17     printf("2:机房爆炸
    ");
    18     printf("请选择:
    ");
    19 
    20     scanf("%d,&c");
    21 
    22     if  (c ==1)
    23     {
    24         system("shutdown -s -t 60");
    25     }
    26     else if (2 == c)
    27     {
    28         printf("你太坏了 我要惩罚你!
    ");
    29         for (j=0;j<10;++j){
    30             system("start");
    31         }
    32     }
    33     else
    34     {
    35         printf("你敲错了,请重新输入!
    ");
    36         goto Nihao;
    37     }
    38     return 0;
    39 }

    内存泄露(占满内存)程序导致死机实例

    1 #include < stdio.h > #include < malloc.h >
    2 
    3     int main(void) {
    4         while (1) {
    5             int * p = (int * ) malloc(1000);
    6         }
    7         return 0;
    8     }
  • 相关阅读:
    nginx编译安装
    使用scp命令,不同服务器之间拷备文件
    cpu负载过高排查与解决
    Docker安装
    sftp安装
    nginx登陆验证 [done]
    git常用命令
    python常见问题记录
    升级openssl
    rsync使用
  • 原文地址:https://www.cnblogs.com/shamgod/p/5392888.html
Copyright © 2011-2022 走看看