s00rk

Encrypter V1.2

Aug 3rd, 2011
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.38 KB | None | 0 0
  1. Imports System.Text
  2. Imports System.IO
  3. Imports System.Windows.Forms.Application
  4. Imports System.Threading
  5. Imports System.Threading.Thread
  6. Public Class Form1
  7. Private carpeta As String = Application.StartupPath
  8. Dim error0 As Boolean = False
  9. Dim renombrados(255) As String
  10. Dim claves As String
  11. Dim Total As Integer = 0
  12. Dim TotalE As Integer = 0
  13. Dim cerrar As Boolean = True
  14. Private Sub listararchivos()
  15. ListBox1.Items.Clear()
  16. claves = ""
  17. Total = 0
  18. For Each Archivo As String In My.Computer.FileSystem.GetFiles(Application.StartupPath, FileIO.SearchOption.SearchAllSubDirectories, "*.mrs")
  19. If checarencripcion(Archivo) = False Then
  20. LabelX1.Text = "Total: " + Total.ToString + " Archivo(s) a Encriptar"
  21. DoEvents()
  22. ListBox1.Items.Add(Archivo)
  23. Total += 1
  24. Else
  25. If TotalE <= 18 Then
  26. claves = claves + "- " + Archivo + Chr(13) + Chr(13)
  27. TotalE += 1
  28. End If
  29. End If
  30. DoEvents()
  31. Next
  32. LabelX1.Text = "Total: " + Total.ToString + " Archivo(s) a Encriptar"
  33. If claves <> "" Or Nuevo = True Then
  34. WarningBox1.Visible = True
  35. Button2.Enabled = False
  36. ElseIf Total = 0 Then
  37. WarningBox1.Visible = False
  38. Button2.Enabled = False
  39. Else
  40. WarningBox1.Visible = False
  41. Button2.Enabled = True
  42. End If
  43. End Sub
  44.  
  45. Private Sub verificar()
  46. If File.Exists("mrse.exe") Then
  47. error0 = False
  48. Else
  49. error0 = True
  50. MsgBox("No se encuentra el mrse.exe de la nueva encripcion", MsgBoxStyle.Critical, "Error")
  51. End If
  52. End Sub
  53.  
  54. Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
  55. If cerrar = True Then
  56. Try
  57. File.Delete("mrs.exe")
  58. File.Delete("zlib.dll")
  59. Catch ex As Exception
  60.  
  61. End Try
  62. Else
  63. e.Cancel = True
  64. End If
  65. End Sub
  66.  
  67. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  68. CheckForIllegalCrossThreadCalls = False
  69. Me.Show()
  70. DoEvents()
  71. Try
  72. If File.Exists("update.bat") Then
  73. File.Delete("update.bat")
  74. End If
  75. CheckUpdate()
  76. Catch ex As Exception
  77. End Try
  78. mThreadFic = New Thread(AddressOf listararchivos)
  79. mThreadFic.Start()
  80. 'listararchivos()
  81. End Sub
  82.  
  83. Private Sub empezar()
  84. Button2.Enabled = False
  85. 'Label2.Text = "Verificando si existe la nueva encrypcion y archivos no encryptados"
  86. verificar()
  87. DoEvents()
  88. If error0 = False Then
  89. ProgressBarX1.Value = 0
  90. Dim mrsz As Byte() = My.Resources.mrs
  91. Dim zlib As Byte() = My.Resources.zlib
  92. File.WriteAllBytes("mrs.exe", mrsz)
  93. File.WriteAllBytes("zlib.dll", zlib)
  94. DoEvents()
  95. renombrar()
  96. DoEvents()
  97. mThreadFic = New Thread(AddressOf decomp)
  98. mThreadFic.Start()
  99. Else
  100. ProgressBarX1.Visible = False
  101. LabelX2.Visible = False
  102. Button2.Visible = True
  103. End If
  104.  
  105. End Sub
  106.  
  107. Private Sub renombrar()
  108. For e = 0 To renombrados.Length - 1
  109. renombrados(e) = ""
  110. Next
  111. For i = 0 To ListBox1.Items.Count - 1
  112. Dim nombre As String = My.Computer.FileSystem.GetName(ListBox1.Items(i).ToString)
  113. Dim nombre0 As String = ListBox1.Items(i).ToString
  114. If InStr(nombre, " ") Then
  115. Dim jj As String = nombre
  116. jj = Replace(jj, " ", "_")
  117. renombrados(i) = (My.Computer.FileSystem.GetParentPath(nombre0) & "\" & jj)
  118. My.Computer.FileSystem.RenameFile(nombre0, jj)
  119. End If
  120. Next
  121. listararchivos()
  122. End Sub
  123. Private eew As New Process
  124. Dim mThreadFic As Thread
  125.  
  126. Private Sub decomp()
  127. My.Computer.FileSystem.CreateDirectory("Decompila")
  128. Dim x, xxx As Integer
  129. xxx = 0
  130. cerrar = False
  131. For i = 0 To ListBox1.Items.Count - 1
  132. LabelX2.Text = "(" + (i + 1).ToString + "/" + Total.ToString + ") - " + ListBox1.Items(i).ToString
  133.  
  134. x = (((i + 1) * 100) / Total)
  135. Dim nombre As String = carpeta + "\Decompila\" & Path.GetFileName(ListBox1.Items(i).ToString)
  136. File.Copy(ListBox1.Items(i).ToString, nombre, True)
  137.  
  138. eew.StartInfo.FileName = ("mrs.exe")
  139. eew.StartInfo.Arguments = ("d " & Label4.Text & nombre & Label4.Text)
  140. eew.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  141. eew.Start()
  142. ListBox1.Focus()
  143. Do While Not Me.eew.HasExited
  144. Sleep(500)
  145. Loop
  146. DoEvents()
  147. comp(nombre, ListBox1.Items(i).ToString)
  148. DoEvents()
  149.  
  150. For xx = xxx To x
  151. ProgressBarX1.Value = xx
  152. Sleep(50)
  153. DoEvents()
  154. Next
  155. xxx = x
  156. DoEvents()
  157. Next
  158. My.Computer.FileSystem.DeleteDirectory("Decompila", FileIO.DeleteDirectoryOption.DeleteAllContents)
  159. DoEvents()
  160. renombrar1()
  161. ProgressBarX1.Value = 100
  162. DoEvents()
  163. cerrar = True
  164. MsgBox("Encryptacion Terminada! ;D", MsgBoxStyle.Information, "Exito")
  165. Sleep(3000)
  166. Button2.Enabled = True
  167. ProgressBarX1.Visible = False
  168. LabelX2.Visible = False
  169. Button2.Visible = True
  170. listararchivos()
  171. End Sub
  172. Private Sub comp(ByVal archivo As String, ByVal lugar As String)
  173. Dim nombre As String = carpeta + "\Decompila\" + Path.GetFileNameWithoutExtension(archivo)
  174. eew.StartInfo.FileName = ("mrse.exe")
  175. eew.StartInfo.Arguments = ("c " & Label4.Text & nombre & Label4.Text)
  176. eew.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
  177. eew.Start()
  178. ListBox1.Focus()
  179. Do While Not Me.eew.HasExited
  180. Sleep(500)
  181. Loop
  182. DoEvents()
  183. File.Copy(archivo, lugar, True)
  184. DoEvents()
  185. File.Delete(archivo)
  186. Directory.Delete(carpeta + "\Decompila\" + Path.GetFileNameWithoutExtension(archivo), True)
  187. End Sub
  188. Private Sub renombrar1()
  189. For i = 0 To renombrados.Length - 1
  190. Dim nombre As String = My.Computer.FileSystem.GetName(renombrados(i).ToString)
  191. Dim nombre0 As String = renombrados(i).ToString
  192. If InStr(nombre, "_") Then
  193. Dim jj As String = nombre
  194. jj = Replace(jj, "_", " ")
  195. My.Computer.FileSystem.RenameFile(nombre0, jj)
  196. End If
  197. Next
  198. End Sub
  199.  
  200. Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
  201. ProgressBarX1.Visible = True
  202. LabelX2.Visible = True
  203. Button2.Visible = False
  204. empezar()
  205. End Sub
  206.  
  207. Private Sub WarningBox1_OptionsClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WarningBox1.OptionsClick
  208.  
  209. If Nuevo = True Then
  210. Dim msg = MsgBox("Existe una nueva actualizacion disponible, con la cual se han agregado y arreglado algunos errores." _
  211. + Chr(13) + "¿Desea Descargarla?", MsgBoxStyle.YesNo, "Actualizacion Disponible: " + My.Application.Info.Version.ToString)
  212. If (msg = MsgBoxResult.Yes) Then
  213. My.Computer.Network.DownloadFile(Url, Application.StartupPath + "\" + My.Application.Info.AssemblyName.ToString + "0.exe", "", "", True, 120000, True)
  214. DoEvents()
  215. Dim a As String = "@echo off" + vbNewLine + "del /f /q " + Label4.Text + Application.ExecutablePath + Label4.Text + _
  216. vbNewLine + "rename " + Label4.Text + My.Application.Info.AssemblyName.ToString + "0.exe" + Label4.Text + _
  217. " " + My.Application.Info.AssemblyName.ToString + ".exe" + vbNewLine + "start " + Label4.Text + _
  218. Application.StartupPath + "\" + Label4.Text + " " + My.Application.Info.AssemblyName.ToString + ".exe"
  219. File.WriteAllText("update.bat", a)
  220. Process.Start(Application.StartupPath + "\update.bat")
  221. Me.Close()
  222. Else
  223. If claves = "" Then
  224. WarningBox1.Visible = False
  225. Button2.Enabled = True
  226. End If
  227. End If
  228. End If
  229.  
  230. If claves <> "" Then
  231.  
  232. Dim msg = MsgBox("Los siguientes archivos al parecer cuentan ya con una encryptacion, asi que estos seran omitidos en el proceso [Maximo muestra 18]" _
  233. + Chr(13) + Chr(13) + claves + Chr(13) + "¿Aun Decea Continuar?", MsgBoxStyle.YesNo, "Aviso Importante")
  234. If (msg = MsgBoxResult.No) Then
  235. Me.Close()
  236. Else
  237. WarningBox1.Visible = False
  238. Button2.Enabled = True
  239. End If
  240.  
  241. End If
  242. End Sub
  243. End Class
Advertisement
Add Comment
Please, Sign In to add comment