Making a real Anti-Virus

How to execute a command when an option in the combobox is clicked.

Page 1 of 1

8 Replies - 6666 Views - Last Post: 17 September 2009 - 11:19 AM Rate Topic: -----

#1 Roxor  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 41
  • Joined: 27-August 09

Making a real Anti-Virus

Posted 12 September 2009 - 11:53 AM

Hi all! I'm developing a new Anti-Virus with a more friendly interface. I looked on youtube, and i followed the example of a Fake Av, but i'm making it real, with scaning options. So, down are some use-full informations,before asking:
It's a three forms application, so down i'll post the hole code, for future askings:
Form 1:
Public Class Form1
	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Timer1.Start()
	End Sub

	Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
		Form3.Show()
	End Sub
	Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
		Form2.Show()
	End Sub

	Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
		ProgressBar1.Value += 1

		If ProgressBar1.Value = _
		ProgressBar1.Maximum Then
			Timer1.Stop()
			MsgBox("Your computer has been scanned!Click the Clean Viruses Button, and we'll show you the results!", MsgBoxStyle.Information)
			Me.Hide()
		End If
	End Sub

	Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
		Timer1.Stop()
		Label3.Text = "Scan Stopped"
		ProgressBar1.Value += 0
	End Sub

	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Button2.Enabled = False
		Button3.Enabled = False
	End Sub

	Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
		If "Scan for Virus(s)" Then

		End If

		Dim Worms_Files() As String = {"c:\Program Files\Archive.exe", "c:\Program Files\Archive.exe"}
		' Worms/Tojans Directories - Full Path.
		Dim Worms_Dirs() As String = {"c:\Program Files\aolx", "c:\Program Files\BTV"}

		' Loop through Worms/Tojans Files(), add any found to listbox, and delete.
		For i = 0 To Worms_Files.GetUpperBound(0)
			If IO.File.Exists(Worms_Files(i)) Then
				Form2ListBox3.Items.Add(Worms_Files(i))
				IO.File.Delete(Worms_Files(i))
			End If
		Next


		' Loop through Worms/Tojans Dirs(), add any found to listbox, and delete.
		For i = 0 To Worms_Dirs.GetUpperBound(0)
			If IO.Directory.Exists(Worms_Dirs(i)) Then
				Form2ListBox3.Add(Worms_Dirs(i))
				IO.Directory.Delete(Worms_Dirs(i))
			End If
	End Sub
End Class
[code] Problems: Name 'Form2ListBox3' is not declared.	47	Security Pilot Anti-Virus
							'For' must end with a matching 'Next'.	54	Security Pilot Anti-Virus
							 Name 'Form2ListBox3' is not declared.	56	Security Pilot Anti-Virus




Form 2:
Public Class Form 2	
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Timer1.Start()
	End Sub

	Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
		ProgressBar1.Value += 1

		If ProgressBar1.Value = _
		ProgressBar1.Maximum Then

		End If

		Timer1.Stop()

		MsgBox("All Virus(s) have been cleaned. Your Computer is now safe. Purchase the full version to keep your computer safe!", MsgBoxStyle.Information)
		Me.Hide()
	End Sub
End Class
No Problems Encountered.

Form 3:
Public Class Form3

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		TextBox1.Text = Int(Rnd() * 1000)
		TextBox2.Text = Int(Rnd() * 7890)
		TextBox3.Text = Int(Rnd() * 54)

	End Sub

	Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
		Me.Hide()
	End Sub

	Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
		If TextBox3.Text = ("Button1") And TextBox2.Text = ("Button1") And TextBox1.Text = ("Button1") Then
			Me.Hide()
		Else
			MsgBox("Register Sucsessful!", MsgBoxStyle.Information)
		End If
	End Sub
End Class
No Problems Encountered.

So, as you can see in the code, i have a problem with the code in the ComboBox. Now, let's tell you what i want, maybe you can paste in a correct code.
I have a combobox with 3 drop-down options: Scan for Virus(s), Scan for Adware and Scan for Spyware. I want each option, when button scan it's hit, to do something. So, for each option i want it to scan some computer suspicios files. I early made an anti-virus with just 3 buttons(not combobox drop-down) but i want them to do the same with de drop down ones. As you can see, i need some code like this:
Dim Worms_Files() As String = {"c:\Program Files\Archive.exe", "c:\Program Files\Archive.exe"}
		' Worms/Tojans Directories - Full Path.
		Dim Worms_Dirs() As String = {"c:\Program Files\aolx", "c:\Program Files\BTV"}

		' Loop through Worms/Tojans Files(), add any found to listbox, and delete.
		For i = 0 To Worms_Files.GetUpperBound(0)
			If IO.File.Exists(Worms_Files(i)) Then
				Form2ListBox3.Items.Add(Worms_Files(i))
				IO.File.Delete(Worms_Files(i))
			End If
		Next


		' Loop through Worms/Tojans Dirs(), add any found to listbox, and delete.
		For i = 0 To Worms_Dirs.GetUpperBound(0)
			If IO.Directory.Exists(Worms_Dirs(i)) Then
				Form2ListBox3.Add(Worms_Dirs(i))
				IO.Directory.Delete(Worms_Dirs(i))
			End If

So, when i choose a drop-down option from the combobox and hit scan key, the AV will scan the listed files, and also show to a listbox in the 2nd form, when i hit clean viruses. It's a little bit complicated, it hink, but it must work. Another problem is that, the timer isn't setted for when fnishing scanning the system files, but is setted after a period of time. I want it, to Stop when the AV finsihed scanning dor the suspicios files and folders, if they exist.
I hope it didn't sound weird, so i'm waitng for a reply.
Thnx for all who answers ;) :^:
Damn Shit with all theese fake AV-s Tutorials! Make Real Anti-Viruses Little Fellas!!!!

Is This A Good Question/Topic? 0
  • +

Replies To: Making a real Anti-Virus

#2 PDUNZ  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 43
  • View blog
  • Posts: 376
  • Joined: 17-July 09

Re: Making a real Anti-Virus

Posted 12 September 2009 - 06:32 PM

Okie Dokie.

In your Form1 you have the error with Form2ListBox3' is not declared, change Form2ListBox3.Items.Add in the 2 loops to Form2.ListBox3.Items.Add.

Also, in the ' Loop through Worms/Tojans Dirs(), loop, you need to add Next after the End If.


Here's a way to use the selection of the combo box. Create a new sub called Scan
Public Sub Scan()


End Sub


And use a Select Case to fire the appropiate code depending on whats selected and you can run it by add Scan() in your scan button event.

ie
Public Sub Scan()
		Select Case ComboBox1.SelectedIndex
			Case 0 ' If First Item in Combo Box has been selected, ie Viruses.
				Dim Worms_Files() As String = {"c:\Program Files\Archive.exe", "c:\Program Files\Archive.exe"}
				' Worms/Tojans Directories - Full Path.
				Dim Worms_Dirs() As String = {"c:\Program Files\aolx", "c:\Program Files\BTV"}

				' Loop through Worms/Tojans Files(), add any found to listbox, and delete.
				For i = 0 To Worms_Files.GetUpperBound(0)
					If IO.File.Exists(Worms_Files(i)) Then
						Form2.ListBox3.Items.Add(Worms_Files(i))
						IO.File.Delete(Worms_Files(i))
					End If
				Next


				' Loop through Worms/Tojans Dirs(), add any found to listbox, and delete.
				For i = 0 To Worms_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Worms_Dirs(i)) Then
						Form2.ListBox3.Items.Add(Worms_Dirs(i))
						IO.Directory.Delete(Worms_Dirs(i))
					End If
				Next

			Case 1 ' Second Item selected.
				' 2nd Selection in combo Box.

			Case 2 ' 3rd Item Selected.
				' 3rd Selection Item in Combobox

		End Select
		 
	End Sub


So lets say the first item in the combobox is "Scan for Viruses' and it was selected, then it will use the code under "Case 0" (since it is essentually "If Combobox1.selectedindex = 0". Case 1 would be the second item in the combobox and so on.


Let me know if you cant understand it, I might have not made it clear enough.

Ill have a proper look through in a little while, just have some things to do.
Was This Post Helpful? 0
  • +
  • -

#3 Roxor  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 41
  • Joined: 27-August 09

Re: Making a real Anti-Virus

Posted 13 September 2009 - 06:01 AM

View PostPDUNZ, on 12 Sep, 2009 - 05:32 PM, said:

Okie Dokie.

In your Form1 you have the error with Form2ListBox3' is not declared, change Form2ListBox3.Items.Add in the 2 loops to Form2.ListBox3.Items.Add.

Also, in the ' Loop through Worms/Tojans Dirs(), loop, you need to add Next after the End If.


Here's a way to use the selection of the combo box. Create a new sub called Scan
Public Sub Scan()


End Sub


And use a Select Case to fire the appropiate code depending on whats selected and you can run it by add Scan() in your scan button event.

ie
Public Sub Scan()
		Select Case ComboBox1.SelectedIndex
			Case 0 ' If First Item in Combo Box has been selected, ie Viruses.
				Dim Worms_Files() As String = {"c:\Program Files\Archive.exe", "c:\Program Files\Archive.exe"}
				' Worms/Tojans Directories - Full Path.
				Dim Worms_Dirs() As String = {"c:\Program Files\aolx", "c:\Program Files\BTV"}

				' Loop through Worms/Tojans Files(), add any found to listbox, and delete.
				For i = 0 To Worms_Files.GetUpperBound(0)
					If IO.File.Exists(Worms_Files(i)) Then
						Form2.ListBox3.Items.Add(Worms_Files(i))
						IO.File.Delete(Worms_Files(i))
					End If
				Next


				' Loop through Worms/Tojans Dirs(), add any found to listbox, and delete.
				For i = 0 To Worms_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Worms_Dirs(i)) Then
						Form2.ListBox3.Items.Add(Worms_Dirs(i))
						IO.Directory.Delete(Worms_Dirs(i))
					End If
				Next

			Case 1 ' Second Item selected.
				' 2nd Selection in combo Box.

			Case 2 ' 3rd Item Selected.
				' 3rd Selection Item in Combobox

		End Select
		 
	End Sub


So lets say the first item in the combobox is "Scan for Viruses' and it was selected, then it will use the code under "Case 0" (since it is essentually "If Combobox1.selectedindex = 0". Case 1 would be the second item in the combobox and so on.


Let me know if you cant understand it, I might have not made it clear enough.

Ill have a proper look through in a little while, just have some things to do.


Oh,the shit,i understand only the first three lines. I got the listboxes work, but when i clik on scan button with the drop down option: Scan for Virus(s) i get an ugly error when debugging: "Conversion from string "Scan for Virus(s)" to type 'Boolean' is not valid.".
I uinderstand what's the problem: i Must do like you sdaid with that dropdown options. Just 1 problem:
Can you please be more explicite with the "Selection of the combobox"??. I don't rally understand that thing with the cases. If you can paste in the hole code, then you rulez!!!
Down, i'll just paste the code i want for each dropdown option at the combo-box:
1)Scan for Virus(s):
' Worms/Tojans  Files.
		Dim Worms_Files() As String = {""}
		' Worms/Tojans  Directories - Full Path.
		Dim Worms_Dirs() As String = {""}

		' Loop through  Worms/Tojans Files(), add any found to listbox, and delete.
		For i = 0 To Worms_Files.GetUpperBound(0)
			If IO.File.Exists(Worms_Files(i)) Then
				ListBox3.Items.Add(Worms_Files(i))
				IO.File.Delete(Worms_Files(i))
			End If
		Next

		' Loop through  Worms/Tojans Dirs(), add any found to listbox, and delete.
		For i = 0 To Worms_Dirs.GetUpperBound(0)
			If IO.Directory.Exists(Worms_Dirs(i)) Then
				ListBox3.Items.Add(Worms_Dirs(i))
				IO.Directory.Delete(Worms_Dirs(i))
			End If
		Next
	End Sub


2)Scan for SpyWare:
' Spyware Files.
		Dim Spyware_Files() As String = {""}
		'Spyware Directories - Full Path.
		Dim Spyware_Dirs() As String = {""}

		' Loop through Spyware Files(), add any found to listbox, and delete.
		For i = 0 To Spyware_Files.GetUpperBound(0)
			If IO.File.Exists(Spyware_Files(i)) Then
				ListBox2.Items.Add(Spyware_Files(i))
				IO.File.Delete(Spyware_Files(i))
			End If
		Next

		' Loop through Spyware Dirs(), add any found to listbox, and delete.
		For i = 0 To Spyware_Dirs.GetUpperBound(0)
			If IO.Directory.Exists(Spyware_Dirs(i)) Then
				ListBox2.Items.Add(Spyware_Dirs(i))
				IO.Directory.Delete(Spyware_Dirs(i))
			End If
		Next
	End Sub


3)Scan for AdWare:
 ' Adware Files.
		Dim Adware_Files() As String = {""}
		'Adware Directories - Full Path.
		Dim Adware_Dirs() As String = {""}

		' Loop through Adware Files(), add any found to listbox, and delete.
		For i = 0 To Adware_Files.GetUpperBound(0)
			If IO.File.Exists(Adware_Files(i)) Then
				ListBox1.Items.Add(Adware_Files(i))
				IO.File.Delete(Adware_Files(i))
			End If
		Next

		' Loop through Adware Dirs(), add any found to listbox, and delete.
		For i = 0 To Adware_Dirs.GetUpperBound(0)
			If IO.Directory.Exists(Adware_Dirs(i)) Then
				ListBox1.Items.Add(Adware_Dirs(i))
				IO.Directory.Delete(Adware_Dirs(i))
			End If
		Next
	End Sub



Hope You understand my Excuses!
I Have another question!
I want the Timer of the ProgressBar, to Evoluate in step with the scanning,if you understand what am i talkin'' bout.
So, the timer will stop when the scan finishes, and the bars of the progress bar will evoluate in step with the scan.

I'm sure you know what to do!
Thnx for futuring help! :D :^: :^: :^:
Was This Post Helpful? 0
  • +
  • -

#4 PDUNZ  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 43
  • View blog
  • Posts: 376
  • Joined: 17-July 09

Re: Making a real Anti-Virus

Posted 13 September 2009 - 07:46 PM

Here's the Select code. Basically its an easier way do to similar to If Combobox.Selectedindex = 0 then...... This assumes the first item in the combobox is "Virus", the second item "Spyware" and the 3rd Item is "Adware". So if the first item is selected, then the SelectedIndex is 0 and will run Case 0.

Public Sub Scan()
	Select Case ComboBox1.SelectedIndex
			Case 0 ' 1st Item in Combobox Selected - Virues.
				' Worms/Tojans  Files.
				Dim Worms_Files() As String = {""}
				' Worms/Tojans  Directories - Full Path.
				Dim Worms_Dirs() As String = {""}

				' Loop through  Worms/Tojans Files(), add any found to listbox, and delete.
				For i = 0 To Worms_Files.GetUpperBound(0)
					If IO.File.Exists(Worms_Files(i)) Then
						ListBox3.Items.Add(Worms_Files(i))
						IO.File.Delete(Worms_Files(i))
					End If
				Next

				' Loop through  Worms/Tojans Dirs(), add any found to listbox, and delete.
				For i = 0 To Worms_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Worms_Dirs(i)) Then
						ListBox3.Items.Add(Worms_Dirs(i))
						IO.Directory.Delete(Worms_Dirs(i))
					End If
				Next


			Case 1 ' 2nd Item in Combobox Selected, Spyware.
				' Spyware Files.
				Dim Spyware_Files() As String = {""}
				'Spyware Directories - Full Path.
				Dim Spyware_Dirs() As String = {""}

				' Loop through Spyware Files(), add any found to listbox, and delete.
				For i = 0 To Spyware_Files.GetUpperBound(0)
					If IO.File.Exists(Spyware_Files(i)) Then
						ListBox2.Items.Add(Spyware_Files(i))
						IO.File.Delete(Spyware_Files(i))
					End If
				Next

				' Loop through Spyware Dirs(), add any found to listbox, and delete.
				For i = 0 To Spyware_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Spyware_Dirs(i)) Then
						ListBox2.Items.Add(Spyware_Dirs(i))
						IO.Directory.Delete(Spyware_Dirs(i))
					End If
				Next


			Case 2 ' 3rd Item in Combobox Selected - Adware.
				' Adware Files.
				Dim Adware_Files() As String = {""}
				'Adware Directories - Full Path.
				Dim Adware_Dirs() As String = {""}

				' Loop through Adware Files(), add any found to listbox, and delete.
				For i = 0 To Adware_Files.GetUpperBound(0)
					If IO.File.Exists(Adware_Files(i)) Then
						ListBox1.Items.Add(Adware_Files(i))
						IO.File.Delete(Adware_Files(i))
					End If
				Next

				' Loop through Adware Dirs(), add any found to listbox, and delete.
				For i = 0 To Adware_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Adware_Dirs(i)) Then
						ListBox1.Items.Add(Adware_Dirs(i))
						IO.Directory.Delete(Adware_Dirs(i))
					End If
				Next

		End Select
End Sub



Ill have a looksie at what you want to do with the progress bar, will post back.
Was This Post Helpful? 0
  • +
  • -

#5 Roxor  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 41
  • Joined: 27-August 09

Re: Making a real Anti-Virus

Posted 14 September 2009 - 01:53 AM

View PostPDUNZ, on 13 Sep, 2009 - 06:46 PM, said:

Here's the Select code. Basically its an easier way do to similar to If Combobox.Selectedindex = 0 then...... This assumes the first item in the combobox is "Virus", the second item "Spyware" and the 3rd Item is "Adware". So if the first item is selected, then the SelectedIndex is 0 and will run Case 0.

Public Sub Scan()
	Select Case ComboBox1.SelectedIndex
			Case 0 ' 1st Item in Combobox Selected - Virues.
				' Worms/Tojans  Files.
				Dim Worms_Files() As String = {""}
				' Worms/Tojans  Directories - Full Path.
				Dim Worms_Dirs() As String = {""}

				' Loop through  Worms/Tojans Files(), add any found to listbox, and delete.
				For i = 0 To Worms_Files.GetUpperBound(0)
					If IO.File.Exists(Worms_Files(i)) Then
						ListBox3.Items.Add(Worms_Files(i))
						IO.File.Delete(Worms_Files(i))
					End If
				Next

				' Loop through  Worms/Tojans Dirs(), add any found to listbox, and delete.
				For i = 0 To Worms_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Worms_Dirs(i)) Then
						ListBox3.Items.Add(Worms_Dirs(i))
						IO.Directory.Delete(Worms_Dirs(i))
					End If
				Next


			Case 1 ' 2nd Item in Combobox Selected, Spyware.
				' Spyware Files.
				Dim Spyware_Files() As String = {""}
				'Spyware Directories - Full Path.
				Dim Spyware_Dirs() As String = {""}

				' Loop through Spyware Files(), add any found to listbox, and delete.
				For i = 0 To Spyware_Files.GetUpperBound(0)
					If IO.File.Exists(Spyware_Files(i)) Then
						ListBox2.Items.Add(Spyware_Files(i))
						IO.File.Delete(Spyware_Files(i))
					End If
				Next

				' Loop through Spyware Dirs(), add any found to listbox, and delete.
				For i = 0 To Spyware_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Spyware_Dirs(i)) Then
						ListBox2.Items.Add(Spyware_Dirs(i))
						IO.Directory.Delete(Spyware_Dirs(i))
					End If
				Next


			Case 2 ' 3rd Item in Combobox Selected - Adware.
				' Adware Files.
				Dim Adware_Files() As String = {""}
				'Adware Directories - Full Path.
				Dim Adware_Dirs() As String = {""}

				' Loop through Adware Files(), add any found to listbox, and delete.
				For i = 0 To Adware_Files.GetUpperBound(0)
					If IO.File.Exists(Adware_Files(i)) Then
						ListBox1.Items.Add(Adware_Files(i))
						IO.File.Delete(Adware_Files(i))
					End If
				Next

				' Loop through Adware Dirs(), add any found to listbox, and delete.
				For i = 0 To Adware_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Adware_Dirs(i)) Then
						ListBox1.Items.Add(Adware_Dirs(i))
						IO.Directory.Delete(Adware_Dirs(i))
					End If
				Next

		End Select
End Sub



Ill have a looksie at what you want to do with the progress bar, will post back.


O no, it doesn't work. I click the scan button with the option on Scan for Viruses, but befgore this, i create a folder named "aolx" wwith a notepad text file in it for testing. I click Scan, the progressbar progresses to the finish, and no detected viruses on the listbox+ the folder is not deleted.So, it's a problem,a nd this method doesn't work. I'll paste my current code:
 Public Sub Scan()
		Select Case ComboBox1.SelectedIndex
			Case 0 ' 1st Item in Combobox Selected - Scan for Virus(s).
				' Worms/Tojans  Files.
				Dim Worms_Files() As String = {"c:\Program Files\Archive.exe", "c:\Program Files\Archive.exe"}
				' Worms/Tojans  Directories - Full Path.
				Dim Worms_Dirs() As String = {"c:\Program Files\aolx", "c:\Program Files\BTV"}

				' Loop through  Worms/Tojans Files(), add any found to listbox, and delete.
				For i = 0 To Worms_Files.GetUpperBound(0)
					If IO.File.Exists(Worms_Files(i)) Then
						Form2.ListBox1.Items.Add(Worms_Files(i))
						IO.File.Delete(Worms_Files(i))
					End If
				Next

				' Loop through  Worms/Tojans Dirs(), add any found to listbox, and delete.
				For i = 0 To Worms_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Worms_Dirs(i)) Then
						Form2.ListBox1.Items.Add(Worms_Dirs(i))
						IO.Directory.Delete(Worms_Dirs(i))
					End If
				Next


			Case 1 ' 2nd Item in Combobox Selected - Scan for SpyWare.
				' Spyware Files.
				Dim Spyware_Files() As String = {"C:\Program Files\AdStatComm.dll", "C:\Program Files\0er8k4va\0er8k4va.exe", "C:\WINDOWS\System32\Mkfxut.exe", "C:\WINDOWS\system32\pkdacs.exe", _
		"C:\WINDOWS\System32\ywrqku.exe", "C:\windows\system32\msnavc32.exe", "C:\Program Files\AutoUpdate\AutoUpdate.exe", "C:\WINDOWS\System32\vwix32.exe", _
		"C:\WINDOWS\System32\winntcreate.exe", "C:\WINDOWS\System32\sysmonnt.exe", "C:\WINDOWS\System32\winhcek32.exe", "C:\WINDOWS\System32\qlykdnb.dll", _
		"C:\WINDOWS\System32\rypgvtoimrl.exe", "C:\WINDOWS\System32\spwgoc.exe", "C:\windows\system32\msnavc32.exe", "C:\WINDOWS\System32\sysmonnt", _
		"C:\Program Files\hpdll\hpdll.exe", "C:\WINDOWS\System32\w?wexec.exe", "C:\WINDOWS\isrvs\ffisearch.exe", "c:\Program Files\Autosearch.dll", _
		"c:\Program Files\Archive.exe", "c:\Program Files\Archive.exe"}
				'Spyware Directories - Full Path.
				Dim Spyware_Dirs() As String = {"c:\Program Files\180 SearchAssistant", "c:\Program Files\2Search", "c:\Program Files\5whgue21", "c:\Program Files\aolx", "c:\Program Files\ACM", _
		"c:\Program Files\Browser Pal", "c:\Program Files\Activity Keylogger", "c:\Program Files\Activity Logger", "c:\Program Files\Actual Spy", _
		"c:\Program Files\AdvSearch", "c:\Program Files\AppsTraka", "c:\Program Files\Ardamax Keylogger", "c:\Program Files\Auto Keylogger", _
		"c:\Program Files\BazookaBar", "c:\Program Files\Blackbox7", "c:\Program Files\Blackbox7", "c:\Program Files\BTV"}

				' Loop through Spyware Files(), add any found to listbox, and delete.
				For i = 0 To Spyware_Files.GetUpperBound(0)
					If IO.File.Exists(Spyware_Files(i)) Then
						Form2.ListBox1.Items.Add(Spyware_Files(i))
						IO.File.Delete(Spyware_Files(i))
					End If
				Next

				' Loop through Spyware Dirs(), add any found to listbox, and delete.
				For i = 0 To Spyware_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Spyware_Dirs(i)) Then
						Form2.ListBox1.Items.Add(Spyware_Dirs(i))
						IO.Directory.Delete(Spyware_Dirs(i))
					End If
				Next


			Case 2 ' 3rd Item in Combobox Selected - Scan for  AdWare.
				' Adware Files.
				Dim Adware_Files() As String = {"c:\Program Files\AdStatComm.dll", "C:\Program Files\0er8k4va\0er8k4va.exe", " C:\WINDOWS\System32\Mkfxut.exe", " C:\WINDOWS\system32\pkdacs.exe", " C:\WINDOWS\System32\ywrqku.exe", " C:\windows\system32\msnavc32.exe", " C:\Program Files\AutoUpdate\AutoUpdate.exe", " C:\WINDOWS\System32\winntcreate.exe", " C:\WINDOWS\System32\vwix32.exe", " C:\WINDOWS\System32\sysmonnt.exe", " C:\WINDOWS\System32\winhcek32.exe", " C:\WINDOWS\System32\qlykdnb.dll", " C:\WINDOWS\System32\rypgvtoimrl.exe", " C:\WINDOWS\System32\spwgoc.exe ", " C:\windows\system32\msnavc32.exe", " C:\WINDOWS\System32\sysmonnt", " C:\Program Files\hpdll\hpdll.exe ", " C:\WINDOWS\System32\w?wexec.exe", " C:\WINDOWS\isrvs\ffisearch.exe", "c:\Program Files\Autosearch.dll"}
				'Adware Directories - Full Path.
				Dim Adware_Dirs() As String = {"c:\Program Files\180 SearchAssistant", "c:\Program Files\2Search", "c:\Program Files\5whgue21", "c:\Program Files\aolx", "c:\Program Files\ACM", _
		"c:\Program Files\Browser Pal", "c:\Program Files\Activity Keylogger", "c:\Program Files\Activity Logger", "c:\Program Files\Actual Spy", _
		"c:\Program Files\AdvSearch", "c:\Program Files\AppsTraka", "c:\Program Files\Ardamax Keylogger", "c:\Program Files\Auto Keylogger", _
		"c:\Program Files\BazookaBar", "c:\Program Files\Blackbox7", "c:\Program Files\Blackbox7", "c:\Program Files\BTV"}

				' Loop through Adware Files(), add any found to listbox, and delete.
				For i = 0 To Adware_Files.GetUpperBound(0)
					If IO.File.Exists(Adware_Files(i)) Then
						Form2.ListBox1.Items.Add(Adware_Files(i))
						IO.File.Delete(Adware_Files(i))
					End If
				Next

				' Loop through Adware Dirs(), add any found to listbox, and delete.
				For i = 0 To Adware_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Adware_Dirs(i)) Then
						Form2.ListBox1.Items.Add(Adware_Dirs(i))
						IO.Directory.Delete(Adware_Dirs(i))
					End If
				Next

		End Select
	End Sub

What to be the problem?? I want to delete detected files and folders, and also to be shown on the listbox. Maybe you can help!
Another problem,is that i want the progressbar to evoluate in step with the scanning, but it doesn't it takes 6-7 secondes to end, and it's not in step with the scanning. Maybe you can look to the upper post, oit's writted more there about this problem.
Thnx for help!


Hey, pls read this!
I forgotted something to say:
I want the code for scaning viruses,adware and spyware to just show the detected ones in the listboxes. I forgot to mention that i have an option "clean the dected bads" on Form2. So, i want you,if you want, to modify the existing code, to just listbox them, not to delete them. I also want the code for the "clean detected bads", so when i click this, the files and folders detected will be cleaned. Please also read the upper post, and tell me what's bad with the code.
Thnx! :)
Was This Post Helpful? 0
  • +
  • -

#6 PDUNZ  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 43
  • View blog
  • Posts: 376
  • Joined: 17-July 09

Re: Making a real Anti-Virus

Posted 14 September 2009 - 05:17 AM

Is Form2 displayed during scanning or after to show the results?

If its after, try this.

At the top of form1's code, under Public Class Form1 add
	Public FoundFiles As New ArrayList
	Public FoundDirs As New ArrayList

.
These will be the 2 arrays that we will use to add the found Files and Directories that form 2 will use.

Next, I changed the Scan() sub with the following. This will add the found items to the arrays, but will not delete them as you said.

	 Public Sub Scan()
		Select Case ComboBox1.SelectedIndex
			Case 0 ' 1st Item in Combobox Selected - Scan for Virus(s).
				' Worms/Tojans  Files.
				Dim Worms_Files() As String = {"c:\Program Files\Archive.exe", "c:\Program Files\Archive.exe"}
				' Worms/Tojans  Directories - Full Path.
				Dim Worms_Dirs() As String = {"c:\Program Files\aolx", "c:\Program Files\BTV"}

				' Loop through  Worms/Tojans Files(), add any found to listbox, and delete.
				For i = 0 To Worms_Files.GetUpperBound(0)
					If IO.File.Exists(Worms_Files(i)) Then
						FoundFiles.Add(Worms_Files(i))
					End If
				Next

				' Loop through  Worms/Tojans Dirs(), add any found to listbox, and delete.
				For i = 0 To Worms_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Worms_Dirs(i)) Then
						FoundDirs.Add(Worms_Dirs(i))
					End If
				Next


			Case 1 ' 2nd Item in Combobox Selected - Scan for SpyWare.
				' Spyware Files.
				Dim Spyware_Files() As String = {"C:\Program Files\AdStatComm.dll", "C:\Program Files\0er8k4va\0er8k4va.exe", "C:\WINDOWS\System32\Mkfxut.exe", "C:\WINDOWS\system32\pkdacs.exe", _
		"C:\WINDOWS\System32\ywrqku.exe", "C:\windows\system32\msnavc32.exe", "C:\Program Files\AutoUpdate\AutoUpdate.exe", "C:\WINDOWS\System32\vwix32.exe", _
		"C:\WINDOWS\System32\winntcreate.exe", "C:\WINDOWS\System32\sysmonnt.exe", "C:\WINDOWS\System32\winhcek32.exe", "C:\WINDOWS\System32\qlykdnb.dll", _
		"C:\WINDOWS\System32\rypgvtoimrl.exe", "C:\WINDOWS\System32\spwgoc.exe", "C:\windows\system32\msnavc32.exe", "C:\WINDOWS\System32\sysmonnt", _
		"C:\Program Files\hpdll\hpdll.exe", "C:\WINDOWS\System32\w?wexec.exe", "C:\WINDOWS\isrvs\ffisearch.exe", "c:\Program Files\Autosearch.dll", _
		"c:\Program Files\Archive.exe", "c:\Program Files\Archive.exe"}
				'Spyware Directories - Full Path.
				Dim Spyware_Dirs() As String = {"c:\Program Files\180 SearchAssistant", "c:\Program Files\2Search", "c:\Program Files\5whgue21", "c:\Program Files\aolx", "c:\Program Files\ACM", _
		"c:\Program Files\Browser Pal", "c:\Program Files\Activity Keylogger", "c:\Program Files\Activity Logger", "c:\Program Files\Actual Spy", _
		"c:\Program Files\AdvSearch", "c:\Program Files\AppsTraka", "c:\Program Files\Ardamax Keylogger", "c:\Program Files\Auto Keylogger", _
		"c:\Program Files\BazookaBar", "c:\Program Files\Blackbox7", "c:\Program Files\Blackbox7", "c:\Program Files\BTV"}

				' Loop through Spyware Files(), add any found to listbox, and delete.
				For i = 0 To Spyware_Files.GetUpperBound(0)
					If IO.File.Exists(Spyware_Files(i)) Then
						FoundFiles.Add(Spyware_Files(i))
					End If
				Next

				' Loop through Spyware Dirs(), add any found to listbox, and delete.
				For i = 0 To Spyware_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Spyware_Dirs(i)) Then
						FoundDirs.Add(Spyware_Dirs(i))
					End If
				Next


			Case 2 ' 3rd Item in Combobox Selected - Scan for  AdWare.
				' Adware Files.
				Dim Adware_Files() As String = {"c:\Program Files\AdStatComm.dll", "C:\Program Files\0er8k4va\0er8k4va.exe", " C:\WINDOWS\System32\Mkfxut.exe", " C:\WINDOWS\system32\pkdacs.exe", " C:\WINDOWS\System32\ywrqku.exe", " C:\windows\system32\msnavc32.exe", " C:\Program Files\AutoUpdate\AutoUpdate.exe", " C:\WINDOWS\System32\winntcreate.exe", " C:\WINDOWS\System32\vwix32.exe", " C:\WINDOWS\System32\sysmonnt.exe", " C:\WINDOWS\System32\winhcek32.exe", " C:\WINDOWS\System32\qlykdnb.dll", " C:\WINDOWS\System32\rypgvtoimrl.exe", " C:\WINDOWS\System32\spwgoc.exe ", " C:\windows\system32\msnavc32.exe", " C:\WINDOWS\System32\sysmonnt", " C:\Program Files\hpdll\hpdll.exe ", " C:\WINDOWS\System32\w?wexec.exe", " C:\WINDOWS\isrvs\ffisearch.exe", "c:\Program Files\Autosearch.dll"}
				'Adware Directories - Full Path.
				Dim Adware_Dirs() As String = {"c:\Program Files\180 SearchAssistant", "c:\Program Files\2Search", "c:\Program Files\5whgue21", "c:\Program Files\aolx", "c:\Program Files\ACM", _
		"c:\Program Files\Browser Pal", "c:\Program Files\Activity Keylogger", "c:\Program Files\Activity Logger", "c:\Program Files\Actual Spy", _
		"c:\Program Files\AdvSearch", "c:\Program Files\AppsTraka", "c:\Program Files\Ardamax Keylogger", "c:\Program Files\Auto Keylogger", _
		"c:\Program Files\BazookaBar", "c:\Program Files\Blackbox7", "c:\Program Files\Blackbox7", "c:\Program Files\BTV"}

				' Loop through Adware Files(), add any found to listbox, and delete.
				For i = 0 To Adware_Files.GetUpperBound(0)
					If IO.File.Exists(Adware_Files(i)) Then
						FoundFiles.Add(Adware_Files(i))
					End If
				Next

				' Loop through Adware Dirs(), add any found to listbox, and delete.
				For i = 0 To Adware_Dirs.GetUpperBound(0)
					If IO.Directory.Exists(Adware_Dirs(i)) Then
						FoundDirs.Add(Adware_Files(i))
					End If
				Next

		End Select
	End Sub



Now, in Form2's Load event, add
   ' Add Items in FoundFiles array to listbox.
		For i = 0 To Form1.FoundFiles.Count - 1
			ListBox1.Items.Add(Form1.FoundFiles(i))
		Next

		' Add Items in FoundDirs array to Listbox.
		For i = 0 To Form1.FoundDirs.Count - 1
			ListBox1.Items.Add(Form1.FoundDirs(i))
		Next



This will go through the array that is on Form1 and add the contents (that were added when scanning on form1) to the listbox so the user knows what has been found.

Now to delete the Files and Directories. In a button event add
		' Delete Files.
		For i = 0 To Form1.FoundFiles.Count - 1
			IO.File.Delete(CStr(Form1.FoundFiles(i)))
		Next

		' Delete Directories.
		For i = 0 To Form1.FoundDirs.Count - 1
			IO.Directory.Delete(CStr(Form1.FoundDirs(i)))
		Next



This will cycle through the 2 arrays and as it goes through them, it will delete.

For the progress bar, im thinking it might be better to count the items in the arrays, set the Maximum of progressbar1 to that value, and then as it cycles through the IF loops, it adds the progressbar's value by 1.
Was This Post Helpful? 0
  • +
  • -

#7 Roxor  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 41
  • Joined: 27-August 09

Re: Making a real Anti-Virus

Posted 14 September 2009 - 06:00 AM

Yeah,thnx for these, but i really have another problem. In the Form3(Product Registration Form) the messages "you succesfully registered the program" appears even when i click register without the code in the three textboxes. I want a code for showing the message "You didn't Entered your Code" when i try to hit register without the button1 generated code in the three textboxes.
Else(LoL,Parody):
With the "set the Maximum of progressbar1 to that value, and then as it cycles through the IF loops": Does it really works?? I'll try it, but just when i finished enetering all the viruses definitions. Common man, you mean that i need to number all my fakin' hundreds of files and folders or i wrong understanded? I'll test in more in the future. Thnx, and please reply :^:
Was This Post Helpful? 0
  • +
  • -

#8 PDUNZ  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 43
  • View blog
  • Posts: 376
  • Joined: 17-July 09

Re: Making a real Anti-Virus

Posted 14 September 2009 - 06:18 PM

Ill have a look and form 3 and see.


No you dont have to number all of your files and folders - all you need is to count how many items are in the appropiate file and dir array and then add those together and set that as maximum.

I whip something up to give you an example of what I mean.

Here's an example of setting ProgressBar1 Maximum to the total count of the Spyware Files and Directories.
ProgressBar1.Maximum = Spyware_Files.GetLength(0) + Spyware_Dirs.GetLength(0).

And then in the IF loops for the scanning, you can do something like ProgressBar1.Value += 1, so it loops through the array, it adds 1 to the value of the bar and hopefully progress it. But Im thinking depending on how fast it scans is how fast it progresses.

But, I have noticed that even tho the value has been set (say the value is at 100%) - the bar animates to the value - which is why the message box will show before the bar has finished animating.

Ill do some more thinking about that, have to find how to either stop the animation and go straight to the value or wait for the animation to stop then carry on.

Ahhh the joys of programming lol.

This post has been edited by PDUNZ: 14 September 2009 - 07:41 PM

Was This Post Helpful? 0
  • +
  • -

#9 Roxor  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 41
  • Joined: 27-August 09

Re: Making a real Anti-Virus

Posted 17 September 2009 - 11:19 AM

Sorry to tell this but i ain't understand somethin'. I understood that i have to number all my dirs and files(i'm sure it's not this, i'm sure you're not jokin'), but there isn't anything to count, the files and folders to scan beiing the only counta-able things. Maybe you can think a little with the registration trick too. Another thing: I have three scanning options. I muist configure the timer for the all, a setting for one, another to another, another to the third one(i think wit IF-s). You now lots more than me, so hope you reply with some "fresh" codes and clues :D
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1