Beispiel #1
0
        public bool aV_Definition_is_OutOfDate(int day_difference)
        {
            if (check_symantec_av_exist())
            {
                string[] lines       = new string[3];
                int      lines_index = 0;
                //= System.IO.File.ReadAllLines(definfo_path);
                try {
                    // Create an instance of StreamReader to read from a file.
                    // The using statement also closes the StreamReader.
                    using (StreamReader sr = new StreamReader(definfo_path)) {
                        String line;
                        // Read and display lines from the file until the end of
                        // the file is reached.
                        while ((line = sr.ReadLine()) != null)
                        {
                            lines[lines_index] = line;
                            lines_index++;
                        }
                    }
                } catch (Exception e) {
                    // Let the user know what went wrong.
                    Log_Writter.write_to_log_AVdebug("definfo.dat File is not in correct format please check" + e.ToString());
                    return(false);
                    //Console.WriteLine(e.Message);
                }

                // Console.ReadLine();
                curDefs = lines[1];
            }
            else
            {
                Log_Writter.write_to_log_AVdebug("The definfo.dat file does not exists, please check the installation of the Symantec SEP");
                return(false);
            }

            //Console.WriteLine("this is it" + curDefs);
            if (curDefs != null)
            {
                //Console.WriteLine("format!!!! "+curDefs);

                curDefs_year = curDefs.Substring(8, 4);

                curDefs_month = curDefs.Substring(12, 2);
                curDefs_day   = curDefs.Substring(14, 2);
                curDefs_rev   = curDefs.Substring(17, 3);

                try {
                    curDefs_year_int = Convert.ToInt32(curDefs_year);
                    // Console.WriteLine("curDefs_year_int" + curDefs_year_int);
                    curDefs_month_int = Convert.ToInt32(curDefs_month);
                    //  Console.WriteLine("curDefs_month_int" + curDefs_month_int);
                    curDefs_day_int = Convert.ToInt32(curDefs_day);
                    //  Console.WriteLine("curDefs_day" + curDefs_day);
                    //  Console.WriteLine("curDefs_day_int" + curDefs_day_int);
                    //  Console.WriteLine("coverting test is " + Convert.ToInt32("10"));
                    //  Console.ReadLine();
                    dt = new DateTime(curDefs_year_int, curDefs_month_int, curDefs_day_int);
                    //   Console.WriteLine("datetime current is " + DateTime.Now);
                    //  Console.WriteLine("datatime of av is " + dt.ToString());

                    // Console.WriteLine( "test difference"+ (DateTime.Now - dt).TotalDays);

                    if ((DateTime.Now - dt).TotalDays >= day_difference)
                    {
                        Log_Writter.write_to_log_Error("Anti-virus definition is more than " + day_difference + " days old, please contact administrator to review the anti-virus definitions");
                        return(true);
                    }
                    else
                    {
                        //Console.WriteLine("this is NOT out of the date");
                        Log_Writter.write_to_log_info("Anti-virus definition is less than " + day_difference + " days old, No Action is required ");
                        return(false);
                    }
                } catch (Exception e) {
                    Log_Writter.write_to_log_AVdebug("Script is not working with following error : " + e.ToString());

                    return(false);
                }
            }

            return(false);
        }
Beispiel #2
0
        public void RunScan()
        {
            //check the dotnetversion
            dontnetDetector dot = new dontnetDetector();

            sym_av_corp_is_outOfDate = false;
            Win_Log_Writter Log_Writter = new Win_Log_Writter();

            dotNetVersion = dot.FrameworkVersion();
            winOS_Checker = new OS_Checker();
            winOS_Checker.Check_the_OS_Version();

            //check for Sym_av_corp
            Sym_av_coporation_edition = new Sym_AV_Corp();
            OS_System_Type            = winOS_Checker.OS_System_Type;

            //************************************************
            // check for the Symantec
            //************************************************
            if (Sym_av_coporation_edition.check_symantec_av_exist() == true)
            {
                Log_Writter.write_to_log_info("Symantec Anti-virus Corp edition is Detected, Checking the AV defintion.... ");
                AV_Present_onServer = true;

                if (Sym_av_coporation_edition.aV_Definition_is_OutOfDate(2) == true)
                {
                    Log_Writter.write_to_log_Error("Symantec Anti-virus Corp edition definition is more than " + 2 + " days old, please contact administrator to review the anti-virus definitions");
                }
                else
                {
                    Log_Writter.write_to_log_info("Anti-virus definition Corp edition is less than " + 2 + " days old and no action is required");
                }
            }
            else
            {
                Log_Writter.write_to_log_info("Symantec Anti-virus Corp edition is NOT Detected, Program will carry on searching for other AV softwares");
            }
            //************************************************
            // check for the FCS
            //************************************************

            //************************************************
            // check for the Symantec SEP
            //************************************************

            Symantec_SEP sym_sep = new Symantec_SEP();

            if (sym_sep.check_symantec_av_exist() == true)
            {
                Log_Writter.write_to_log_info("Symantec End point Protection AV software is Detected, Checking the AV defintion.... ");
                AV_Present_onServer = true;

                if (sym_sep.aV_Definition_is_OutOfDate(2) == true)
                {
                    Log_Writter.write_to_log_Error("Symantec Anti-virus Corp edition definition is more than " + 2 + " days old, please contact administrator to review the anti-virus definitions");
                }
                else
                {
                    Log_Writter.write_to_log_info("Anti-virus definition Corp edition is less than " + 2 + " days old and no action is required");
                }
            }
            else
            {
                Log_Writter.write_to_log_info("Symantec End point Protection AV software is NOT Presented, Program will carry on searching for other AV softwares");
            }

            MS_FCS Forefront_Client_Security = new MS_FCS();

            if (Forefront_Client_Security.check_MSFCS_av_exist())
            {
                Log_Writter.write_to_log_info("Microsoft FCS AV software is Detected, Checking the AV/Malware defintion.... ");
                AV_Present_onServer = true;
                if (Forefront_Client_Security.aV_Definition_is_OutOfDate(2) == true)
                {
                    Log_Writter.write_to_log_Error("Microosft FCS Anti-virus definition is more than " + 2 + " days old, please contact administrator to review the anti-virus definitions");
                }
                else
                {
                    Log_Writter.write_to_log_info("Microosft FCS Anti-virus definition is less than " + 2 + " days old no action is required");
                }

                if (Forefront_Client_Security.aS_Definition_is_OutOfDate(2) == true)
                {
                    Log_Writter.write_to_log_Error("Microosft FCS malware definition is more than " + 2 + " days old, please contact administrator to review the anti-virus definitions");
                }
                else
                {
                    Log_Writter.write_to_log_info("Microosft FCS malware definition is less than " + 2 + " days old and no action is required");
                }
            }
            else
            {
                Log_Writter.write_to_log_info("Microsoft FCS AV software is NOT Detected, Program will carry on searching for other AV softwares");
            }

            //************************************************
            // check for the FEP
            //************************************************
            MS_FEP2010 FEP2010 = new MS_FEP2010();

            /*
             *  if (FEP2010.valid_InstallTime_Key() == true)
             *  {
             *      Console.WriteLine("The Installation key is present");
             *      Console.ReadLine();
             *  }
             *  else
             *  {
             *      Console.WriteLine("The Installation key is NOT Presnt");
             *      Console.ReadLine();
             *  }
             *  if (FEP2010.retrive_InstallLocation_Key() != null)
             *  {
             *      Console.WriteLine("The Installation key is present"  + FEP2010.retrive_InstallLocation_Key().ToString());
             *      Console.ReadLine();
             *  }
             *  else
             *  {
             *      Console.WriteLine("The Installation key is NOT" );
             *      Console.ReadLine();
             *  }
             *  if (Forefront_Client_Security.retrive_InstallLocation_Key() !=null)
             *  {
             *      Console.WriteLine("The Installation key is present"  + Forefront_Client_Security.retrive_InstallLocation_Key());
             *      Console.ReadLine();
             *  }
             *  else
             *  {
             *      Console.WriteLine("The Installation key is NOT present");
             *      Console.ReadLine();
             *  }
             *
             */

            if (FEP2010.check_FEP2010_av_exist())
            {
                Log_Writter.write_to_log_info("Microsoft EndPoint Protection AV software is Detected, Checking the AV/Malware defintion....");
                AV_Present_onServer = true;
                if (FEP2010.aV_Definition_is_OutOfDate(2) == true)
                {
                    Log_Writter.write_to_log_Error("Microosft EndPoint Protection Anti-virus definition is more than " + 2 + " days old, please contact administrator to review the anti-virus definitions");
                }
                else
                {
                    Log_Writter.write_to_log_info("Microosft  EndPoint Protection Anti-virus definition is less than " + 2 + " days old and no action is required");
                }

                if (FEP2010.aS_Definition_is_OutOfDate(2) == true)
                {
                    Log_Writter.write_to_log_Error("Microosft EndPoint Protection malware definition is more than " + 2 + " days old, please contact administrator to review the anti-virus definitions");
                }
                else
                {
                    Log_Writter.write_to_log_info("Microosft EndPoint Protection malware definition is less than " + 2 + " days old and no action is required");
                }
            }
            else
            {
                Log_Writter.write_to_log_info("Microsoft EndPoint Protection AV software is NOT Detected");
            }

            //************************************************
            // check for the Sophos
            //************************************************

            Sophos_AV sop_av = new Sophos_AV();

            if (sop_av.check_Sophos_av_exist() == true)
            {
                Log_Writter.write_to_log_info("Sophos Anti-Virus software is Detected, Checking the AV defintion.... ");
                AV_Present_onServer = true;
                if (sop_av.aV_Definition_is_OutOfDate(2) == true)
                {
                    Log_Writter.write_to_log_Error("Sophos Anti-Virus definition is more than " + 2 + " days old, please contact administrator to review the anti-virus definitions");
                }
                else
                {
                    Log_Writter.write_to_log_info("Sophos Anti-Virus definition Corp edition is less than " + 2 + " days old and no action is required");
                }

                if (sop_av.aV_Definition_result_zero() == true)
                {
                    Log_Writter.write_to_log_info("Sophos Anti-Virus definition is installed sucessfully no action required");
                }
                else
                {
                    Log_Writter.write_to_log_Error("Sophos Anti-Virus definition has failed to install, Please contact administrator to review the Anti-virus configuration");
                }
            }
            else
            {
                Log_Writter.write_to_log_info("Sophos Anti-Virus software is NOT Presented.");
            }

            //************************************************
            // no AV found
            //************************************************
            if (AV_Present_onServer == false)
            {
                Log_Writter.write_to_log_Error("No Anti-virus software is detected on the system or its never updated! Action Required!");
            }
        }