コード例 #1
0
        public override object Execute(object arg, IAsyncTaskProgress progress)
        {
            EarlyWarningPluginArgument ewArg     = (EarlyWarningPluginArgument)arg;
            DeviceDataSource           ds        = ewArg.DeviceDataSource;
            List <DataNode>            dataNodes = ewArg.DataNodes;
            IDataSource dataSource = ds.DataSource;

            foreach (DataNode dataNode in dataNodes)
            {
                //todo 此处dataNode.SensitiveData.CategoryName != "关键字"为硬代码
                if (dataNode.SensitiveData.CategoryName != "关键字")
                {
                    continue;
                }

                if (dataSource.Items != null)
                {
                    string cmd = string.Format("{1} like '%{2}%'", dataSource.Items.DbTableName, SqliteDbFile.JsonColumnName, dataNode.SensitiveData.Value);
                    IEnumerable <dynamic> result = dataSource.Items.FilterByCmd <dynamic>(cmd);
                    foreach (AbstractDataItem item in result)
                    {
                        item.SensitiveId = dataNode.SensitiveData.SensitiveId;
                    }
                }
                //todo TreeDataSource
            }
            return(null);
        }
コード例 #2
0
        private void Match(DeviceDataSource ds, List <DataNode> dataNodes)
        {
            //读取数据库中JsonColumnName列,并且匹配
            IDataSource dataSource = ds.DataSource;

            if (dataSource.Items == null)
            {
                return;
            }

            //dataSource.GetType();
            string dir           = Path.GetDirectoryName(Path.GetDirectoryName(ds.DsFilePath));
            string extactionName = dir.Substring(dir.LastIndexOf("\\") + 1);

            ExtactionCategoryCollection categoryCollection = (ExtactionCategoryCollection)_categoryManager.GetChild(extactionName);
            ExtactionCategory           category           = (ExtactionCategory)categoryCollection.GetChild(dataSource.PluginInfo.Group);
            ExtactionSubCategory        subCategory        = (ExtactionSubCategory)category.GetChild(dataSource.PluginInfo.Name);

            foreach (DataNode dataNode in dataNodes)
            {
                string cmd = string.Format("{1} like '%{2}%'", dataSource.Items.DbTableName, SqliteDbFile.JsonColumnName, dataNode.SensitiveData.Value);
                IEnumerable <dynamic> result = dataSource.Items.FilterByCmd <dynamic>(cmd);
                foreach (AbstractDataItem item in result)
                {
                    item.SensitiveId = dataNode.SensitiveData.SensitiveId;
                }
            }
        }
コード例 #3
0
        public override object Execute(object arg, IAsyncTaskProgress progress)
        {
            EarlyWarningPluginArgument ewArg = (EarlyWarningPluginArgument)arg;
            DeviceDataSource           ds    = ewArg.DeviceDataSource;
            EarlyWarningResult         earlyWarningResult = ewArg.EarlyWarningResult;

            List <DataNode> dataNodes  = ewArg.DataNodes;
            IDataSource     dataSource = ds.DataSource;

            TreeDataSource treeDataSource = dataSource as TreeDataSource;

            if (treeDataSource == null ||
                treeDataSource.TreeNodes.Count < 1)
            {
                return(null);
            }
            foreach (DataNode dataNode in dataNodes)
            {
                //todo 此处dataNode.SensitiveData.CategoryName != "URL"为硬代码
                if (dataNode.SensitiveData.CategoryName != "URL")
                {
                    continue;
                }
                //todo 此处可以直接匹配,书签和历史记录
                foreach (TreeNode treeNode in treeDataSource.TreeNodes)
                {
                    string cmd = string.Format("{1} like '%{2}%'", treeNode.Items.DbTableName, SqliteDbFile.JsonColumnName, dataNode.SensitiveData.Value);
                    IEnumerable <dynamic> result = treeNode.Items.FilterByCmd <dynamic>(cmd);
                    earlyWarningResult.SqlDb.WriteResult(result, treeNode.Items.DbTableName, (Type)treeNode.Type);
                }
            }
            return(null);
        }
コード例 #4
0
        /// <summary>
        /// 采用两表联合查询的方式验证预警数据
        /// </summary>
        /// <param name="ds"></param>
        private void Match(DeviceDataSource ds)
        {
            //读取数据库中JsonColumnName列,并且匹配
            IDataSource dataSource = ds.DataSource;

            AbstractEarlyWarningPlugin plugin = Plugins.Where(p => ((EarlyWarningPluginInfo)p.PluginInfo).Match(dataSource)).FirstOrDefault();

            if (plugin != null)
            {
                plugin.Execute(dataSource);
            }
            if (KeyWordPlugin != null)
            {
                KeyWordPlugin.Execute(dataSource);
            }
            return;
        }
コード例 #5
0
        private void Match(DeviceDataSource ds, List <DataNode> dataNodes)
        {
            //读取数据库中JsonColumnName列,并且匹配
            IDataSource dataSource = ds.DataSource;

            AbstractEarlyWarningPlugin plugin = Plugins.Where(p => ((EarlyWarningPluginInfo)p.PluginInfo).Match(dataSource)).FirstOrDefault();

            if (plugin != null)
            {
                EarlyWarningPluginArgument arg = new EarlyWarningPluginArgument(ds, dataNodes, earlyWarningResult);
                plugin.Execute(arg, null);
            }
            if (KeyWordPlugin != null)
            {
                EarlyWarningPluginArgument arg = new EarlyWarningPluginArgument(ds, dataNodes, earlyWarningResult);
                KeyWordPlugin.Execute(arg, null);
            }
            return;
        }
コード例 #6
0
 public EarlyWarningPluginArgument(DeviceDataSource deviceDataSource)
 {
     DeviceDataSource = deviceDataSource;
 }
コード例 #7
0
 public EarlyWarningPluginArgument(DeviceDataSource deviceDataSource, List <DataNode> dataNodes, EarlyWarningResult earlyWarningResult)
 {
     DeviceDataSource   = deviceDataSource;
     DataNodes          = dataNodes;
     EarlyWarningResult = earlyWarningResult;
 }
コード例 #8
0
 public override void Execute(object arg)
 {
     EarlyWarningPluginArgument ewArg = (EarlyWarningPluginArgument)arg;
     DeviceDataSource           ds    = ewArg.DeviceDataSource;
     IDataSource dataSource           = ds.DataSource;
 }