Exemple #1
0
        /// <summary>
        /// Initialize VDB
        /// </summary>
        public static void Initialize()
        {
            try
            {
                WDB  = new SQLiteConnection(BuildConString(Application.StartupPath + @"\VDB\WDB.avdb", SettingsManager.CacheSize, 3, SettingsManager.MaxPages, SettingsManager.PageSize, false, false));
                PEDB = new SQLiteConnection(BuildConString(Application.StartupPath + @"\VDB\PEDB.avdb", SettingsManager.CacheSize, 3, SettingsManager.MaxPages, SettingsManager.PageSize, false, false));
                HADB = new SQLiteConnection(BuildConString(Application.StartupPath + @"\VDB\HDB.avdb", SettingsManager.CacheSize, 3, SettingsManager.MaxPages, SettingsManager.PageSize, false, false));
                SDB  = new SQLiteConnection(BuildConString(Application.StartupPath + @"\VDB\SDB.avdb", SettingsManager.CacheSize, 3, SettingsManager.MaxPages, SettingsManager.PageSize, false, false));
                PGDB = new SQLiteConnection(BuildConString(Application.StartupPath + @"\VDB\PROGRAM.avdb", SettingsManager.CacheSize, 3, SettingsManager.MaxPages, SettingsManager.PageSize, false, false));
                Open();

                SQLiteCommand cmd = new SQLiteCommand();

                cmd.Connection  = SDB;
                cmd.CommandText = string.Format("SELECT version FROM VERSION WHERE [vd]='{0}'", 1);
                object result = cmd.ExecuteScalar();


                version = Convert.ToInt32(result);
                VDB.VDBDefinitions();
            }
            catch (Exception ex)
            {
                Initialized = false;
                AntiCrash.LogException(ex);
            }
            finally
            {
            }
        }
Exemple #2
0
        public static bool TCheck(string text, out string word)
        {
            bool res = false;

            object r = VDB.GetSpam(text, out word);

            if (r != null)
            {
                res = true;
            }

            word = null;
            return(res);
        }
Exemple #3
0
        public static bool Check(string file, out string word)
        {
            bool res = false;

            using (StreamReader sr = new StreamReader(file))
            {
                object r = VDB.GetSpam(sr.ReadLine(), out word);
                if (r != null)
                {
                    res = true;
                }
            }
            word = null;
            return(res);
        }
Exemple #4
0
        public static void Protect()
        {
            List <string> Files = FileHelper.GetCloudDriveFiles();

            foreach (string file in Files)
            {
                try
                {
                    Thread.Sleep(5000);
                    string result = VDB.CheckCloud(Security.GetMD5HashFromFile(file));
                    if (!string.IsNullOrEmpty(result))
                    {
                        Alert.InfectedByMany(result, file);
                    }
                    else
                    {
                        string sr = CheckVRPS(file);
                        if (sr == "safe")
                        {
                            VDB.InsertCloud(Security.GetMD5HashFromFile(file), file, "Safe");
                        }
                        else
                        {
                            VDB.InsertCloud(Security.GetMD5HashFromFile(file), file, sr);
                        }
                    }
                }
                catch (Exception ex)
                {
                    AntiCrash.LogException(ex);
                }
                finally
                {
                }
            }
        }
Exemple #5
0
        public static void UpdateVDB(ProgressBarX progress, Label lb)
        {
            try
            {
                int curv = VDB.version;
                GUI.UpdateLabel(lb, "Initialzing...");
                GUI.UpdateProgress(progress, 5, 100);
                Dictionary <string, string> SCRIPT = new Dictionary <string, string>();
                Dictionary <string, string> MD5    = new Dictionary <string, string>();
                Dictionary <string, string> PEMD5  = new Dictionary <string, string>();
                Dictionary <string, string> URL    = new Dictionary <string, string>();
                Dictionary <string, string> HEUR   = new Dictionary <string, string>();

                string updateserver = "http://arsslensoft.tk/update/";
                string vdbinfo      = "VDB.version";
                // Initializing

                WebClient wbc = new WebClient();
                wbc.Headers[HttpRequestHeader.AcceptEncoding] = "gzip";
                wbc.Headers[HttpRequestHeader.Accept]         = "text/plain";
                wbc.Headers[HttpRequestHeader.Cookie]         = "$Version=1; Skin=new;";
                wbc.Headers[HttpRequestHeader.AcceptCharset]  = "utf-8";

                Thread.Sleep(1000);
                // search for update from server
                GUI.UpdateLabel(lb, "Downloading VDB update file...");
                GUI.UpdateProgress(progress, 10, 100);
                string vdbucontent = wbc.DownloadString(updateserver + vdbinfo);
                if (Convert.ToInt32(vdbucontent) > VDB.version)
                {
                    GUI.UpdateLabel(lb, "Downloading Updates...");
                    GUI.UpdateProgress(progress, 30, 100);
                    for (int i = VDB.version + 1; i < Convert.ToInt32(vdbucontent) + 1; i++)
                    {
                        GUI.UpdateLabel(lb, "Downloading Updates (" + i.ToString() + ".vdu)...");
                        GUI.UpdateProgress(progress, 40, 100);
                        string vdupath = AVEngine.TempDir + "UPDATE.vdu";
                        string vdurl   = "http://update.arsslensoft.tk/VDB/VD/" + i.ToString() + ".vdu";
                        Download(vdurl, vdupath, lb);
                        XmlDocument doc = new XmlDocument();
                        doc.Load(vdupath);
                        GUI.UpdateLabel(lb, "Downloaded " + i.ToString() + ".vdu");
                        foreach (XmlElement el in doc.DocumentElement.ChildNodes)
                        {
                            if (el.GetAttribute("type") == "md5")
                            {
                                MD5.Add(el.GetAttribute("content"), el.InnerText);
                            }
                            else if (el.GetAttribute("type") == "url")
                            {
                                URL.Add(el.GetAttribute("content"), el.InnerText);
                            }
                            else if (el.GetAttribute("type") == "pemd5")
                            {
                                PEMD5.Add(el.GetAttribute("content"), el.InnerText);
                            }
                            else if (el.GetAttribute("type") == "heuristic")
                            {
                                HEUR.Add(el.GetAttribute("content"), el.InnerText);
                            }
                            else
                            {
                                SCRIPT.Add(el.GetAttribute("content"), el.InnerText);
                            }
                        }
                        GUI.UpdateLabel(lb, "Installing Updates...");
                        GUI.UpdateProgress(progress, 70, 100);

                        if (MD5.Count > 0)
                        {
                            VDB.AddKeys(MD5, DBT.HDB);
                        }
                        else
                        {
                        }
                        if (PEMD5.Count > 0)
                        {
                            VDB.AddKeys(PEMD5, DBT.PEMD5);
                        }
                        else
                        {
                        }
                        if (URL.Count > 0)
                        {
                            VDB.AddKeys(URL, DBT.WDB);
                        }
                        else
                        {
                        }
                        if (SCRIPT.Count > 0)
                        {
                            VDB.AddKeys(SCRIPT, DBT.SDB);
                        }
                        else
                        {
                        }
                        if (HEUR.Count > 0)
                        {
                            VDB.AddKeys(HEUR, DBT.HEUR);
                        }
                        else
                        {
                        }
                        GUI.UpdateLabel(lb, "Updating VDBV...");
                        GUI.UpdateProgress(progress, 90, 100);
                        VDB.Setversion(i.ToString());
                        HEUR.Clear();
                        SCRIPT.Clear();
                        URL.Clear();
                        PEMD5.Clear();
                        MD5.Clear();
                        File.Delete(vdupath);
                    }
                    GUI.UpdateLabel(lb, "Virus Database has been updated. Last version : " + curv.ToString() + " Current Version : " + VDB.version.ToString());
                    GUI.UpdateProgress(progress, 100, 100);
                    Alert.Attack("Virus Database Update", "Kavprot smart security virus database has been updated.", ToolTipIcon.Info, false);
                    GUI.UpdateProgress(progress, 0, 100);
                }
                else
                {
                    GUI.UpdateLabel(lb, "Virus Database is up to date");
                    GUI.UpdateProgress(progress, 100, 100);
                    Alert.Attack("Virus Database Update", "Kavprot smart security virus database is up to date", ToolTipIcon.Info, false);
                    GUI.UpdateProgress(progress, 0, 100);
                }
            }
            catch (Exception ex)
            {
                GUI.UpdateProgress(progress, 0, 100);
                GUI.UpdateLabel(lb, " ");
                AVEngine.EventsManager.CallVDBUpdateCanceled();
                if (ex.TargetSite.ReflectedType.ToString() != "System.Net.WebClient")
                {
                    AntiCrash.LogException(ex);
                }
            }
            finally
            {
            }
        }