soar_auditor_api 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/soar_auditor_api.rb +1 -0
- data/lib/soar_auditor_api/auditor_api.rb +9 -14
- data/lib/soar_auditor_api/version.rb +1 -1
- data/sanity/Gemfile +1 -1
- data/sanity/sanity.rb +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5030e0bde899627dc4b7948d62c7beb4083c7cc
|
4
|
+
data.tar.gz: 2ab287eb385b783aaf66035ff2e5519c36f7dca1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9be17c974061665baf108a1cd9471cb2def004f911c25dd486aa47e77ab4508107d90edbf56d551d9414baefa36898359e4bff96d7f6a20a15601d8f00fb903
|
7
|
+
data.tar.gz: 22badc8a993560166dec0a4f1e0f05f7914fbebf81fbc749cc635d1fa723f5be31812e8fe59f2b8d7143607d07811a6eee11bbc55fa91bc034419af802fdf352
|
data/lib/soar_auditor_api.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
module SoarAuditorApi
|
2
2
|
class AuditorAPI
|
3
|
-
|
4
|
-
INFO_PREFIX = "info:" unless defined? INFO_PREFIX; INFO_PREFIX.freeze
|
5
|
-
WARN_PREFIX = "warn:" unless defined? WARN_PREFIX; WARN_PREFIX.freeze
|
6
|
-
ERROR_PREFIX = "error:" unless defined? ERROR_PREFIX; ERROR_PREFIX.freeze
|
7
|
-
FATAL_PREFIX = "fatal:" unless defined? FATAL_PREFIX; FATAL_PREFIX.freeze
|
3
|
+
AUDIT_LEVELS = [:debug, :info, :warn, :error, :fatal] unless defined? AUDIT_LEVELS; AUDIT_LEVELS.freeze
|
8
4
|
|
9
5
|
def initialize
|
10
6
|
@configuration = nil
|
11
7
|
@minimum_audit_level = :info
|
12
|
-
@audit_levels = [:debug, :info, :warn, :error, :fatal]
|
13
8
|
end
|
14
9
|
|
15
10
|
def configure(configuration = nil)
|
@@ -18,32 +13,32 @@ module SoarAuditorApi
|
|
18
13
|
end
|
19
14
|
|
20
15
|
def set_audit_level(minimum_audit_level)
|
21
|
-
raise ArgumentError, "Invalid audit level specified" unless
|
16
|
+
raise ArgumentError, "Invalid audit level specified" unless AUDIT_LEVELS.include?(minimum_audit_level)
|
22
17
|
@minimum_audit_level = minimum_audit_level
|
23
18
|
end
|
24
19
|
|
25
20
|
def debug(data)
|
26
|
-
audit(
|
21
|
+
audit(data.to_s) if audit_filtered_out?(:debug)
|
27
22
|
end
|
28
23
|
|
29
24
|
def <<(data)
|
30
|
-
audit(
|
25
|
+
audit(data.to_s) if audit_filtered_out?(:info)
|
31
26
|
end
|
32
27
|
|
33
28
|
def info(data)
|
34
|
-
audit(
|
29
|
+
audit(data.to_s) if audit_filtered_out?(:info)
|
35
30
|
end
|
36
31
|
|
37
32
|
def warn(data)
|
38
|
-
audit(
|
33
|
+
audit(data.to_s) if audit_filtered_out?(:warn)
|
39
34
|
end
|
40
35
|
|
41
36
|
def error(data)
|
42
|
-
audit(
|
37
|
+
audit(data.to_s) if audit_filtered_out?(:error)
|
43
38
|
end
|
44
39
|
|
45
40
|
def fatal(data)
|
46
|
-
audit(
|
41
|
+
audit(data.to_s) if audit_filtered_out?(:fatal)
|
47
42
|
end
|
48
43
|
|
49
44
|
#Safety to ensure that the Auditor that extends this API implements this IOC method
|
@@ -59,7 +54,7 @@ module SoarAuditorApi
|
|
59
54
|
private
|
60
55
|
|
61
56
|
def audit_filtered_out?(audit_level)
|
62
|
-
return
|
57
|
+
return AUDIT_LEVELS.index(@minimum_audit_level) <= AUDIT_LEVELS.index(audit_level)
|
63
58
|
end
|
64
59
|
end
|
65
60
|
end
|
data/sanity/Gemfile
CHANGED
data/sanity/sanity.rb
CHANGED
@@ -2,7 +2,7 @@ require 'soar_auditor_api'
|
|
2
2
|
require 'byebug'
|
3
3
|
|
4
4
|
class SanityAuditor < SoarAuditorApi::AuditorAPI
|
5
|
-
def configuration_is_valid(configuration)
|
5
|
+
def configuration_is_valid?(configuration)
|
6
6
|
return configuration.include?("preprefix")
|
7
7
|
end
|
8
8
|
|
@@ -11,6 +11,11 @@ class SanityAuditor < SoarAuditorApi::AuditorAPI
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
class MyStackTrace < SoarAuditorApi::Serializable
|
15
|
+
def to_s
|
16
|
+
serialize()
|
17
|
+
end
|
18
|
+
|
14
19
|
class Main
|
15
20
|
def test_sanity
|
16
21
|
@iut = SanityAuditor.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soar_auditor_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Barney de Villiers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|