【发布时间】:2018-12-08 00:22:09
【问题描述】:
我正在研究一个用例来检测基于一些传入事件的登录暴力攻击。为此,我必须使用 wso2 + siddhi(非可选)。
我构建的代码的结构是:
- 为每个被攻击的目标创建一个分区
- 创建 5 秒的窗口
- 对于属于上一个窗口的每个事件,选择类别为“attempt.login”的所有条目
- 将它们插入新表中。
一旦我在新表中有每个条目,我想知道表中存储了多少事件,以便能够检测到暴力(如果事件数大于 20,例如,这意味着正在发生暴力攻击)。
partition with (Target_IP4 of I_Events)
begin
from I_Events[Category == 'Attempt.Login']#window.time(5 sec)
select meta_EventTime, correlation__id, Source_IP4, Source_Proto, Source_Hostname, Target_IP4, Target_Proto, Target_Hostnmae, Category, count() as attempts
insert into #login_attempts;
from #login_attempts[attempts > 20]#window.time(5 sec)
select ...
insert into alert;
end;
从上面的代码中可以看出,我尝试使用 count() 函数但它不起作用,它只是在每次添加新元素时将值增加 1,例如,添加的第一个元素将具有 attemps = 1,第二个元素 attemps = 2,等等。
如果不能实现上述想法......至少有人知道如果满足给定条件,如何选择字符串的所有元素?例如,如果流的一个元素的属性设置为 true,则选择该流中的所有元素。
【问题讨论】:
标签: stream wso2 complex-event-processing wso2cep siddhi