Hack Forums
[.NET] [VB.NET] How to add EOF support [TUT] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [VB.NET] How to add EOF support [TUT] (/showthread.php?tid=415206)

Pages: Pages 1 2 3


[VB.NET] How to add EOF support [TUT] - xSilent - May 11, 2010

I posted the functions, but I didn't show how to use them.


First make a string called TheEOF or whatever under your form name example:

Code
Public Class Form1
    Dim TheEOF As String
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

Once you've done that add this read EOF function (We'll be writing it a different way)

Code
Public Function ReadEOFData(ByRef FilePath As String) As String
        Dim EOFBuf As String
        Dim lPos As Integer
        If Dir(FilePath) = "" Then
            Exit Function
        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

I modified my function from VB6 to look more like VB.NET so some of you won't complain about it

Now in your file open dialog, after the file has been opened add this

Code
TheEOF = ReadEOFData(OFD.Filename)

Now at the end of your sub when the file is crypted add this

Code
If TheEOF = Nothing then
Messagebox.Show("File Crypted!")
Else
IO.File.AppendAllText(OFD.Filename, TheEOF)
MessageBox.Show("File Crypted With EOF!")
End If

That is how you use well any EOF function

This should help any beginner coding a crypter in vb.net or C# (Just convert it)


* - xSilent - May 11, 2010

*NOTE* Only write EOF after everything else was written to the stub *NOTE*


* - iRtehLeet™ - May 11, 2010

Finally, we needed a thread like this for the noobs that can't put together your old thread.

Rating added :)


* - Bitwin - May 11, 2010

Thanks, great tutorial. I thought about writing it myself after you explaining it to me but I didn't do it :p


* - xSilent - May 11, 2010

52 views and only 2 comments, really.


* - Jeck - May 11, 2010

This seems simple but I don't know how to declare it correctly. Incorrect when OFD is declared. Hehe...

[IMG]http://i39.[censored].com/2r782ex.jpg[/IMG]

Thanks for the share. =p


* - Threadlocks - May 11, 2010

oFd is open file Diangnol


* - xSilent - May 11, 2010

(May 11, 2010 06:34 PM)mulot Wrote:  This seems simple but I don't know how to declare it correctly. Incorrect when OFD is declared. Hehe...

[IMG]http://i39.[censored].com/2r782ex.jpg[/IMG]

Thanks for the share. =p

I'm not even going to answer this, this proves that your trying to rip this code


* - Threadlocks - May 11, 2010

i got a error .. i pm you


five star added + rep added sended a pm


* - krayon - May 11, 2010

Good job killerpanther, I haven't tried this out yet but im sure it will come in handy ;)


* - Jeck - May 11, 2010

(May 11, 2010 07:05 PM)xKillerxPanther Wrote:  I'm not even going to answer this, this proves that your trying to rip this code

Ok. Nevermind, I will try to figure it out myself. 😁
Just experimenting some codes eventhough I'm noob in .net.

Btw, thanks.


* - Threadlocks - May 11, 2010

it worked on command.com which have EOF support it work like charm thanks aloat


* - jhouns - May 17, 2010

Thanks for this man you just saved my life :) now to trawl through the code line by line char by char xD


* - codepoet - May 17, 2010

Thanks man we really needed a tutorial on this.

-crow407


* - Toxic Asshole - May 17, 2010

Coding looks a little fualty can cuase an error.