Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET][TUT] Crypter/Decrypter :Txt,Images,Songs,web Page,Exel,Word,Adobe reader!
#1
Tutorial By ThePrinCe


Crypter/Decrypter : .Txt,Images,Songs,web Page,Exel,Word,Adobe reader ..Ect


1.Create a New Project
2.Create A TextBox (1), And Three (3) Buttons
2.1Name First Button (Browse )
2.2Name The Second Button ( Cypt )
2.3Name THe Third Button ( Decrypt )

3.Now We Go To The Codes :
3.1. Import This :
Code:
Imports System.IO
Imports System.Security
Imports System.Security.Cryptography
Imports System.Text

3.2. Add This Codes :
Code:
Sub change()
  Dim sr As StreamReader = New StreamReader(TextBox1.Text, System.Text.Encoding.Default)
  Dim line As String
  line = sr.ReadToEnd.TrimEnd()
  sr.Close()
  Dim sw As New StreamWriter("d:\tmp.tmp", False, System.Text.Encoding.UTF8)
  sw.Write(line)
  sw.Close()
  My.Computer.FileSystem.DeleteFile(TextBox1.Text) '
  My.Computer.FileSystem.CopyFile("d:\tmp.tmp", TextBox1.Text)
  My.Computer.FileSystem.DeleteFile("d:\tmp.tmp")
    End Sub

This Code IS To change From ANSI TO UTF8

3.2.1.
Code:
Sub change_ansi()
  Dim sr As StreamReader = New StreamReader(TextBox1.Text, System.Text.Encoding.UTF8)
  Dim line As String
  line = sr.ReadToEnd.TrimEnd()
  sr.Close()
  Dim sw As New StreamWriter("d:\tmp.tmp", False, System.Text.Encoding.Default)
  sw.Write(line)
  sw.Close()
  My.Computer.FileSystem.DeleteFile(TextBox1.Text) '
  My.Computer.FileSystem.CopyFile("d:\tmp.tmp", TextBox1.Text)
  My.Computer.FileSystem.DeleteFile("d:\tmp.tmp")
    End Sub

This Code Is To 'Change From UTF8 To ANSI

3.2.2.
Code:
Sub krypt() 'krypte les fichiers en DES
  change()
  Dim MyFile As String = "d:\tmp.tmp"
  Dim Key As New DESCryptoServiceProvider
  Key.Key() = Encoding.UTF8.GetBytes("Password")
  Key.IV() = Encoding.UTF8.GetBytes("Password")
  Dim sr As StreamReader = New StreamReader(TextBox1.Text)
  Dim line As String
  line = sr.ReadToEnd.TrimEnd()
  sr.Close()
  EncryptMyFile(line, MyFile, Key.Key, Key.IV)
  My.Computer.FileSystem.DeleteFile(TextBox1.Text) '
  My.Computer.FileSystem.CopyFile(MyFile, TextBox1.Text)
  My.Computer.FileSystem.DeleteFile(MyFile)

    End Sub

3.2.3.
Code:
Sub dekrypt()
  Dim MyFile = TextBox1.Text
  Dim FileDecry As String = "d:\tmp.tmp"
  Dim Key As New DESCryptoServiceProvider()
  Key.Key() = Encoding.UTF8.GetBytes("motpasse")
  Key.IV() = Encoding.UTF8.GetBytes("motpasse")
  Dim Final As String = DecryptMyFile(MyFile, Key.Key, Key.IV)
  Dim sw = New StreamWriter(FileDecry)
  sw.WriteLine(Final)
  sw.Flush()
  sw.Close()
  My.Computer.FileSystem.DeleteFile(MyFile) '
  My.Computer.FileSystem.CopyFile(FileDecry, TextBox1.Text)
  My.Computer.FileSystem.DeleteFile(FileDecry)
  change_ansi()
    End Sub[code]

3.2.4.
[code]  Function EncryptMyFile(ByVal data As String, ByVal MyFile As String, ByVal Key() As Byte, ByVal IV() As Byte) As Byte
  Dim fStream As FileStream = File.Open(MyFile, FileMode.OpenOrCreate)
  Dim cStream As New CryptoStream(fStream, New DESCryptoServiceProvider().CreateEncryptor(Key, IV), CryptoStreamMode.Write)
  Dim write As New StreamWriter(cStream)
  write.WriteLine(data)
  write.Close()
  cStream.Close()
  fStream.Close()

    End Function
    Function DecryptMyFile(ByVal MyFile As String, ByVal Key() As Byte, ByVal IV() As Byte) As String
  On Error Resume Next
  Dim fStream As FileStream = File.Open(MyFile, FileMode.OpenOrCreate)
  Dim cStream As New CryptoStream(fStream, New DESCryptoServiceProvider().CreateDecryptor(Key, IV), CryptoStreamMode.Read)
  Dim sReader As New StreamReader(cStream)
  Dim Value As String = sReader.ReadToEnd.TrimEnd()
  sReader.Close()
  cStream.Close()
  fStream.Close()
  Return Value
    End Function

3.3.Double Click On Crypt and Decrypt And Button1 And Add Those Codes :
Code:
Private Sub crypte_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles crypte.Click
  krypt()
    End Sub

    Private Sub decrypte_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles decrypte.Click
  dekrypt()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  Using o As New OpenFileDialog
    o.Filter = ""
    o.FileName = TextBox1.Text.Trim
    If o.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
    TextBox1.Text = o.FileName
    End If
  End Using
    End Sub

Screeshot :
[Image: Untitled1.gif]
[Image: skyk.png]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to hook the keyboard. [VB.NET] [TuT] Vorfin 92 60,807 09-23-2019, 11:55 AM
Last Post: Jamimartin
  [Source] Deep Freeze Pass Reader for 7.10.020.3176 euverve 6 6,483 01-02-2014, 09:07 PM
Last Post: idrcelab
  [TUT]Creating Advanced Web Browser with Awesome Theme Imaking31 0 1,320 05-25-2013, 03:12 AM
Last Post: Imaking31
  Resize images automatically through vb.net? TalishHF 3 2,393 04-10-2013, 08:43 PM
Last Post: CamilleM
  VB.NET Port Scanner [TUT] Fragma 30 14,413 11-27-2012, 11:26 PM
Last Post: ƃu∀ ıʞƃu∀

Forum Jump:


Users browsing this thread: 1 Guest(s)