logstash-filter-hex 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +3 -0
- data.tar.gz.sig +0 -0
- data/Gemfile +2 -0
- data/LICENSE +13 -0
- data/README.md +39 -0
- data/lib/logstash/filters/hex.rb +46 -0
- data/logstash-filter-hex.gemspec +19 -0
- data/spec/spec_helper.rb +2 -0
- metadata +103 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 22593899b5affe13383d361fd20c5c2a3e93df0e
|
4
|
+
data.tar.gz: 4c847773fb39e8119cab4b84366ac0723c5c45ca
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0b1854db5590b52ae7a1bf2f58df8aec091c19d1e8a4da3902819fedcefae902e72a3104fe83fca05089e8d9f4c7846ab300543dc24b8905e2999575df00eb0a
|
7
|
+
data.tar.gz: fae21298935049949c588404e108444167fb0b548b41660a094da9b2ec8e527f92715803e021a39fe233cc797474235bf92011ceaa4a7b8503b8ac481153f644
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
ADDED
Binary file
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2016 MilCERT - Fabian Franz
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Logstash Hex Filter
|
2
|
+
|
3
|
+
This filter helps you to hex encode/decode your fields.
|
4
|
+
|
5
|
+
## Decode fields
|
6
|
+
|
7
|
+
```
|
8
|
+
hex {
|
9
|
+
fields => ["key_1", "key_2"]
|
10
|
+
}
|
11
|
+
```
|
12
|
+
|
13
|
+
## Encode field
|
14
|
+
|
15
|
+
```
|
16
|
+
hex {
|
17
|
+
fields => ["key_1", "key_2"]
|
18
|
+
action => "encode"
|
19
|
+
}
|
20
|
+
```
|
21
|
+
|
22
|
+
## Filter options
|
23
|
+
|
24
|
+
* **action**
|
25
|
+
|
26
|
+
If the content should be encoded (`encode`) or decoded (`decode`) The default value is `decode`.
|
27
|
+
|
28
|
+
* **fields**
|
29
|
+
|
30
|
+
The fields to encode or decode. Defaults to `message`.
|
31
|
+
|
32
|
+
* **type**
|
33
|
+
|
34
|
+
If you want to encode or decode the field as a `string` or an `integer`.
|
35
|
+
|
36
|
+
## Note
|
37
|
+
|
38
|
+
This filter has been written by Fabian Franz and has been provided to you by austrian milCERT.
|
39
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require "logstash/filters/base"
|
4
|
+
require "logstash/namespace"
|
5
|
+
|
6
|
+
class LogStash::Filters::Hex < LogStash::Filters::Base
|
7
|
+
|
8
|
+
config_name "hex"
|
9
|
+
|
10
|
+
config :action, :validate => ["decode", "encode"], :default => "decode"
|
11
|
+
config :type, :validate => ["string", "integer"], :default => "string"
|
12
|
+
|
13
|
+
# The fields to encode or decode as an array of names
|
14
|
+
config :fields, :validate => :array, :default => "message"
|
15
|
+
|
16
|
+
def register
|
17
|
+
end
|
18
|
+
|
19
|
+
def filter(event)
|
20
|
+
@fields.each do |field|
|
21
|
+
next if field.nil?
|
22
|
+
value = event.get(field)
|
23
|
+
next if value.nil?
|
24
|
+
|
25
|
+
case @action
|
26
|
+
when "encode"
|
27
|
+
if @type == "string"
|
28
|
+
event.set(field, value.unpack("H*").first)
|
29
|
+
else
|
30
|
+
event.set(field, value.to_i.to_s(16))
|
31
|
+
end
|
32
|
+
when "decode"
|
33
|
+
if value =~ /^[a-f0-9]+$/i
|
34
|
+
if @type == "string"
|
35
|
+
event.set(field, [value].pack("H*"))
|
36
|
+
else
|
37
|
+
event.set(field, value.to_i(16).to_s)
|
38
|
+
end
|
39
|
+
else
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
filter_matched(event)
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'logstash-filter-hex'
|
3
|
+
s.version = '0.0.3'
|
4
|
+
s.licenses = ['Apache-2.0']
|
5
|
+
s.summary = "This filter helps you encode and decode fields in hex."
|
6
|
+
s.description = "Logstash plugin to encode and decode hex."
|
7
|
+
s.authors = ["Fabian Franz"]
|
8
|
+
s.email = 'franz.fabian.94@gmail.com'
|
9
|
+
s.homepage = "http://github.com/fabianfrz/logstash-filter-hex"
|
10
|
+
s.require_paths = ["lib"]
|
11
|
+
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','Gemfile','LICENSE']
|
12
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
13
|
+
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
|
14
|
+
s.cert_chain = ['certs/fabianfrz.pem']
|
15
|
+
s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") if $0 =~ /gem\z/
|
16
|
+
|
17
|
+
s.add_runtime_dependency "logstash-core", ">= 1.0"
|
18
|
+
s.add_development_dependency 'logstash-devutils', '~> 1.1'
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: logstash-filter-hex
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fabian Franz
|
8
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EFBQADggEBAJNWYyRFpXl6iuNQTqen
|
27
|
+
Q1qLVxH1b318/pfI7PxtuoPlCwGncpkTvr7H6oJXbb2OJ/zOCweIL6xmOOTnqFon
|
28
|
+
PMu+j0YSdx/NfbpWBiBdYiVYa7ZlkrYjd31GLmojaOI1NaWFQRTberN645HG8E+z
|
29
|
+
vwSFsQ9sj4hvrO7ttWiJICOBkHkK8xv3Wa4o6meQ+8jcS2IDCOOJH4u9ArC4yoQv
|
30
|
+
4+NdSy/34UsWqr3DRFdHX2UYbmuAo/kknLJLAoMVHtIud1rl355m5SbT1NOgxRhv
|
31
|
+
5uOo0mfcMahkspPrrSxTMnF1NNOpmCJbnJNzg4QCTgEQpS7p6r2KT7V5BLJLACmx
|
32
|
+
vW0=
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2016-11-04 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: logstash-core
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1.0'
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.0'
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: logstash-devutils
|
52
|
+
requirement: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '1.1'
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '1.1'
|
64
|
+
description: Logstash plugin to encode and decode hex.
|
65
|
+
email: franz.fabian.94@gmail.com
|
66
|
+
executables: []
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- Gemfile
|
71
|
+
- LICENSE
|
72
|
+
- README.md
|
73
|
+
- lib/logstash/filters/hex.rb
|
74
|
+
- logstash-filter-hex.gemspec
|
75
|
+
- spec/spec_helper.rb
|
76
|
+
homepage: http://github.com/fabianfrz/logstash-filter-hex
|
77
|
+
licenses:
|
78
|
+
- Apache-2.0
|
79
|
+
metadata:
|
80
|
+
logstash_plugin: 'true'
|
81
|
+
logstash_group: filter
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 2.5.1
|
99
|
+
signing_key:
|
100
|
+
specification_version: 4
|
101
|
+
summary: This filter helps you encode and decode fields in hex.
|
102
|
+
test_files:
|
103
|
+
- spec/spec_helper.rb
|
metadata.gz.sig
ADDED
Binary file
|