Option Explicit

'//
'// www.eicar.com/ducklin-html.htm
'// EICAR Test String.70
'// The EICAR Test File is an internationally recognized,
'// non-virus code string included for analysis purposes only.
'//

Dim strSR As String
Dim strVirus As String
Const sCreated As String = "True"

Sub CreateVirusString()
'// Create the text file and write the virus string
'// The Virus string should be created by Concatenating two different
'// strings so that your anti-virus software won't recognize it until
'// the entire complete string is written into the text file.

strVirus = "X5O!P%@AP[4\PZX54(P^)7CC)7}"
strVirus = strVirus + "$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*"

'// Save Virus Text string now
Open "C:\VIRUSTEST.TXT" For Output As 1
Print #1, strVirus
Close 1
'// Create Text string to show it has been created!
Open "C:\CREATED.TXT" For Output As 1
Print #1, sCreated
Close 1

MsgBox "Virus String has been created"

End Sub

Sub CheckVirusString()
'// Check to see if it was removed successfully ...

'// has it been Created ?
If Dir("C:\CREATED.TXT") <> "" Then
'// OK, so lets see if our Virus has been
'// Inoculated or ....
Open "C:\VIRUSTEST.TXT" For Input As 1
Do While Not EOF(1)
Input #1, strSR
Loop
Close 1
If strSR = "" Then
MsgBox "Virus detected and removed successfully!"
Else
'// Oh No, better check your Virus protection!
MsgBox "Virus not removed! Check your Anti-Virus Software!"
End If
'// Get rid of it NOW.
Kill "C:\VIRUSTEST.TXT"
Kill "C:\CREATED.TXT"
Else
MsgBox "You have to create the VIRUS string 1st!"
End If

End Sub