开发者

Wait until Symantec End Point DoScan.exe finishes scanning the file

I am developing an application which uses file upload. My client uses Symantec End Point Protection on Windows Server.

So, I am using a sample code to check whether a file being uploaded on server.

I am calling SEP using command line.

Sample Code:

              String[] commands =  new String[6];
              commands[0] = "cmd";
              commands[1] = "/c";

              commands[2] = "C:\\Program Files\\Symantec\\Symantec Endpoint Protection\\DoScan.exe";
              commands[3] = "/cmdlinescan";
              commands[4] = "/ScanFile";
              commands[5] = fileName;

             Process process = Runtime.getRuntime().exec(commands);

             int exitVal = process.waitFor();

I have also came across that, SEP generates a daily log for each scanned file at .

scanResult = "C:\\Documents and Settings\\All Users\\Application Data\\"Symantec\\Symantec Endpoint Protection\\Logs\\";   

So, Here I want to scan the file.

I have placed check that start reading file at location. Once It returns 0 from the process

But "int exitVal = process.waitFor();" gets returned before SEP writes log to the file.

So, Is SEP "DoScan.exe" calls thread interanlly to start scanning the file.

if Yes, Please suggest me an alter开发者_高级运维native.

Any help would be appreciated


I have created a solution which works for me.

Here, What happened that int exitVal = process.waitFor(); gets returned before Symantec AV writes result in .log file.

So, I wrote a loop which keeps on checking based on last modified date of the log file.

Once, the log file gets modified, I read results.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜