如何在Java中上传防病毒扫描文件? [英] How to scan a file with antivirus on upload in Java?

查看:260
本文介绍了如何在Java中上传防病毒扫描文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个需要文件上传的应用程序,而且还需要
来扫描服务器上可用的防病毒软件。



我听说过abt APIS可以从赛门铁克公司获得应用服务器。

Situatuion就像我将来需要在
不同的地方部署应用程序。所以,我正在考虑将一个配置文件
从我要获取可用的Antivirus&它的路径。

我想在服务器上使用任何可用的防病毒程序,然后使用命令行
,我想传递文件名和结果。



我在传递文件和取回结果时感到困惑。

是否有可能?

  String []命令 = new String [5]; 
命令[0] =cmd;
commands [1] =/ c;
commands [2] =C:\\Program Files\\AVG\\AVG10\\\\\\\\\\\\\\\'
命令[3] =/ scan =+ filename;
命令[4] =/ report =+ virusoutput;


运行时rt = Runtime.getRuntime();
进程proc = rt.exec(命令);

Commnad行对您来说是更好的选择。然后阅读日志文件来解决问题。

I am working on an application which requires file upload and it also requires to scan the file with available antivirus on server.

I have heard abt APIS available from Symantec for application server.

Situatuion is like, I need to deploy the application at different places in the future. So, I am thinking to place a configuration file from where I am going to fetch available Antivirus & its path.

I want to use any available antivirus on server and then using command line, I want to pass file name and result back.

I am confused in passing file and retrieving back results.

Is it possible?

解决方案

Use the following code.

String[] commands =  new String[5];
                  commands[0] = "cmd";
                  commands[1] = "/c";
                  commands[2] = "C:\\Program Files\\AVG\\AVG10\\avgscanx.exe";
                  commands[3] = "/scan=" + filename;
                  commands[4] = "/report=" + virusoutput;


                 Runtime rt = Runtime.getRuntime();
                 Process proc = rt.exec(commands);

Commnad line would be better option for you. then read the log file to solve the problem.

这篇关于如何在Java中上传防病毒扫描文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆