Out of curiosity, do you actually have any virus strings yet?
You can read a file bit by bit using a FileStream and BinaryReader:
Just do that for every virus string you have.Code:Dim virus_string() As Byte = {} 'Whatever the virus string is Using fs As New IO.FileStream("location of file to scan", IO.FileMode.Open, IO.FileAccess.Read) Using br As New IO.BinaryReader(fs) Dim found As Boolean = False Do Dim position As Integer = br.BaseStream.Position Dim matchindex As Integer = 0 Dim b As Byte Do b = br.ReadByte() matchindex += 1 If matchindex = virus_string.Length Then 'Found a virus!!! found = True Exit Do End If Loop While virus_string(matchindex-1) = b Loop Until found OrElse br.BaseStream.Position = br.BaseStream.Length If found Then MessageBox.Show("FOUND A VIRUS!") End If br.Close() End Using End Using




Reply With Quote