logstash-filter-naxsi 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a6c0e6c10d3871300429a20c8ac1073fb04f5cb
4
- data.tar.gz: ddba81e78af44c33c1a761b3cfd55841b0a9c9fc
3
+ metadata.gz: bdf920409ffa8caf47c8e1107c4783697865f231
4
+ data.tar.gz: ec2b38005b782d2e784d6bb3751e29aa0a40037a
5
5
  SHA512:
6
- metadata.gz: 0fcd5c784f64395c4b38141df6a00f6280bcaadaea9e1a02878541c709dc647bc05a2b8c176ff89778a02dd2cf7d897ea1956712087040a441ef479dd6209630
7
- data.tar.gz: 21ed4914392513fe28649c06dc8885654a53c78ea6756dee164de388b2b8eb66d2eb6977c88d4438ece1c7a240b435ef534dd4df5d87c3995433c24eb09877a9
6
+ metadata.gz: 8eafb1231e504eb30d1b4aca6644219c7983cb39048ca8461c17edd4b9441f965a96ff571725e0d8f6c0941f5348c95d109f3156d163ce6a0ff0d1a33ec815b1
7
+ data.tar.gz: ae7544cb6772c36702a9f82010a1424bf021790e0ecfd527d03258fb8b20ffe691b9de316094c697bd0f479f51bcf55d82eda0ae844d11ca189fb3f103aac574
@@ -21,15 +21,17 @@ class LogStash::Filters::Naxsi < LogStash::Filters::Base
21
21
  public
22
22
  def filter(event)
23
23
 
24
+ event_hash = event.to_hash()
25
+
24
26
  # Get all of your idN keys from the event
25
- ids = event.keys.select { |a| /id\d+/ =~ a }
27
+ ids = event_hash.keys.select { |a| /id\d+/ =~ a }
26
28
 
27
29
  ids.each do |id|
28
30
 
29
31
  new_event = LogStash::Event.new()
30
32
 
31
33
  # Copy all the keys that are not tied to the exceptions
32
- event.keys.each do |key|
34
+ event_hash.keys.each do |key|
33
35
  next if /id\d+|score\d+|var_name\d+|zone\d+|cscore\d+/ =~ key
34
36
  new_event[key] = event[key]
35
37
  end
@@ -40,8 +42,8 @@ class LogStash::Filters::Naxsi < LogStash::Filters::Base
40
42
 
41
43
  # Add the properties for the exception
42
44
  ["id","score","var_name","zone","cscore"].each do |prop|
43
- next if event.has_key?(prop + exception_num)
44
- new_event[prop] = event[prop + exception_num]
45
+ next unless event_hash.has_key?(prop + exception_num)
46
+ new_event[prop] = event_hash[prop + exception_num]
45
47
  end
46
48
 
47
49
  # Create the new event
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-naxsi'
3
- s.version = '0.9.0'
3
+ s.version = '0.9.1'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "This filter plugin will split a naxsi event into multiple in conjunction with other filters."
6
6
  s.description = ""
@@ -20,4 +20,5 @@ Gem::Specification.new do |s|
20
20
  # Gem dependencies
21
21
  s.add_runtime_dependency "logstash-core", "< 2.0.0", ">= 1.4.0"
22
22
  s.add_development_dependency 'logstash-devutils'
23
+ s.add_development_dependency "concurrent-ruby", "0.9.1"
23
24
  end
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require "logstash/filters/naxsi"
4
+
5
+ describe LogStash::Filters::Naxsi do
6
+ describe "Split into multiple events" do
7
+ let(:config) do <<-CONFIG
8
+ filter {
9
+ naxsi {}
10
+ }
11
+ CONFIG
12
+ end
13
+
14
+ sample("message" => "some text", "id0" => "1", "id1" => "2") do
15
+ insist { subject.length } == 2
16
+ insist { subject[0]["id"] } == "1"
17
+ insist { subject[1]["id"] } == "2"
18
+ end
19
+
20
+ sample("message" => "some text", "id0" => "1", "id1" => "2") do
21
+ insist { subject.length } == 2
22
+ insist { subject[0]["message"] } == "some text"
23
+ insist { subject[1]["message"] } == "some text"
24
+ end
25
+
26
+ sample("message" => "some text", "id0" => "1", "id1" => "2", "cscore1" => "$SQL") do
27
+ insist { subject[1]["cscore"] } == "$SQL"
28
+ end
29
+ end
30
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-naxsi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - NextGxDx
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '='
51
+ - !ruby/object:Gem::Version
52
+ version: 0.9.1
53
+ name: concurrent-ruby
54
+ prerelease: false
55
+ type: :development
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '='
59
+ - !ruby/object:Gem::Version
60
+ version: 0.9.1
47
61
  description: ''
48
62
  email: engineering@nextgxdx.com
49
63
  executables: []
@@ -55,7 +69,7 @@ files:
55
69
  - README.md
56
70
  - lib/logstash/filters/naxsi.rb
57
71
  - logstash-filter-naxsi.gemspec
58
- - spec/filters/naxsi.rb
72
+ - spec/filters/naxsi_spec.rb
59
73
  - spec/spec_helper.rb
60
74
  homepage: https://github.org/nextgxdx/logstash-filter-naxsi
61
75
  licenses:
@@ -84,5 +98,5 @@ signing_key:
84
98
  specification_version: 4
85
99
  summary: This filter plugin will split a naxsi event into multiple in conjunction with other filters.
86
100
  test_files:
87
- - spec/filters/naxsi.rb
101
+ - spec/filters/naxsi_spec.rb
88
102
  - spec/spec_helper.rb
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
- require "logstash/filters/naxsi"
3
-
4
- describe LogStash::Filters::Naxsi do
5
- describe "Split into multiple events" do
6
- let(:config) do <<-CONFIG
7
- filter {
8
- naxsi {}
9
- }
10
- CONFIG
11
- end
12
-
13
- sample("message" => "some text", "id0" => "1", "id1" => "2") do
14
- insist { subject.length } == 2
15
- insist { subject[0]["id"] } == 1
16
- insist { subject[1]["id"] } == 2
17
- end
18
- end
19
- end