summaryrefslogtreecommitdiff
path: root/misc/freeswitch
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-02-10 17:02:55 +0100
committerspag <spag@golwen.net>2013-02-10 17:02:55 +0100
commitaf16d6106e5b4c81a8b167397c0fffd728762fa0 (patch)
tree4512575cc49107d36d595a0c4c4d33649b5e76d3 /misc/freeswitch
parent0225c74753b20bd62e535cfcc2f7bec23266798e (diff)
update intruder
Diffstat (limited to 'misc/freeswitch')
-rw-r--r--misc/freeswitch/scripts/common/perimeter.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/misc/freeswitch/scripts/common/perimeter.lua b/misc/freeswitch/scripts/common/perimeter.lua
index de3f993..0815d33 100644
--- a/misc/freeswitch/scripts/common/perimeter.lua
+++ b/misc/freeswitch/scripts/common/perimeter.lua
@@ -128,6 +128,7 @@ function Perimeter.check(self, event)
self:append_blacklist_file(event);
end
self:execute_ban(event);
+ event.ban_time = os.time();
end
event.record.banned = event.record.banned + 1;
@@ -136,6 +137,10 @@ function Perimeter.check(self, event)
event.points = 0;
end
+ if event.points then
+ self:update_intruder(event);
+ end
+
self:record_update(event);
end
@@ -145,6 +150,7 @@ function Perimeter.check_frequency(self, event)
self.log:debug('[', event.key, '/', event.sequence, '] PERIMETER_FREQUENCY_CHECK - contacts: ', event.record.span_contact_count, ' in < ', (event.timestamp - event.record.span_start)/1000000, ' sec, threshold: ', self.contact_count_threshold, ' in ', self.contact_span_threshold, ' sec');
event.span_contact_count = 0;
event.span_start = event.timestamp;
+ event.contacts_per_second = event.record.span_contact_count / ((event.timestamp - event.record.span_start)/1000000)
return 1;
elseif (event.timestamp - event.record.span_start) > (self.contact_span_threshold * 1000000) then
event.span_contact_count = 0;
@@ -222,6 +228,11 @@ function Perimeter.execute_ban(self, event)
local result = os.execute(command);
end
+function Perimeter.update_intruder(self, event)
+ require 'common.intruder';
+ local result = common.intruder.Intruder:new{ log = self.log, database = self.database }:update_blacklist(event);
+end
+
function Perimeter.expand_variables(self, line, variables)
return (line:gsub('{([%a%d%._]+)}', function(captured)