Question

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 alternative.

Any help would be appreciated

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top