Como introducir el stub dentro del crypter (Al crearlo)

Iniciado por Christian.tc, 7 Febrero 2010, 18:12 PM

0 Miembros y 1 Visitante están viendo este tema.

Sm0kes

fijate en esto

Put #1,1, Datos()

Trata kmbiandolo a

Put #1, , Datos

y declara Datos as string

Christian.tc

Ya no me sale el error,pero cuando le doy a cifrar,me vuelve a salir al escritorio un Stub de 0 bytes,y lo que se cifra se rompe.


Que es lo que tengo mal?


Lo tengo asi:


Private Sub cmdProteger_Click()
Dim Stub As String, Archivo As String



If txtarchivo.Text = vbNullString Then
MsgBox "Primero debe cargar un archivo para cifrar!", vbExclamation, Me.Caption
Exit Sub
Else


Dim Datos As String

        Datos = LoadResData(101, "CUSTOM")
            Open App.Path & "\Stub.exe" For Binary As #1
                Put #1, 1, Datos
            Close #1                                     
       
Open App.Path & "\Stub.exe" For Binary As #1
Stub = Space(LOF(1))
Get #1, , Stub
Close #1

Open txtarchivo.Text For Binary As #1
Archivo = Space(LOF(1))
Get #1, , Archivo
Close #1



With CD
        .DialogTitle = "Selecione la ruta donde guardar el archivo cifrado!"
        .Filter = "Aplicaciones EXE|*.exe"
        .ShowSave
        End With
       
        If Not CD.FileName = vbNullString Then
       
       
        Archivo = RC4(Archivo, txtkey.Text)..........................


----------------------------------------------------------------------------------------------

Y si lo pongo asi:

Dim Datos As String

Datos = LoadResData(101, "CUSTOM")         
            Open App.Path & "\Stub.exe" For Binary As #1   
                Put #1,1, Datos()                   
            Close #1

Al generar me dice que:
Error de compilacion
se esperaba una matriz

Y me señala Datos en : Put #1,1, Datos()

Christian.tc

#12
Vale,ahora me lo encrypta bien,pero me sigue saliendo al escritorio el Stub.exe y ahora es el mismo que tengo dentro del crypter ,de 16 bytes,

Lo e hecho de estas 2 formas:

-----------------------------------------------------------------------------------
Dim BytesResFile() As Byte

       
       BytesResFile = LoadResData(101, "CUSTOM")

           Open App.Path & "\Stub.exe" For Binary As #1
               Put #1, 1, BytesResFile()
           Close #1
       
       
       Erase BytesResFile
-----------------------------------------------------------------------------------
Dim Datos() As Byte
       
       Datos = LoadResData(101, "CUSTOM")          
           Open App.Path & "\Stub.exe" For Binary As #1  
               Put #1,1, Datos()                    
           Close #1                                    
       
       Erase Datos
-----------------------------------------------------------------------------------
Y me sale el mismo resultado

¿Porque cuando le doy a cifrar para buscar donde guardarlo me sale el Stub.exe al escritorio?

Lo tengo asi:


End Sub

Private Sub cmdProteger_Click()
Dim Stub As String, Archivo As String



If txtarchivo.Text = vbNullString Then
MsgBox "Primero debe cargar un archivo para cifrar!", vbExclamation, Me.Caption
Exit Sub
Else


Dim Datos() As Byte
       
       Datos = LoadResData(101, "CUSTOM")          
           Open App.Path & "\Stub.exe" For Binary As #1  
               Put #1,1, Datos()                    
           Close #1                                    
       
       Erase Datos

Open App.Path & "\Stub.exe" For Binary As #1
Stub = Space(LOF(1))
Get #1, , Stub
Close #1

Open txtarchivo.Text For Binary As #1
Archivo = Space(LOF(1))
Get #1, , Archivo
Close #1



With CD
       .DialogTitle = "Selecione la ruta donde guardar el archivo cifrado!"
       .Filter = "Aplicaciones EXE|*.exe"
       .ShowSave
       End With
       
       If Not CD.FileName = vbNullString Then
       
       
       Archivo = RC4(Archivo, txtkey.Text)..........................
       

Christian.tc

#13
Gracias,ya  encrypta bien y no me sale el Stub al escritorio,ahora voy a provar con EOF

La solucion:

Private Sub cmdProteger_Click()
Dim Stub As String, Archivo As String

If txtarchivo.Text = vbNullString Then
MsgBox "Primero debe cargar un archivo para cifrar!", vbExclamation, Me.Caption
Exit Sub
Else

With CD
       .DialogTitle = "Selecione la ruta donde guardar el archivo cifrado!"
       .Filter = "Aplicaciones EXE|*.exe"
       .ShowSave
       End With
       
       If Not CD.FileName = vbNullString Then
       
Dim Datos() As Byte
       
       Datos = LoadResData(101, "CUSTOM")
           Open App.Path & "\Stub.exe" For Binary As #1
               Put #1, 1, Datos()
           Close #1
       
       Erase Datos
       
Open App.Path & "\Stub.exe" For Binary As #1
Stub = Space(LOF(1))
Get #1, , Stub
Close #1

Open txtarchivo.Text For Binary As #1
Archivo = Space(LOF(1))
Get #1, , Archivo
Close #1
 
       Archivo = RC4(Archivo, txtkey.Text)
       
       Open CD.FileName For Binary As #1
       Put #1, , Stub & "##$$##" & Archivo & "##$$##" & txtkey.Text & "##$$##"
       Close #1
       
       Kill (App.Path & "\stub.exe")
   
       MsgBox "Archivo cifrado Correctamente!", vbInformation, Me.Caption
       End If

End If
End Sub

Christian.tc

#14
Ahora con EOF,me lo encrypta,pero cuando ejecuto lo encryptado me dice:

Stub
Run-time error '9':
Subscript out of range

¿Porque?

Lo tengo asi:

Private Sub Command2_Click()

Dim stub As String

With CD
    .DialogTitle = "Seleccione donde guardar el archivo"
    .Filter = "Aplicaciones EXE|*.exe"
    .ShowSave
End With

If Not CD.FileName = vbNullString Then

Dim Datos() As Byte
Datos = LoadResData(101, "CUSTOM")
            Open App.Path & "\Stub.exe" For Binary As #1
                Put #1, 1, Datos()
            Close #1
       
Open App.Path & "\" & "Stub.exe" For Binary As #1
     stub = Space(LOF(1))
     Get #1, , stub
Close #1

Dim EOF As String

If Check1.Value = 1 Then EOF = ReadEOFData(Text1.Text)

Dim Bin As String

Open Text1.Text For Binary As #1

     Bin = Space(LOF(1))
     Get #1, , Bin
Close #1

Dim RC4 As New clsRC4, xXor As New clsXOR
Dim Encryptacion As String

If Option1.Value = True Then

    Bin = RC4.EncryptString(Bin, Text2.Text)
    Encryptacion = "RC4"
 
End If

If Option2.Value = True Then

    Bin = xXor.EncryptString(Bin, Text2.Text)
    Encryptacion = "XOR"
 
End If

If Option2.Value = True Then

    Bin = xXor.EncryptString(Bin, Text2.Text)
    Encryptacion = "XOR"
 
End If

Open CD.FileName For Binary As #1
    Put #1, , Datos
Close #1

If Check1.Value = 1 Then Call WriteEOFData(CD.FileName, EOF)

Kill (App.Path & "\stub.exe")

End If
End Sub

Christian.tc

Solucionado:
Private Sub Command2_Click()

Dim stub As String

With CD
    .DialogTitle = "Seleccione donde guardar el archivo"
    .Filter = "Aplicaciones EXE|*.exe"
    .ShowSave
End With

If Not CD.FileName = vbNullString Then

Dim BytesResFile() As Byte

BytesResFile = LoadResData(101, "CUSTOM")
Open App.Path & "\Stub.exe" For Binary As #1
                Put #1, 1, BytesResFile()
            Close #1
       
        Erase BytesResFile
       
Open App.Path & "\" & "Stub.exe" For Binary As #1
     stub = Space(LOF(1))
     Get #1, , stub
Close #1

Dim EOF As String

If Check1.Value = 1 Then EOF = ReadEOFData(Text1.Text)

Dim Bin As String

Open Text1.Text For Binary As #1
     Bin = Space(LOF(1))
     Get #1, , Bin
Close #1

Dim RC4 As New clsRC4, xXor As New clsXOR

Dim Encryptacion As String

If Option1.Value = True Then
     Bin = RC4.EncryptString(Bin, Text2.Text)
     Encryptacion = "RC4"
 
End If

If Option2.Value = True Then
     Bin = xXor.EncryptString(Bin, Text2.Text)
     Encryptacion = "XOR"
 
End If

If Option2.Value = True Then
     Bin = xXor.EncryptString(Bin, Text2.Text)
     Encryptacion = "XOR"
 
End If

Dim Datos As String

Datos = stub & "Delimitador" & Bin & "Delimitador" & Encryptacion & "Delimitador" & Text2.Text & "Delimitador"

Open CD.FileName For Binary As #1
     Put #1, , Datos
Close #1

If Check1.Value = 1 Then Call WriteEOFData(CD.FileName, EOF)

Kill (App.Path & "\stub.exe")

End If
End Sub

Christian.tc

Cuando no es una cosa es la otra
Cuando busco donde guardar el archivo que se va a encryptar,y le doy a Cancelar

Porque encrypta el archivo igualmente?...y encima el original

Christian.tc

#17
Arreglado que te quieres morir
El problema estaba en el primer comando:

Private Sub Command1_Click()

With CD
    .DialogTitle = "Seleccione el archivo que desea encryptar"
    .Filter = "Aplicaciones EXE|*.exe"
    .ShowOpen
End With

If Dir(CD.FileName) = vbNullString Then

Text1.Text = CD.FileName

End If
End Sub

Solucionado:
Private Sub Command1_Click()

With CD
    .DialogTitle = "Seleccione el archivo que desea encryptar"
    .Filter = "Aplicaciones EXE|*.exe"
    .ShowOpen
End With

If Dir(CD.FileName) = vbNullString Then Exit Sub

Text1.Text = CD.FileName

End Sub

Private Sub Command2_Click()

Dim stub As String

With CD
    .DialogTitle = "Seleccione donde guardar el archivo"
    .Filter = "Aplicaciones EXE|*.exe"
    .ShowSave
End With

If Dir(CD.FileName) = vbNullString Then
       
Dim BytesResFile() As Byte

BytesResFile = LoadResData(101, "CUSTOM")
Open App.Path & "\Stub.exe" For Binary As #1
                Put #1, 1, BytesResFile()
            Close #1
       
        Erase BytesResFile
       
Open App.Path & "\" & "Stub.exe" For Binary As #1
     stub = Space(LOF(1))
     Get #1, , stub
Close #1

Dim EOF As String

If Check1.Value = 1 Then EOF = ReadEOFData(Text1.Text)

Dim Bin As String

Open Text1.Text For Binary As #1
     Bin = Space(LOF(1))
     Get #1, , Bin
Close #1

Dim RC4 As New clsRC4, xXor As New clsXOR

Dim Encryptacion As String

If Option1.Value = True Then
     Bin = RC4.EncryptString(Bin, Text2.Text)
     Encryptacion = "RC4"
 
End If

If Option2.Value = True Then
     Bin = xXor.EncryptString(Bin, Text2.Text)
     Encryptacion = "XOR"
 
End If

If Option2.Value = True Then
     Bin = xXor.EncryptString(Bin, Text2.Text)
     Encryptacion = "XOR"
 
End If
         
Dim Datos As String

Datos = stub & "Delimitador" & Bin & "Delimitador" & Encryptacion & "Delimitador" & Text2.Text & "Delimitador"

Open CD.FileName For Binary As #1
     Put #1, , Datos
Close #1

If Check1.Value = 1 Then Call WriteEOFData(CD.FileName, EOF)

Kill (App.Path & "\stub.exe")

End If
End Sub