The simplest anti-virus software testing code ~

Source: Internet
Author: User

'Function with a latency of N milliseconds
Private declare sub msecsleep lib "Kernel32" alias "Sleep" (byval lngmsec as long)

 

Dim virstr as string
Dim virsample as string

Required virustest. Enabled = false

'Use two strings to ensure that the virus sample will not be scanned and killed before being generated!
Virstr = "x5o! P % @ AP [4/pzx54 (P ^) 7cc) 7 }"
Virstr = virstr + "$ EICAR-STANDARD-ANTIVIRUS-TEST-FILE! $ H + H *"

'Use Date & timer as the name of the virus sample to ensure that the file names are different each time and the anti-virus software cannot be used for blocking.
Virsample = "C:/testvir" & right $ (Year (now), 2) & month (now) & Day (now) & int (timer) & ". EXE"

On Error goto kill

'Generate a virus sample
Open virsample for output as #1
Print #1, virstr
Close #1

Doevents

'File writing is completed with a latency of 2.5 s
Msecsleep 2500
Doevents

'Access the file for anti-virus software Detection
On Error goto kill

open virsample for input as #1
input #1, virstr
close #1
'latency of 5.0 s ensures that the antivirus software completes virus database query
msecsleep 5000
doevents
'whether the sample has been killed
If dir $ (virsample) = "" Then
kill:
msgbox "Your antivirus software has successfully cleared virus samples! ", Vbokonly
else
kill virsample
msgbox" Warning: your anti-virus software fails to detect and kill virus samples correctly. We recommend that you change or upgrade your anti-virus software immediately! ", Vbokonly
end if

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.