netsnmp 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/Gemfile +5 -0
- data/lib/netsnmp.rb +1 -0
- data/lib/netsnmp/security_parameters.rb +1 -1
- data/lib/netsnmp/varbind.rb +8 -5
- data/lib/netsnmp/version.rb +1 -1
- data/netsnmp.gemspec +3 -3
- data/spec/support/Dockerfile +1 -1
- data/spec/varbind_spec.rb +8 -0
- metadata +24 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c004123f79a4628eecef5b4c2c60098fdd33a590
|
4
|
+
data.tar.gz: 03b6c15380d50856b23ce63b0266585ddb9637f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f1285f2b2e2cccca87af9c5b2d228c55bace8e5104cfcd526ed6bfd153efc5965c73ab040d7fedf710b9c1c84614c0417d2e76c3cf73a29eb3978e2da89efca
|
7
|
+
data.tar.gz: 9a69fe9f2a75054b53ce636ac52f08537a4db45eea114e0ccec5100be1f27125cea460c57fdc755f15f99d6d96423f3294814b12c4388897602692fa195383ad
|
data/.travis.yml
CHANGED
@@ -30,7 +30,7 @@ rvm:
|
|
30
30
|
- 2.3
|
31
31
|
- 2.4
|
32
32
|
- ruby-head
|
33
|
-
- jruby-9.1.
|
33
|
+
- jruby-9.1.7.0
|
34
34
|
- jruby-head
|
35
35
|
- rbx-2
|
36
36
|
matrix:
|
@@ -38,5 +38,5 @@ matrix:
|
|
38
38
|
- rvm: ruby-head
|
39
39
|
- rvm: jruby-head
|
40
40
|
# to figure out later
|
41
|
-
- rvm: jruby-9.1.
|
41
|
+
- rvm: jruby-9.1.7.0
|
42
42
|
- rvm: rbx-2
|
data/Gemfile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
source "https://rubygems.org/"
|
2
|
+
ruby RUBY_VERSION
|
2
3
|
|
3
4
|
gemspec
|
4
5
|
|
@@ -8,6 +9,10 @@ group :development do
|
|
8
9
|
gem 'pry'
|
9
10
|
end
|
10
11
|
|
12
|
+
if RUBY_VERSION < "2.2"
|
13
|
+
gem "nio4r", "~> 1.2"
|
14
|
+
end
|
15
|
+
|
11
16
|
platforms :mri do
|
12
17
|
gem "pry-byebug", require: false
|
13
18
|
gem "stackprof", require: false
|
data/lib/netsnmp.rb
CHANGED
@@ -106,7 +106,7 @@ module NETSNMP
|
|
106
106
|
# @param [String] stream the encoded incoming payload
|
107
107
|
# @param [String] salt the incoming payload''s salt
|
108
108
|
#
|
109
|
-
# @raise [
|
109
|
+
# @raise [NETSNMP::Error] if the message's integration has been violated
|
110
110
|
def verify(stream, salt)
|
111
111
|
return if @security_level < 1
|
112
112
|
verisalt = sign(stream)
|
data/lib/netsnmp/varbind.rb
CHANGED
@@ -28,16 +28,18 @@ module NETSNMP
|
|
28
28
|
else
|
29
29
|
case @value
|
30
30
|
when String
|
31
|
-
OpenSSL::ASN1::OctetString
|
31
|
+
OpenSSL::ASN1::OctetString.new(@value)
|
32
32
|
when Integer
|
33
|
-
OpenSSL::ASN1::Integer
|
33
|
+
OpenSSL::ASN1::Integer.new(@value)
|
34
34
|
when true, false
|
35
|
-
OpenSSL::ASN1::Boolean
|
35
|
+
OpenSSL::ASN1::Boolean.new(@value)
|
36
36
|
when nil
|
37
|
-
OpenSSL::ASN1::Null
|
37
|
+
OpenSSL::ASN1::Null.new(nil)
|
38
|
+
when IPAddr
|
39
|
+
OpenSSL::ASN1::ASN1Data.new(@value.hton, 0, :APPLICATION)
|
38
40
|
else
|
39
41
|
raise Error, "#{@value}: unsupported varbind type"
|
40
|
-
end
|
42
|
+
end
|
41
43
|
end
|
42
44
|
OpenSSL::ASN1::Sequence.new( [asn_oid, asn_val] )
|
43
45
|
end
|
@@ -75,6 +77,7 @@ module NETSNMP
|
|
75
77
|
def convert_application_asn(asn)
|
76
78
|
case asn.tag
|
77
79
|
when 0 # IP Address
|
80
|
+
IPAddr.new_ntoh(asn.value)
|
78
81
|
when 1 # ASN counter 32
|
79
82
|
asn.value.unpack("n*")[0] || 0
|
80
83
|
when 2 # gauge
|
data/lib/netsnmp/version.rb
CHANGED
data/netsnmp.gemspec
CHANGED
@@ -24,8 +24,8 @@ DESC
|
|
24
24
|
gem.require_paths = ["lib"]
|
25
25
|
|
26
26
|
gem.executables = Dir["bin/*"].map { |e| File.basename e }
|
27
|
-
gem.add_development_dependency "rake", ["~> 10.
|
28
|
-
gem.add_development_dependency "rspec", ["~> 3.3.0"]
|
27
|
+
gem.add_development_dependency "rake", ["~> 10.1", ">= 10.1.0"]
|
28
|
+
gem.add_development_dependency "rspec", ["~> 3.5", ">= 3.5.0"]
|
29
29
|
|
30
|
-
gem.add_development_dependency "celluloid-io", ["~> 0.17.2"]
|
30
|
+
gem.add_development_dependency "celluloid-io", ["~> 0.17", ">= 0.17.2"]
|
31
31
|
end
|
data/spec/support/Dockerfile
CHANGED
data/spec/varbind_spec.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
RSpec.describe NETSNMP::Varbind do
|
2
2
|
describe "#to_der" do
|
3
3
|
it { expect(described_class.new(".1.3.6.1.2.1.1.1.0").to_der).to eq("0\f\006\b+\006\001\002\001\001\001\000\005\000".b) }
|
4
|
+
|
5
|
+
context "application specific" do
|
6
|
+
it "converts ip addresses" do
|
7
|
+
ipaddr = IPAddr.new("10.11.104.2")
|
8
|
+
varbind = described_class.new(".1.3.6.1.4.1.2011.6.3.1.1.0", value: ipaddr)
|
9
|
+
expect(varbind.to_der).to end_with("@\x04\n\vh\x02".b)
|
10
|
+
end
|
11
|
+
end
|
4
12
|
end
|
5
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsnmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -16,33 +16,48 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 10.
|
19
|
+
version: '10.1'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 10.1.0
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: 10.
|
29
|
+
version: '10.1'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 10.1.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rspec
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
39
|
+
version: '3.5'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 3.5.0
|
34
43
|
type: :development
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
38
47
|
- - "~>"
|
39
48
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.
|
49
|
+
version: '3.5'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 3.5.0
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: celluloid-io
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
44
56
|
requirements:
|
45
57
|
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.17'
|
60
|
+
- - ">="
|
46
61
|
- !ruby/object:Gem::Version
|
47
62
|
version: 0.17.2
|
48
63
|
type: :development
|
@@ -50,6 +65,9 @@ dependencies:
|
|
50
65
|
version_requirements: !ruby/object:Gem::Requirement
|
51
66
|
requirements:
|
52
67
|
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.17'
|
70
|
+
- - ">="
|
53
71
|
- !ruby/object:Gem::Version
|
54
72
|
version: 0.17.2
|
55
73
|
description: |
|