|
-
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
-
Sep 19th, 2011, 06:27 PM
#2
Hyperactive Member
Re: Help with "I am Crypter"
Try this.
vb Code:
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
-
Sep 19th, 2011, 11:36 PM
#3
Thread Starter
New Member
Re: Help with "I am Crypter"
that helped, but I'm now getting another error
Code:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.IO.IOException: The file 'I:\Users\noah\Desktop\Buts.exe' already exists.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
at I_am_Crypter.Form1.Crypt_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4961 (win7RTMGDR.050727-4900)
CodeBase: file:///I:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
I am Crypter
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///I:/Users/noah/Desktop/I%20am%20Crypter.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///I:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4962 (win7RTMGDR.050727-4900)
CodeBase: file:///I:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4961 (win7RTMGDR.050727-4900)
CodeBase: file:///I:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///I:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///I:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Code:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.IO.FileNotFoundException: Could not find file 'I:\Users\noah\Desktop\Buts.exe'.
File name: 'I:\Users\noah\Desktop\Buts.exe'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
at I_am_Crypter.Form1.Crypt_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4961 (win7RTMGDR.050727-4900)
CodeBase: file:///I:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
I am Crypter
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///I:/Users/noah/Desktop/I%20am%20Crypter.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///I:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4962 (win7RTMGDR.050727-4900)
CodeBase: file:///I:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4961 (win7RTMGDR.050727-4900)
CodeBase: file:///I:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///I:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///I:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
-
Sep 20th, 2011, 05:06 AM
#4
Banned
Re: Help with "I am Crypter"
which line fire up the error ?
-
Sep 20th, 2011, 10:05 AM
#5
Thread Starter
New Member
Re: Help with "I am Crypter"
I get the error after compiling the data
-
Sep 20th, 2011, 10:25 AM
#6
Re: Help with "I am Crypter"
Code:
System.IO.FileNotFoundException: Could not find file 'I:\Users\noah\Desktop\Buts.exe'.
There is your problem
-
Sep 20th, 2011, 10:30 AM
#7
Thread Starter
New Member
Re: Help with "I am Crypter"
 Originally Posted by BlindSniper
Code:
System.IO.FileNotFoundException: Could not find file 'I:\Users\noah\Desktop\Buts.exe'.
There is your problem
In the first code block it says buts already exist. There are two errors.
-
Sep 20th, 2011, 08:40 PM
#8
Re: Help with "I am Crypter"
Code:
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" '<--- variable Buts
Dim TheEOF As String
'''
'''
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) '<--- variable Buts
'''
'''
End Class
I'm guessing you compiled the project, copied the .exe to the Desktop along with the file Buts.exe.
Then when you ran the app and clicked on your Crypt button you got the first error?
If so, you're trying to copy a file onto itself and getting a File Already Exists error.
Then you deleted the Buts.exe file from the Desktop and ran the Application's .exe again?
That would give the second error: File Not Found error.
-
Sep 20th, 2011, 09:20 PM
#9
Thread Starter
New Member
Re: Help with "I am Crypter"
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
|