VB newbie here.. Anyone willing to offer some help???
Hey there... I'm using vb 2010, but i cant find i section for it... just get an admin to move it or something. Anyways, I caught on to the code quite quickly... I'm kind of a geek :p lol So I'm trying to make an Anti-Virus EXCEPT for one problem... I'm not sure what code to enter for a hard drive scan.... I need it to scan hard drive files and look for certain code strings in the files. I just need the code for the scan. I set up a little button and I'm trying to find a code for this but I can't... :blush: lol [Edited by MartinLiss]I just need a code to search the files for certain strings but i will insert the strings into it later..
HELP! :lol:
Re: VB newbie here.. Anyone willing to offer some help???
Hi and welcome to the forum.
You are correct that you misplaced the thread, but dont worry about it, mods will move it to the .Net section.
Regarding your question, see if this helps http://msdn.microsoft.com/en-us/libr...y4(VS.71).aspx
Re: VB newbie here.. Anyone willing to offer some help???
haha thx that looks useful :)
Re: VB newbie here.. Anyone willing to offer some help???
Moved. And BTW please watch the language.
Re: VB newbie here.. Anyone willing to offer some help???
Out of curiosity, do you actually have any virus strings yet?
You can read a file bit by bit using a FileStream and BinaryReader:
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
Just do that for every virus string you have.
Re: VB newbie here.. Anyone willing to offer some help???
Re: VB newbie here.. Anyone willing to offer some help???
Quote:
Originally Posted by
MartinLiss
Moved. And btw please watch the language.
Thx. [Edited by MartinLiss]
Re: VB newbie here.. Anyone willing to offer some help???
Quote:
Originally Posted by
minitech
Out of curiosity, do you actually have any virus strings yet?
You can read a file bit by bit using a FileStream and BinaryReader:
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
Just do that for every virus string you have.
Yes yes... i need to start putting my virus strings in that.
Re: VB newbie here.. Anyone willing to offer some help???
Quote:
Originally Posted by
LeonOar
Thx. [Edited by MartinLiss]
OK WHAT THE HECK WAS CENSORED THAT TIME???? I DON'T EVEN REMEBER PUTTING ANYMORE THEN THX IN THAT!
I am beginning to take this admin stuff the wrong way... :mad:
Re: VB newbie here.. Anyone willing to offer some help???
Do you still have a problem with it?