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); }
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); }
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; }
public override void Execute(object arg) { EarlyWarningPluginArgument ewArg = (EarlyWarningPluginArgument)arg; DeviceDataSource ds = ewArg.DeviceDataSource; IDataSource dataSource = ds.DataSource; }