Using the CLI from within Java

Discussion in 'ESET NOD32 Antivirus' started by sbrenton, Nov 10, 2010.

Thread Status:
Not open for further replies.
  1. sbrenton

    sbrenton Registered Member

    Joined:
    Nov 10, 2010
    Posts:
    3
    Hi all,

    I am looking to call ESET CLI from my application and scan individual files as they are uploaded to my website. The application will take the exit code returned and decide on if the file is OK to process. I can manually run the CLI from within a DOS window but when I try and launch using the application my Java process just hangs and never returns.

    Here is what I am using .....

    ESET.installDir="C:/Program Files/ESET/ESET NOD32 Antivirus/ecls.exe" /base-dir="c:/Program Files/ESET/ESET NOD32 Antivirus" /aind


    StringBuffer processCommand = new StringBuffer(props.getProperty("ESET.installDir"))
    .append(" ")
    .append("\""+saveToFile.getCanonicalPath()+"\"");
    Process thisProcess = Runtime.getRuntime().exec(processCommand.toString());
    BufferedInputStream outputStream = new BufferedInputStream(thisProcess.getInputStream());
    try
    {
    thisProcess.waitFor();
    }
    catch (InterruptedException ie)
    {
    }

    Does anyone have any experience in this? Am I missing something really dumb?

    Thanks in advance for the help,
    -Steve
     
  2. sbrenton

    sbrenton Registered Member

    Joined:
    Nov 10, 2010
    Posts:
    3
    OK well I have this working to a point now. I couldnt use strings n the script and now I have it running and not hanging. The problem I am running into is I al always getting an exit code of 100 regardless if the file is a clean text file or a malicious executable.

    running the CLI manually from the DOS window does pickup the malicious file and mark it as a virus but I dont see an exit code that way.

    Any advice?
     
  3. sbrenton

    sbrenton Registered Member

    Joined:
    Nov 10, 2010
    Posts:
    3
    Another update ..... dumping to a log file when launching NOD from the JAVA script I get this ...

    "ECLS Command-line scanner, version 4.2.35.0, (C) 1992-2010 ESET, spol. s r.o.
    Scanner initialization failed."


    Taking the exact same command for NOD and running it manually within a DOS window it works as planned.

    Anyone have any ideas?
     
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.