Results 1 to 10 of 10

Thread: VB newbie here.. Anyone willing to offer some help???

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    12

    Cool 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 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... 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!
    Last edited by MartinLiss; Jun 5th, 2010 at 01:31 PM.

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    12

    Re: VB newbie here.. Anyone willing to offer some help???

    haha thx that looks useful

  4. #4

  5. #5
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    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.

  6. #6

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    12

    Re: VB newbie here.. Anyone willing to offer some help???

    Thank you very much

  7. #7

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    12

    Re: VB newbie here.. Anyone willing to offer some help???

    Quote Originally Posted by MartinLiss View Post
    Moved. And btw please watch the language.
    Thx. [Edited by MartinLiss]
    Last edited by MartinLiss; Jun 5th, 2010 at 03:18 PM.

  8. #8

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    12

    Re: VB newbie here.. Anyone willing to offer some help???

    Quote Originally Posted by minitech View Post
    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.

  9. #9

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    12

    Re: VB newbie here.. Anyone willing to offer some help???

    Quote Originally Posted by LeonOar View Post
    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...

  10. #10
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: VB newbie here.. Anyone willing to offer some help???

    Do you still have a problem with it?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width