Sign in to follow this  

Antivirus!

This topic is 4693 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

yes i am trying to make a antivirus on vb.net ! i want to check datas and whole folders for datas with a surten string in its code (like "i hate go to school" for i love you virus) if got a code here but it doesnt work for me (vb.net) could be that its for vb 6.0 :( here is the code : Private Sub Command1_Click() Dim sData As String, sFilename As String, sVirus As String sFilename = "c:\eicar.com" 'Dateiname zum scannen ' EICAR-Test Virus Code! ' mehr unter: http://www.eicar.org/anti_virus_test_file.htm sVirus = "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" sData = GetFile(sFilename) 'Datei einlesen und in sData speichern ' Datei nach "Virus" durchsuchen If InStr(1, sData, sVirus, vbBinaryCompare) > 0 Then MsgBox "'" & sFilename & "' ist mit dem EICAR-Test Virus infiziert!", vbCritical, "Alarm!!!" Else MsgBox "Datei ist sauber.", vbInformation, "OK" End If End Sub Public Function GetFile(ByVal sFilename As String) As String ' Datei schnell einlesen 'On Error Resume Next Dim DateiLen As Long, nFileHandle As Integer nFileHandle = FreeFile Open sFilename For Binary Shared As #nFileHandle GetFile = String$(LOF(1), 0) Get #nFileHandle, , GetFile Close #nFileHandle End Function could someone write this for vb.net ? thanks i would be REALLY happy :=)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by ShitFire
yes i am trying to make a antivirus on vb.net !

i want to check datas and whole folders for datas with a surten string in its code (like "i hate go to school" for i love you virus)

if got a code here but it doesnt work for me (vb.net) could be that its for vb 6.0 :(

here is the code :

Private Sub Command1_Click()
Dim sData As String, sFilename As String, sVirus As String

sFilename = "c:\eicar.com" 'Dateiname zum scannen

' EICAR-Test Virus Code!
' mehr unter: http://www.eicar.org/anti_virus_test_file.htm
sVirus = "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*"

sData = GetFile(sFilename) 'Datei einlesen und in sData speichern

' Datei nach "Virus" durchsuchen
If InStr(1, sData, sVirus, vbBinaryCompare) > 0 Then
MsgBox "'" & sFilename & "' ist mit dem EICAR-Test Virus infiziert!", vbCritical, "Alarm!!!"
Else
MsgBox "Datei ist sauber.", vbInformation, "OK"
End If

End Sub

Public Function GetFile(ByVal sFilename As String) As String
' Datei schnell einlesen
'On Error Resume Next
Dim DateiLen As Long, nFileHandle As Integer
nFileHandle = FreeFile
Open sFilename For Binary Shared As #nFileHandle
GetFile = String$(LOF(1), 0)
Get #nFileHandle, , GetFile
Close #nFileHandle
End Function




could someone write this for vb.net ?

thanks i would be REALLY happy :=)


I think you're going have a very hard time making an effective antivirus program (least one that doesn't take several hours to complete a scan) without a low level disk access library. planetsourcecode.com has examples of how to return the filenames of all the files under a given directory and how traverse a drives directory structure so you can scan subfolders etc.

Share this post


Link to post
Share on other sites
Quote:
Original post by ShitFire
cant u tell me how the code here would work for .net ?

thanks for helping :) first i want to know how to write the thing written un top


I don't code in VB.NET so I couldn't really tell you. The functions used in your example code are pretty fundamental so it shouldn't be hard to find tutorial for VB.NET. If you're having trouble with VB6 side I can help.

I've found three sites you may find helpful:
VB.NET Heaven[http://www.vbdotnetheaven.com/Sections/Tutorials.asp] Specificly this section [http://www.vbdotnetheaven.com/Code/Apr2003/006.asp] titled VB.NET for VB6 developers.

Programming Tutorials[http://www.programmingtutorials.com/vbnet.aspx]

...the Complete VB.NET Tutorial[http://visualbasic.about.com/od/learnvbnet/a/blecvbsbs0104.htm]

Share this post


Link to post
Share on other sites
Why on earth could you possibly want to do such a thing? You do know that there are free anti-virus programs out there right? And they detect hundreds of times more viruses, at ten times the speed of anything you are considering writing (No one who is serious about creating an anti-virus program would ever write the detection engine in VB).

Not to mention, it's not a very safe thing to be doing, putting viruses onto your PC, to detect them. You'd want to keep the PC completely isolated, and reformat when you're done.

Share this post


Link to post
Share on other sites

This topic is 4693 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this