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);
}
}
}
}