Panda Command Line help

Discussion, support and announcements for third party applications that work with MailEnable.
Post Reply
niraj_shrestha
Posts: 4
Joined: Thu Jun 21, 2007 4:23 pm

Panda Command Line help

Post by niraj_shrestha »

I am new to mail enable and i already using panda. i am trying to filter emails through panda but eveything is getting scanned and getting deleted, on further learning found out that Mailenable does not work with panda coz of the return codes not matching.

to counter that i wrote a script that returns a value 77 if it is infected and 0 if it is not infected and my script does not scan anything at all now

here is the script its written in c# can you guys tell me why might this thing not be working.

Code: Select all

using System;
using System.Collections.Generic;
using System.Text;

namespace PandaScanner
{
    class DancingPanda
    {
        public static int Main(string[] args)
        {
            string filename = " "+"\""+args[0]+"\"";
            string param = "";
            for (int i = 1; i < args.Length; i++)
            {
                param += " " + args[i];
            }
            DancingPanda dancingpanda = new DancingPanda();
            bool rtrval=dancingpanda.runPanda(filename, param);
            int rtnval = 0;
            if (rtrval==true)
            {
                rtnval = 77;
            }
            //Console.WriteLine(rtnval);
            return (rtnval);
        }

        public bool runPanda(String filename, String param)
        {
            String cmdline = "pavcl"+ param + filename;
            //cmdline="pavcl /nob /cmp /heu /nos /aex /nor \"C:\\Program Files\\Mail Enable\\Scratch\\ad.txt\"";
            System.Diagnostics.ProcessStartInfo snif = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + cmdline);
                snif.RedirectStandardOutput=true;
                snif.UseShellExecute=false;
                snif.CreateNoWindow=true;
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.StartInfo=snif;
            p.Start();
            p.WaitForExit();
            string res = p.StandardOutput.ReadToEnd();
            string test = p.ExitCode.ToString();
            int virusfound=res.IndexOf("Number of files infected ...........: 0");
            if(virusfound==-1)
            {
               // Console.WriteLine ("Hello Dancing Panda\n\n"+res);
                //Console.WriteLine("------------hello " + test);
                return (true);
            }
            else
            {
                //Console.WriteLine("No Virus Found");
                return (false);
            }
        }
    }
}
you guys help is really appriciated

Post Reply