norad_beacon 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/norad_beacon/result.rb +13 -14
- data/lib/norad_beacon/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: defdd19d1e84401ef7c56d7ebed4e587dd05f440
|
4
|
+
data.tar.gz: fa4789a131a798d87d0cc5bad20ec14c207f8ade
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7307db47ad21b46594f237c3e3da64f9ac7cbadaaebc8657d81559af7e55145789407087a0363e436d136c67b0434595d1ea0edfad4831ba8b2690a9e2a53aa
|
7
|
+
data.tar.gz: 2b1516c17d15e51b904f7ad48be50ff46c8c25e6e7513fd399305bc6e6308e7438eaf1944e9c67699948ee51ca45af68955aede69c384f6170a29cf0f953c4da
|
data/lib/norad_beacon/result.rb
CHANGED
@@ -6,20 +6,19 @@ module NoradBeacon
|
|
6
6
|
class Result
|
7
7
|
attr_reader :nid, :sir, :status, :output, :title, :description, :signature
|
8
8
|
|
9
|
-
# I'm making
|
10
|
-
#
|
11
|
-
SIGNATURE_DIGEST = OpenSSL::Digest
|
12
|
-
SIGNATURE_KEY = 'n0r4dRULES'
|
9
|
+
# I'm making this value a constant to reinforce the idea that it should *never* change. If it
|
10
|
+
# does, all ignore rules in the Norad database will be invalidated.
|
11
|
+
SIGNATURE_DIGEST = OpenSSL::Digest::SHA256
|
13
12
|
|
14
13
|
# rubocop:disable ParameterLists
|
15
|
-
def initialize(nid, status, output, title, description, sir = 'unevaluated')
|
16
|
-
@nid = nid
|
14
|
+
def initialize(nid, status, output, title, description, sir = 'unevaluated', text_to_fingerprint = nil)
|
15
|
+
@nid = nid.to_s
|
17
16
|
@sir = cvss_to_sir(sir)
|
18
|
-
@status = status
|
19
|
-
@output = output
|
20
|
-
@title = title
|
21
|
-
@description = description
|
22
|
-
@signature = compute_signature
|
17
|
+
@status = status.to_s
|
18
|
+
@output = output.to_s
|
19
|
+
@title = title.to_s
|
20
|
+
@description = description.to_s
|
21
|
+
@signature = compute_signature(text_to_fingerprint)
|
23
22
|
end
|
24
23
|
# rubocop:enable ParameterLists
|
25
24
|
|
@@ -49,9 +48,9 @@ module NoradBeacon
|
|
49
48
|
end
|
50
49
|
end
|
51
50
|
|
52
|
-
def compute_signature
|
53
|
-
|
54
|
-
|
51
|
+
def compute_signature(text_to_fingerprint)
|
52
|
+
# If no specialized text to fingerprint was provided, use the raw output
|
53
|
+
SIGNATURE_DIGEST.new.update("#{nid}#{title}#{text_to_fingerprint || output}").hexdigest
|
55
54
|
end
|
56
55
|
end
|
57
56
|
end
|
data/lib/norad_beacon/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: norad_beacon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Hitchcock
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-02-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
193
|
rubyforge_project:
|
194
|
-
rubygems_version: 2.6.
|
194
|
+
rubygems_version: 2.6.10
|
195
195
|
signing_key:
|
196
196
|
specification_version: 4
|
197
197
|
summary: Gem to help with posting blackbox results to Norad.
|