Use Microsoft Security Essentials in C# when downloading email attachment

南笙酒味 提交于 2019-12-10 18:42:30

问题


I'm making a simple program to get emails from a pop3 server using VS2010. probably gonna use the open source OpenPOP for some of it. And its supposed to then save the email and attachments in a MS SQL database.

But the question is, while attached files are easy to download from the mail server, is there any way to scan the attached files? The small company im working at uses just Microsoft security essentials.

Have googled around, but couldn't seem to find any info on this matter.


回答1:


You can use:

"%ProgramFiles%\Microsoft Security Client\MpCmdRun.exe" -Scan -ScanType 3 -File "<Path>"

and check the return code.

Additional information:

-Scan [-ScanType value]
     0  Default, according to your configuration
     1  Quick scan
     2  Full system scan
     3  File and directory custom scan

        [-File <path>]
             Indicates the file or directory  to be scanned, only valid for
             custom scan.

        [-DisableRemediation]
             This option is valid only for custom scan.
             When specified:
               - File exclusions are ignored.
               - Archive files are scanned.
               - Actions are not applied after detection.
               - Event log entries are not written after detection.
               - Detections from the custom scan are not displayed in the user
                 interface.

   Return code is
   0    if no malware is found or malware is successfully remediated and no
        additional user action is required
   2    if malware is found and not remediated or additional user action is
        required to complete remediation or there is error in scanning.
        Please check History for more information.


来源:https://stackoverflow.com/questions/13309167/use-microsoft-security-essentials-in-c-sharp-when-downloading-email-attachment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!