public static string GetBulletinGuid(string bulletin_name)
        {
            string _sql = @"select top 1 guid from RM_ResourceSoftware_Bulletin where Name = '{0}'";
            string sql  = String.Format(_sql, bulletin_name);

            try {
                return(DatabaseAPI.ExecuteScalar(sql).ToString());
            } catch {
                return("");
            }
        }
Example #2
0
        public bool procedure_installed()
        {
            string test_sql = @"select count(*) from sysobjects where type = 'P' and name = 'ZeroDayPatch_GetVulnerableMachines-" + Constant.ZERODAY_SCHEMA_VERSION + "'";

            if ((int)DatabaseAPI.ExecuteScalar(test_sql) == 1)
            {
                return(true);
            }

            DatabaseAPI.ExecuteNonQuery(Constant.ZERODAY_GET_VULNERABLE);

            foreach (string legacy_sp in legacy_spnames)
            {
                string clean_legacy = "if exists (select 1 from sysobjects where type = 'P' and name = '" + legacy_sp + "') "
                                      + "begin "
                                      + "drop proc [" + legacy_sp + "] "
                                      + "end";
                Console.WriteLine("Making sure legacy stored procedure {0} is not present.", legacy_sp);
                DatabaseAPI.ExecuteNonQuery(clean_legacy);
            }
            return(true);
        }