Oct 17, 2013 08:26 PM
(This post was last modified: Oct 17, 2013 08:31 PM by Tyler777.)
Today's Lesson will be about how to make a platformed Cryptor that is FUD using AES encryption methods. Please type all codes. (there are some bugs that may cause file corruption)
You need the following
Now that you have the Items you need to start lets begin.
You will need to add the following to Window1 of your Project!
BevelButton1 Should say Crypt
BevelButton2 Should say Instructions
BevelButton3 Should say Generate
Label1 Should say Executable: or File:
Label2 Should say Key:
TextField1 Should say test.exe
TextField2 Should Say Encrypt Key
Once your done the GUI should look like this
[img]http://s7.postimg.org/cynj8ykuz/Crypter_Window.png[/img]
Congratulations!! you just finished the GUI!!!! Now lets get to writing our code!
We start buy setting up our methods and properties that will be called upon in other areas of the program!
Your 1st Method will be DecryptAES
Your 2nd Method will be EncryptAES
Your 3rd Method will be NewAES
Your last Method will be RandStr
We have now set up all the methods and properties needed for this program to function now we need to make the GUI work. Let us Continue...
We will start with BevelButton1
Now we move on to BevelButton2 (This will bring up your second window! I will cover how to make this window later on in the Tutorial!)
Now to BevelButton3
Now that the Application will work we will finish by making the Instructions Window! That BevelButton2 Reveals
You need to Add a TextArea to the Window and a BevelButton!
Your Window should look like this...
[img]http://s9.postimg.org/91ndf6fz3/Window_2.png[/img]
You will need to add this code to your Close BevelButton
This Concludes my Tutorial I hope this enlightens people on coding a Crypter for Mac/Linux/Windows Operating Systems! Remember this is BASIC, However the Tutorial is for more Intermediate Coders.
You need the following
- RealBASIC or RealSTUDIO or XOJO (Realbasic.com)
- MonkeyBread Plugins (monkeybreadsoftware.de)
- Plugin Downloads
- [img]http://www.monkeybreadsoftware.de/realbasic/images/apple.png[/img]Mac OS X
- [img]http://www.monkeybreadsoftware.de/realbasic/images/windows.png[/img]Windows
- [img]http://www.monkeybreadsoftware.de/realbasic/images/linux.png[/img]Linux
- Plugin Downloads
Now that you have the Items you need to start lets begin.
You will need to add the following to Window1 of your Project!
- 2x Label
- 2x TextField
- 3x Bevel Button
BevelButton1 Should say Crypt
BevelButton2 Should say Instructions
BevelButton3 Should say Generate
Label1 Should say Executable: or File:
Label2 Should say Key:
TextField1 Should say test.exe
TextField2 Should Say Encrypt Key
Once your done the GUI should look like this
[img]http://s7.postimg.org/cynj8ykuz/Crypter_Window.png[/img]
Congratulations!! you just finished the GUI!!!! Now lets get to writing our code!
We start buy setting up our methods and properties that will be called upon in other areas of the program!
Your 1st Method will be DecryptAES
- Method Name: DecryptAES
- Parameters: key as string, sourcefile as FolderItem, destfile as FolderItem
- Return Type: Boolean
Code
// decrypt file with AES and CFB
dim a as AESMBS = NewAES(key)
if a = nil then Return false
dim bi as BinaryStream = sourcefile.OpenAsBinaryFile(false)
if bi = nil then Return false
dim bo as BinaryStream = destfile.CreateBinaryFile("")
if bo = nil then Return false
dim IVectorOffset as integer = 0
dim IVector as new MemoryBlock(16)
dim data as string = bi.Read(100)
while lenb(data)>0
dim idata as MemoryBlock = data
a.DecryptCFB(idata, lenb(data), IVectorOffset, IVector, nil, 0, 0)
bo.Write idata
data = bi.Read(100)
wend
bo.Close
bi.Close
Return true
// exception handler for newer Real Studio version
'Exception io as ioexception
if bo<>nil then
destfile.Delete
end ifYour 2nd Method will be EncryptAES
- Method Name: EncryptAES
- Parameters: key as string, sourcefile as FolderItem, destfile as FolderItem
- Return Type: Boolean
Code
// encrypt file with AES and CFB
dim a as AESMBS = NewAES(key)
if a = nil then Return false
dim bi as BinaryStream = sourcefile.OpenAsBinaryFile(false)
if bi = nil then Return false
dim bo as BinaryStream = destfile.CreateBinaryFile("")
if bo = nil then Return false
dim IVectorOffset as integer = 0
dim IVector as new MemoryBlock(16)
dim data as string = bi.Read(100)
while lenb(data)>0
dim idata as MemoryBlock = data
a.EncryptCFB(idata, lenb(data), IVectorOffset, IVector, nil, 0, 0)
bo.Write idata
data = bi.Read(100)
wend
bo.Close
bi.Close
Return true
// exception handler for newer Real Studio version
'Exception io as ioexception
if bo<>nil then
destfile.Delete
end ifYour 3rd Method will be NewAES
- Method Name: NewAES
- Parameters: key as string
- Return Type: AESMBS
Code
dim a as new AESMBS
// all keys should be UTF-8
key = ConvertEncoding(key, encodings.UTF8)
dim bits as integer = 0
dim l as integer = lenb(key)
// pad key to required length for 16, 24 or 32 bit key
if l>32 then
key = leftb(key,32)
elseif l>24 then
while lenb(key)<32
key = key + " "
wend
elseif l>16 then
while lenb(key)<24
key = key + " "
wend
else
while lenb(key)<16
key = key + " "
wend
end if
if a.SetKey(key) then
Return a
end ifYour last Method will be RandStr
- Method Name: RandStr
- Parameters: ranlen As Integer, nmb As Boolean, lcs As Boolean, ucs As Boolean, smb As Boolean
- Return Type: String
Code
Dim source As String = ""
if nmb = True then source = source + "1234567890"
if lcs = True then source = source + "abcdefghijklmnopqrstuvwxyz"
if ucs = True then source = source + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
if smb = True then source = source + "|@#~$%()=^*+[]{}-_"
Dim chrstr,num As String
Dim NumChar,start,i As Integer
NumChar = source.Len( )
for i = 1 To ranlen
Dim r as New Random
start = r.InRange( 1, NumChar )
num = source.Mid( start, 1 )
chrstr = chrstr + num
Next
return chrstrWe have now set up all the methods and properties needed for this program to function now we need to make the GUI work. Let us Continue...
We will start with BevelButton1
Code
dim key as string = TextField2.text
dim sourceFile as FolderItem = SpecialFolder.Desktop.Child(""+ TextField1.text +"")
dim encryptedFile as FolderItem = SpecialFolder.Desktop.Child("Crypted.exe")
dim decryptedFile as FolderItem = SpecialFolder.Desktop.Child(""+ TextField2.text +"")
if sourceFile.Exists = false then
MsgBox "Please add the file to your desktop."
end if
if EncryptAES(key, sourceFile, encryptedFile) then
if DecryptAES(key, encryptedFile, decryptedFile) then
MsgBox "OK"
decryptedFile.Launch
else
MsgBox "Failed to decrypt."
end if
else
MsgBox "Failed to encrypt."
end ifNow we move on to BevelButton2 (This will bring up your second window! I will cover how to make this window later on in the Tutorial!)
Code
Window2.showNow to BevelButton3
Code
TextField2.Text = RandStr(15, True, True, True, True)Now that the Application will work we will finish by making the Instructions Window! That BevelButton2 Reveals
You need to Add a TextArea to the Window and a BevelButton!
Your Window should look like this...
[img]http://s9.postimg.org/91ndf6fz3/Window_2.png[/img]
You will need to add this code to your Close BevelButton
Code
window2.hideThis Concludes my Tutorial I hope this enlightens people on coding a Crypter for Mac/Linux/Windows Operating Systems! Remember this is BASIC, However the Tutorial is for more Intermediate Coders.


![[Image: 3QQXuOY.png]](https://i.imgur.com/3QQXuOY.png)
