Automatic Call of anti-virus software for red umbrella

Source: Internet
Author: User

Automatic Call of anti-virus software for red umbrella

There is no technical knowledge about this thing. It starts a new process with the same code as the command line. To put it bluntly, anti-virus software is needed. For example, you can create an automated program module on the server to detect viruses when users upload documents. The current anti-virus software can do this automatically, and virus files in the specified directory will be reported. Anti-virus software can also set scheduled tasks, specify when to scan a specified folder, and set the file processing method after detecting a virus. In fact, there is no need for such a requirement. The customer is God. Since there is a demand, we need to implement it for the customer.


I don't know. I started to work. Download a free version of red umbrella from the Internet and install it. My version is:

Go to my installation directory C: \ Program Files (x86) \ Avira \ AntiVir Desktop, and we will call it. To call avscan, you need a configuration file. on disk D, we create a new text file named myavp. avp with the following content:

[CFG]
GuiMode = 1
ExitMode = 1
[SEARCH]
Parameter = 0x00300432
[CONTROLCENTER]
ProfileName = myscan

Then, set the file attribute to read-only. Otherwise, the configuration file will be deleted after the call. Don't ask me what I mean. I don't know what it means. The installation directory of little red umbrella also contains many avp files. However, it can be determined that guimode = 1 means to control whether the pop-up interface is displayed. Wow, don't hit me. To test the success or failure, we have to find a virus file. Where can I find a virus file? Finally, I found a popular lpk. dll. For example, a fake package is definitely a virus file that my friend sent to me in the compressed package. Then, you can find an image file th.jpg and any other exe files.

Then run the command line as follows:

D: \> cd C: \ Program Files (x86) \ Avira \ AntiVir Desktop
C: \ Program Files (x86) \ Avira \ AntiVir Desktop> avscan/CFG = "d: \ myavp. avp"/PATH = "d: \ th.jpg"

This is just a normal picture file fact detection this sister paper is not toxic:

Then run the command to set the parameter to scan files with viruses:
C: \ Program Files (x86) \ Avira \ AntiVir Desktop> avscan/CFG = "d: \ myavp. avp"/PATH = "d: \ lpk. dll"
Result:

Note that in win7, the system may prompt "do you want to allow the following programs to update your computer?". Set administrator permissions on your own.

What we want is not to let him bring up the interface, change the first item of the above configuration to GuiMode = 0, and then run the command line, the result is that the interface is gone, but no result is returned in the command line. I don't know what's going on. Create a new winform program and write the following c # function:

Void invokeAntivirus (string executeFileFullName, string args, string docFullName) {Process proc = null; proc = new System. diagnostics. process (); proc. startInfo. fileName = executeFileFullName; proc. startInfo. arguments = string. format (args, docFullName); proc. start (); proc. waitForExit (); // wait for if (proc. exitCode = 0) MessageBox. show ("no virus"); else MessageBox. show ("note, if any ");}

Then, in the click Event of the button, call:

 string exe = @"C:\Program Files (x86)\Avira\AntiVir Desktop\avscan.exe"; string args = "/CFG=\"d:\\myavp.avp\" /PATH=\"{0}\""; string docFile = textBox1.Text; invokeAntivirus(exe, args, docFile);

Finally, run the program in the debug directory after compilation. You must right-click the program and run it as an administrator.
Enter d: \ th.jpg in the text box

When you click the button, the interface will take several seconds to respond, because the scanning process will end. If you want to solve this problem and do not let the interface die, you can simply put it in another thread. Proc. ExitCode! I don't understand what the code = 0 means. A normal file equals 0. If the function is implemented, it will be a pitfall. Note that if the file name or path to be scanned is entered incorrectly, proc. ExitCode = 0 is not returned. After scanning, we found that the virus file on drive D had disappeared. Then we can see that the red umbrella interface has been automatically isolated:

 

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.