Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Text
- Imports System.IO
- Imports System.Windows.Forms.Application
- Imports System.Threading
- Imports System.Threading.Thread
- Public Class Form1
- Private carpeta As String = Application.StartupPath
- Dim error0 As Boolean = False
- Dim renombrados(255) As String
- Dim claves As String
- Dim Total As Integer = 0
- Dim TotalE As Integer = 0
- Dim cerrar As Boolean = True
- Private Sub listararchivos()
- ListBox1.Items.Clear()
- claves = ""
- Total = 0
- For Each Archivo As String In My.Computer.FileSystem.GetFiles(Application.StartupPath, FileIO.SearchOption.SearchAllSubDirectories, "*.mrs")
- If checarencripcion(Archivo) = False Then
- LabelX1.Text = "Total: " + Total.ToString + " Archivo(s) a Encriptar"
- DoEvents()
- ListBox1.Items.Add(Archivo)
- Total += 1
- Else
- If TotalE <= 18 Then
- claves = claves + "- " + Archivo + Chr(13) + Chr(13)
- TotalE += 1
- End If
- End If
- DoEvents()
- Next
- LabelX1.Text = "Total: " + Total.ToString + " Archivo(s) a Encriptar"
- If claves <> "" Or Nuevo = True Then
- WarningBox1.Visible = True
- Button2.Enabled = False
- ElseIf Total = 0 Then
- WarningBox1.Visible = False
- Button2.Enabled = False
- Else
- WarningBox1.Visible = False
- Button2.Enabled = True
- End If
- End Sub
- Private Sub verificar()
- If File.Exists("mrse.exe") Then
- error0 = False
- Else
- error0 = True
- MsgBox("No se encuentra el mrse.exe de la nueva encripcion", MsgBoxStyle.Critical, "Error")
- End If
- End Sub
- Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
- If cerrar = True Then
- Try
- File.Delete("mrs.exe")
- File.Delete("zlib.dll")
- Catch ex As Exception
- End Try
- Else
- e.Cancel = True
- End If
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- CheckForIllegalCrossThreadCalls = False
- Me.Show()
- DoEvents()
- Try
- If File.Exists("update.bat") Then
- File.Delete("update.bat")
- End If
- CheckUpdate()
- Catch ex As Exception
- End Try
- mThreadFic = New Thread(AddressOf listararchivos)
- mThreadFic.Start()
- 'listararchivos()
- End Sub
- Private Sub empezar()
- Button2.Enabled = False
- 'Label2.Text = "Verificando si existe la nueva encrypcion y archivos no encryptados"
- verificar()
- DoEvents()
- If error0 = False Then
- ProgressBarX1.Value = 0
- Dim mrsz As Byte() = My.Resources.mrs
- Dim zlib As Byte() = My.Resources.zlib
- File.WriteAllBytes("mrs.exe", mrsz)
- File.WriteAllBytes("zlib.dll", zlib)
- DoEvents()
- renombrar()
- DoEvents()
- mThreadFic = New Thread(AddressOf decomp)
- mThreadFic.Start()
- Else
- ProgressBarX1.Visible = False
- LabelX2.Visible = False
- Button2.Visible = True
- End If
- End Sub
- Private Sub renombrar()
- For e = 0 To renombrados.Length - 1
- renombrados(e) = ""
- Next
- For i = 0 To ListBox1.Items.Count - 1
- Dim nombre As String = My.Computer.FileSystem.GetName(ListBox1.Items(i).ToString)
- Dim nombre0 As String = ListBox1.Items(i).ToString
- If InStr(nombre, " ") Then
- Dim jj As String = nombre
- jj = Replace(jj, " ", "_")
- renombrados(i) = (My.Computer.FileSystem.GetParentPath(nombre0) & "\" & jj)
- My.Computer.FileSystem.RenameFile(nombre0, jj)
- End If
- Next
- listararchivos()
- End Sub
- Private eew As New Process
- Dim mThreadFic As Thread
- Private Sub decomp()
- My.Computer.FileSystem.CreateDirectory("Decompila")
- Dim x, xxx As Integer
- xxx = 0
- cerrar = False
- For i = 0 To ListBox1.Items.Count - 1
- LabelX2.Text = "(" + (i + 1).ToString + "/" + Total.ToString + ") - " + ListBox1.Items(i).ToString
- x = (((i + 1) * 100) / Total)
- Dim nombre As String = carpeta + "\Decompila\" & Path.GetFileName(ListBox1.Items(i).ToString)
- File.Copy(ListBox1.Items(i).ToString, nombre, True)
- eew.StartInfo.FileName = ("mrs.exe")
- eew.StartInfo.Arguments = ("d " & Label4.Text & nombre & Label4.Text)
- eew.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
- eew.Start()
- ListBox1.Focus()
- Do While Not Me.eew.HasExited
- Sleep(500)
- Loop
- DoEvents()
- comp(nombre, ListBox1.Items(i).ToString)
- DoEvents()
- For xx = xxx To x
- ProgressBarX1.Value = xx
- Sleep(50)
- DoEvents()
- Next
- xxx = x
- DoEvents()
- Next
- My.Computer.FileSystem.DeleteDirectory("Decompila", FileIO.DeleteDirectoryOption.DeleteAllContents)
- DoEvents()
- renombrar1()
- ProgressBarX1.Value = 100
- DoEvents()
- cerrar = True
- MsgBox("Encryptacion Terminada! ;D", MsgBoxStyle.Information, "Exito")
- Sleep(3000)
- Button2.Enabled = True
- ProgressBarX1.Visible = False
- LabelX2.Visible = False
- Button2.Visible = True
- listararchivos()
- End Sub
- Private Sub comp(ByVal archivo As String, ByVal lugar As String)
- Dim nombre As String = carpeta + "\Decompila\" + Path.GetFileNameWithoutExtension(archivo)
- eew.StartInfo.FileName = ("mrse.exe")
- eew.StartInfo.Arguments = ("c " & Label4.Text & nombre & Label4.Text)
- eew.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
- eew.Start()
- ListBox1.Focus()
- Do While Not Me.eew.HasExited
- Sleep(500)
- Loop
- DoEvents()
- File.Copy(archivo, lugar, True)
- DoEvents()
- File.Delete(archivo)
- Directory.Delete(carpeta + "\Decompila\" + Path.GetFileNameWithoutExtension(archivo), True)
- End Sub
- Private Sub renombrar1()
- For i = 0 To renombrados.Length - 1
- Dim nombre As String = My.Computer.FileSystem.GetName(renombrados(i).ToString)
- Dim nombre0 As String = renombrados(i).ToString
- If InStr(nombre, "_") Then
- Dim jj As String = nombre
- jj = Replace(jj, "_", " ")
- My.Computer.FileSystem.RenameFile(nombre0, jj)
- End If
- Next
- End Sub
- Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
- ProgressBarX1.Visible = True
- LabelX2.Visible = True
- Button2.Visible = False
- empezar()
- End Sub
- Private Sub WarningBox1_OptionsClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WarningBox1.OptionsClick
- If Nuevo = True Then
- Dim msg = MsgBox("Existe una nueva actualizacion disponible, con la cual se han agregado y arreglado algunos errores." _
- + Chr(13) + "¿Desea Descargarla?", MsgBoxStyle.YesNo, "Actualizacion Disponible: " + My.Application.Info.Version.ToString)
- If (msg = MsgBoxResult.Yes) Then
- My.Computer.Network.DownloadFile(Url, Application.StartupPath + "\" + My.Application.Info.AssemblyName.ToString + "0.exe", "", "", True, 120000, True)
- DoEvents()
- Dim a As String = "@echo off" + vbNewLine + "del /f /q " + Label4.Text + Application.ExecutablePath + Label4.Text + _
- vbNewLine + "rename " + Label4.Text + My.Application.Info.AssemblyName.ToString + "0.exe" + Label4.Text + _
- " " + My.Application.Info.AssemblyName.ToString + ".exe" + vbNewLine + "start " + Label4.Text + _
- Application.StartupPath + "\" + Label4.Text + " " + My.Application.Info.AssemblyName.ToString + ".exe"
- File.WriteAllText("update.bat", a)
- Process.Start(Application.StartupPath + "\update.bat")
- Me.Close()
- Else
- If claves = "" Then
- WarningBox1.Visible = False
- Button2.Enabled = True
- End If
- End If
- End If
- If claves <> "" Then
- Dim msg = MsgBox("Los siguientes archivos al parecer cuentan ya con una encryptacion, asi que estos seran omitidos en el proceso [Maximo muestra 18]" _
- + Chr(13) + Chr(13) + claves + Chr(13) + "¿Aun Decea Continuar?", MsgBoxStyle.YesNo, "Aviso Importante")
- If (msg = MsgBoxResult.No) Then
- Me.Close()
- Else
- WarningBox1.Visible = False
- Button2.Enabled = True
- End If
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment