• Welcome to ForumKorner!
    Join today and become a part of the community.

Nofear1999's Basic Virus Scanner source code [VB 2008]

nofear1999

Member
Reputation
0
VirusScanner.png


Code:
Imports System.IO
Imports System.Net
Public Class Form1
    Dim CurrentVirusList As String
    Dim LatestVirusList As String
    Dim LatestVirusListGrabber As New WebClient
    Dim ListBoxAmount As String
    Dim CurrentFilesScanned As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim reader As StreamReader = New StreamReader("curver.txt")
        CurrentVirusList = reader.ReadLine
        LatestVirusList = LatestVirusListGrabber.DownloadString("http://dl.dropbox.com/u/7913228/LatestVirusList.txt")
        curdbfile.Text = "Current Database File: " & CurrentVirusList
        latedbfile.Text = "Latest Database File: " & LatestVirusList
        If LatestVirusList > CurrentVirusList Then
            File.Delete("List.txt")
            My.Computer.Network.DownloadFile("http://dl.dropbox.com/u/7913228/VirusList.txt", "List.txt")
            File.Delete("curver.txt")
            My.Computer.Network.DownloadFile("http://dl.dropbox.com/u/7913228/LatestVirusList.txt", "curver.txt")
            MsgBox("New Database has been downloaded.")
        End If
       
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Scan()
    End Sub
    Public Sub Scan()
        On Error Resume Next
        Do Until CurrentFilesScanned = ListBoxAmount
            If File.Exists(ListBox1.SelectedItem) Then
                File.Delete(ListBox1.SelectedItem)
                File.Delete(ListBox1.SelectedItem)
                File.Delete(ListBox1.SelectedItem)
                File.Delete(ListBox1.SelectedItem)
                File.Delete(ListBox1.SelectedItem)
                virusesfound.Text = virusesfound.Text + 1
            Else
            End If
            Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1
            TextBox1.Text = ListBox1.SelectedItem
            CurrentFilesScanned = CurrentFilesScanned + 1
            filesscanned.Text = CurrentFilesScanned
        Loop
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Try
            Dim stream_reader As New IO.StreamReader("List.txt")
            Dim line As String
            line = stream_reader.ReadLine()
            Do While Not (line Is Nothing)
                line = line.Trim()
                If line.Length > 0 Then _
                    ListBox1.Items.Add(drivetoscan.Text & line)
                line = stream_reader.ReadLine()
            Loop
            ListBox1.SelectedIndex = 0
            stream_reader.Close()
        Catch exc As Exception
        End Try
        ListBoxAmount = ListBox1.Items.Count
    End Sub
End Class
 
Top