netsnmp 0.6.1 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/netsnmp/client.rb +5 -2
- data/lib/netsnmp/encryption/aes.rb +3 -3
- data/lib/netsnmp/encryption/des.rb +4 -4
- data/lib/netsnmp/errors.rb +9 -4
- data/lib/netsnmp/extensions.rb +12 -1
- data/lib/netsnmp/loggable.rb +2 -3
- data/lib/netsnmp/message.rb +10 -6
- data/lib/netsnmp/mib/parser.rb +39 -39
- data/lib/netsnmp/mib.rb +17 -11
- data/lib/netsnmp/oid.rb +6 -3
- data/lib/netsnmp/pdu.rb +20 -23
- data/lib/netsnmp/scoped_pdu.rb +7 -6
- data/lib/netsnmp/security_parameters.rb +54 -54
- data/lib/netsnmp/session.rb +13 -11
- data/lib/netsnmp/timeticks.rb +1 -0
- data/lib/netsnmp/v3_session.rb +7 -7
- data/lib/netsnmp/varbind.rb +21 -11
- data/lib/netsnmp/version.rb +1 -1
- data/lib/netsnmp.rb +9 -9
- data/sig/client.rbs +8 -2
- data/sig/encryption/aes.rbs +23 -0
- data/sig/encryption/des.rbs +23 -0
- data/sig/errors.rbs +13 -0
- data/sig/extensions.rbs +12 -0
- data/sig/loggable.rbs +4 -7
- data/sig/message.rbs +10 -2
- data/sig/mib.rbs +20 -6
- data/sig/netsnmp.rbs +5 -5
- data/sig/oid.rbs +1 -0
- data/sig/pdu.rbs +14 -15
- data/sig/scoped_pdu.rbs +9 -4
- data/sig/security_parameters.rbs +29 -23
- data/sig/session.rbs +21 -6
- data/sig/timeticks.rbs +19 -0
- data/sig/v3_session.rbs +3 -2
- data/sig/varbind.rbs +13 -2
- data/spec/client_spec.rb +8 -8
- data/spec/pdu_spec.rb +2 -1
- metadata +8 -4
- data/sig/openssl.rbs +0 -20
data/sig/pdu.rbs
CHANGED
@@ -3,43 +3,42 @@ module NETSNMP
|
|
3
3
|
|
4
4
|
class PDU
|
5
5
|
|
6
|
-
|
7
|
-
# headers: [snmp_version?, String?],
|
8
|
-
# ?request_id: String,
|
9
|
-
# ?error_status: Integer,
|
10
|
-
# ?error_index: Integer,
|
11
|
-
# ?varbinds: Array[varbind_options]
|
12
|
-
# }
|
6
|
+
MAXREQUESTID: Integer
|
13
7
|
|
14
8
|
attr_reader varbinds: Array[Varbind]
|
15
9
|
attr_reader type: Integer
|
16
|
-
attr_reader version:
|
17
|
-
attr_reader community: String
|
10
|
+
attr_reader version: Integer
|
11
|
+
attr_reader community: String?
|
18
12
|
attr_reader request_id: Integer
|
19
13
|
|
20
|
-
|
21
|
-
|
14
|
+
@error_index: Integer
|
15
|
+
@error_status: Integer
|
22
16
|
|
23
|
-
def self.
|
17
|
+
def self.decode: (String | OpenSSL::ASN1::ASN1Data der, **untyped vars) -> instance
|
18
|
+
|
19
|
+
def self.build: (pdu_type, **untyped) -> instance
|
24
20
|
|
25
21
|
|
26
22
|
def to_asn: () -> OpenSSL::ASN1::ASN1Data
|
27
23
|
|
28
24
|
def to_der: () -> String
|
29
25
|
|
30
|
-
def
|
26
|
+
def to_hex: () -> String
|
27
|
+
|
28
|
+
def add_varbind: (oid: String, **untyped varbind_options) -> void
|
31
29
|
alias << add_varbind
|
32
30
|
|
33
31
|
private
|
34
32
|
|
35
33
|
def initialize: (
|
36
34
|
type: Integer,
|
37
|
-
|
35
|
+
version: Integer,
|
36
|
+
community: String?,
|
38
37
|
?request_id: Integer,
|
39
38
|
?error_status: Integer,
|
40
39
|
?error_index: Integer,
|
41
40
|
?varbinds: Array[varbind_options]
|
42
|
-
) ->
|
41
|
+
) -> void
|
43
42
|
|
44
43
|
def encode_headers_asn: () -> [OpenSSL::ASN1::Integer, OpenSSL::ASN1::OctetString]
|
45
44
|
|
data/sig/scoped_pdu.rbs
CHANGED
@@ -1,14 +1,19 @@
|
|
1
1
|
module NETSNMP
|
2
2
|
class ScopedPDU < PDU
|
3
|
-
attr_reader engine_id: String
|
4
|
-
attr_reader auth_param: String
|
5
|
-
attr_reader security_level: Integer
|
3
|
+
attr_reader engine_id: String?
|
4
|
+
attr_reader auth_param: String
|
5
|
+
attr_reader security_level: Integer
|
6
|
+
|
7
|
+
@context: String?
|
6
8
|
|
7
9
|
private
|
8
10
|
|
9
11
|
def initialize: (
|
10
12
|
type: Integer,
|
11
|
-
|
13
|
+
?auth_param: String,
|
14
|
+
?security_level: Integer,
|
15
|
+
?engine_id: String,
|
16
|
+
?context: String,
|
12
17
|
**untyped
|
13
18
|
) -> void
|
14
19
|
|
data/sig/security_parameters.rbs
CHANGED
@@ -1,29 +1,30 @@
|
|
1
1
|
module NETSNMP
|
2
2
|
class SecurityParameters
|
3
|
-
|
3
|
+
include Loggable
|
4
4
|
|
5
|
-
type security_level =
|
5
|
+
type security_level = 0 | 1 | 3
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
IPAD: String
|
8
|
+
OPAD: String
|
9
|
+
TIMELINESS_THRESHOLD: Integer
|
9
10
|
|
11
|
+
@auth_pass_key: String
|
12
|
+
@priv_pass_key: String
|
13
|
+
@priv_protocol: Symbol?
|
14
|
+
@digest: OpenSSL::Digest
|
15
|
+
@encryption: (Encryption::AES | Encryption::DES)?
|
16
|
+
@timeliness: Integer
|
10
17
|
|
11
|
-
|
12
|
-
@priv_protocol: priv_protocol?
|
13
|
-
@priv_password: String?
|
14
|
-
@digest: _Authenticate?
|
15
|
-
@encryption: _Encrypt?
|
16
|
-
|
17
|
-
attr_reader security_level: security_level
|
18
|
+
attr_reader security_level: Integer
|
18
19
|
attr_reader username: String
|
19
20
|
attr_reader engine_id: String
|
20
|
-
attr_reader auth_protocol:
|
21
|
+
attr_reader auth_protocol: Symbol?
|
21
22
|
|
22
23
|
def engine_id=: (String id) -> void
|
23
24
|
|
24
|
-
def encode: (
|
25
|
+
def encode: (PDU pdu, salt: OpenSSL::ASN1::ASN1Data, engine_time: Integer, engine_boots: Integer) -> [OpenSSL::ASN1::ASN1Data, OpenSSL::ASN1::ASN1Data]
|
25
26
|
|
26
|
-
def decode: (OpenSSL::ASN1::ASN1Data | String der, salt:
|
27
|
+
def decode: (OpenSSL::ASN1::ASN1Data | String der, salt: String, engine_time: Integer, engine_boots: Integer, ?security_level: Integer) -> OpenSSL::ASN1::ASN1Data
|
27
28
|
|
28
29
|
def sign: (String message) -> String?
|
29
30
|
|
@@ -36,23 +37,28 @@ module NETSNMP
|
|
36
37
|
def initialize: (
|
37
38
|
username: String,
|
38
39
|
?engine_id: String,
|
39
|
-
?security_level:
|
40
|
-
?auth_protocol:
|
41
|
-
?auth_password: String
|
42
|
-
?priv_protocol:
|
43
|
-
?priv_password: String
|
44
|
-
|
45
|
-
|
40
|
+
?security_level: Integer | :noauth | :auth_no_priv | :auth_priv | nil,
|
41
|
+
?auth_protocol: Symbol | nil,
|
42
|
+
?auth_password: String | nil,
|
43
|
+
?priv_protocol: Symbol | nil,
|
44
|
+
?priv_password: String | nil,
|
45
|
+
**untyped options
|
46
|
+
) -> void
|
47
|
+
|
48
|
+
@auth_key: String
|
46
49
|
def auth_key: () -> String
|
47
50
|
|
51
|
+
@priv_key: String
|
48
52
|
def priv_key: () -> String
|
49
53
|
|
50
|
-
def check_parameters: () -> void
|
51
|
-
|
52
54
|
def localize_key: (String key) -> String
|
53
55
|
|
54
56
|
def passkey: (String password) -> String
|
55
57
|
|
58
|
+
def digest: () -> OpenSSL::Digest
|
59
|
+
|
60
|
+
def encryption: () -> (Encryption::AES | Encryption::DES)?
|
61
|
+
|
56
62
|
def authorizable?: () -> bool
|
57
63
|
end
|
58
64
|
end
|
data/sig/session.rbs
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
module NETSNMP
|
2
2
|
class Session
|
3
|
-
|
3
|
+
include Loggable
|
4
|
+
|
5
|
+
TIMEOUT: Integer
|
4
6
|
|
5
7
|
@transport: _Transport
|
8
|
+
@proxy: bool?
|
6
9
|
@version: 0 | 1 | 3
|
7
10
|
@community: String?
|
8
11
|
|
@@ -15,18 +18,30 @@ module NETSNMP
|
|
15
18
|
private
|
16
19
|
|
17
20
|
def initialize: (?version: snmp_version, ?community: String, **untyped) -> untyped
|
18
|
-
|
21
|
+
|
19
22
|
def validate: (?host: String?, ?port: Integer, ?proxy: _Transport, ?timeout: Integer, **untyped) -> void
|
20
23
|
|
21
24
|
class Transport
|
22
|
-
|
25
|
+
MAXPDUSIZE: Integer
|
26
|
+
|
27
|
+
@socket: UDPSocket
|
28
|
+
@destaddr: String
|
29
|
+
@timeout: Integer
|
30
|
+
|
23
31
|
def close: () -> void
|
24
|
-
|
25
|
-
def
|
26
|
-
|
32
|
+
|
33
|
+
def send: (String pdu_der) -> String
|
34
|
+
|
35
|
+
def write: (String data) -> void
|
36
|
+
|
37
|
+
def recv: (?Integer size) -> String
|
27
38
|
|
28
39
|
private
|
29
40
|
|
41
|
+
def initialize: (String host, Integer port, timeout: Integer) -> void
|
42
|
+
|
43
|
+
def perform_io: [U] { () -> U } -> U
|
44
|
+
|
30
45
|
def wait: (:wait_readable | :wait_writable) -> void
|
31
46
|
end
|
32
47
|
end
|
data/sig/timeticks.rbs
CHANGED
@@ -2,6 +2,25 @@ module NETSNMP
|
|
2
2
|
class Timetick < Numeric
|
3
3
|
@ticks: Integer
|
4
4
|
|
5
|
+
def to_i: () -> Integer
|
6
|
+
|
5
7
|
def to_asn: () -> OpenSSL::ASN1::ASN1Data
|
8
|
+
|
9
|
+
def coerce: (Integer ticks) -> [instance, instance]
|
10
|
+
|
11
|
+
def <=>: (_ToI other) -> Integer?
|
12
|
+
def +: (_ToI other) -> instance
|
13
|
+
def -: (_ToI other) -> instance
|
14
|
+
def *: (_ToI other) -> instance
|
15
|
+
def /: (_ToI other) -> instance
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def initialize: (Integer ticks) -> untyped
|
20
|
+
|
21
|
+
def days_since: () -> Rational
|
22
|
+
def hours_since: (Rational days) -> Rational
|
23
|
+
def minutes_since: (Rational hours) -> Rational
|
24
|
+
def milliseconds_since: (Rational minutes) -> Rational
|
6
25
|
end
|
7
26
|
end
|
data/sig/v3_session.rbs
CHANGED
@@ -3,11 +3,12 @@ module NETSNMP
|
|
3
3
|
|
4
4
|
def build_pdu: (pdu_type, *untyped) -> ScopedPDU
|
5
5
|
|
6
|
-
def send: (ScopedPDU pdu) ->
|
7
|
-
| (ScopedPDU pdu) -> [PDU, String, Integer, Integer]
|
6
|
+
def send: (ScopedPDU pdu) -> (PDU | [PDU, String, Integer, Integer])
|
8
7
|
|
9
8
|
private
|
10
9
|
|
10
|
+
def validate: (**untyped options) -> void
|
11
|
+
|
11
12
|
def encode: (ScopedPDU) -> String
|
12
13
|
|
13
14
|
def initialize: (?context: String, **untyped) -> untyped
|
data/sig/varbind.rbs
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module NETSNMP
|
2
|
-
type varbind_options =
|
2
|
+
type varbind_options = {oid: String, value: Varbind::varbind_value }
|
3
|
+
| {oid: String, value: Varbind::varbind_value, type: oid_type}
|
3
4
|
|
4
5
|
class Varbind
|
5
6
|
|
@@ -8,6 +9,8 @@ module NETSNMP
|
|
8
9
|
attr_reader oid: String
|
9
10
|
attr_reader value: oid_value
|
10
11
|
|
12
|
+
@type: oid_type?
|
13
|
+
|
11
14
|
def to_asn: () -> OpenSSL::ASN1::Sequence
|
12
15
|
|
13
16
|
def to_der: () -> String
|
@@ -15,7 +18,15 @@ module NETSNMP
|
|
15
18
|
def convert_val: (varbind_value) -> oid_value
|
16
19
|
|
17
20
|
|
18
|
-
def convert_to_asn: (
|
21
|
+
def convert_to_asn: (:ip_address, Integer) -> OpenSSL::ASN1::ASN1Data
|
22
|
+
| (:counter32, Integer) -> OpenSSL::ASN1::ASN1Data
|
23
|
+
| (:counter64, Integer) -> OpenSSL::ASN1::ASN1Data
|
24
|
+
| (:uinteger, Integer) -> OpenSSL::ASN1::ASN1Data
|
25
|
+
| (:gauge, Integer) -> OpenSSL::ASN1::ASN1Data
|
26
|
+
| (:timetick, Integer) -> OpenSSL::ASN1::ASN1Data
|
27
|
+
| (:opaque, Integer) -> OpenSSL::ASN1::ASN1Data
|
28
|
+
| (:nsap, Integer) -> OpenSSL::ASN1::ASN1Data
|
29
|
+
| (oid_type, oid_value) -> OpenSSL::ASN1::ASN1Data
|
19
30
|
|
20
31
|
def convert_application_asn: (OpenSSL::ASN1::ASN1Data asn) -> oid_value
|
21
32
|
|
data/spec/client_spec.rb
CHANGED
@@ -56,14 +56,14 @@ RSpec.describe NETSNMP::Client do
|
|
56
56
|
let(:next_result) { "San Francisco, California, United States" }
|
57
57
|
let(:walk_result) do
|
58
58
|
{
|
59
|
-
"1.3.6.1.2.1.1.1.0" =>
|
60
|
-
"1.3.6.1.2.1.1.2.0" =>
|
61
|
-
"1.3.6.1.2.1.1.3.0" =>
|
62
|
-
"1.3.6.1.2.1.1.4.0" =>
|
63
|
-
"1.3.6.1.2.1.1.5.0" =>
|
64
|
-
"1.3.6.1.2.1.1.6.0" =>
|
65
|
-
"1.3.6.1.2.1.1.7.0" =>
|
66
|
-
"1.3.6.1.2.1.1.8.0" =>
|
59
|
+
"1.3.6.1.2.1.1.1.0" => "Linux zeus 4.8.6.5-smp #2 SMP Sun Nov 13 14:58:11 CDT 2016 i686",
|
60
|
+
"1.3.6.1.2.1.1.2.0" => "1.3.6.1.4.1.8072.3.2.10",
|
61
|
+
"1.3.6.1.2.1.1.3.0" => /Timeticks: \(\d+\) \d+ days, \d+:\d+:\d+\.\d+/,
|
62
|
+
"1.3.6.1.2.1.1.4.0" => "SNMP Laboratories, info@snmplabs.com",
|
63
|
+
"1.3.6.1.2.1.1.5.0" => "zeus.snmplabs.com (you can change this!)",
|
64
|
+
"1.3.6.1.2.1.1.6.0" => "San Francisco, California, United States",
|
65
|
+
"1.3.6.1.2.1.1.7.0" => "72",
|
66
|
+
"1.3.6.1.2.1.1.8.0" => /Timeticks: \(\d+\) \d+ days, \d+:\d+:\d+\.\d+/
|
67
67
|
}
|
68
68
|
end
|
69
69
|
let(:set_oid_result) { 43 }
|
data/spec/pdu_spec.rb
CHANGED
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.6.
|
4
|
+
version: 0.6.4
|
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: 2022-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parslet
|
@@ -56,13 +56,16 @@ files:
|
|
56
56
|
- lib/netsnmp/varbind.rb
|
57
57
|
- lib/netsnmp/version.rb
|
58
58
|
- sig/client.rbs
|
59
|
+
- sig/encryption/aes.rbs
|
60
|
+
- sig/encryption/des.rbs
|
61
|
+
- sig/errors.rbs
|
62
|
+
- sig/extensions.rbs
|
59
63
|
- sig/loggable.rbs
|
60
64
|
- sig/message.rbs
|
61
65
|
- sig/mib.rbs
|
62
66
|
- sig/mib/parser.rbs
|
63
67
|
- sig/netsnmp.rbs
|
64
68
|
- sig/oid.rbs
|
65
|
-
- sig/openssl.rbs
|
66
69
|
- sig/pdu.rbs
|
67
70
|
- sig/scoped_pdu.rbs
|
68
71
|
- sig/security_parameters.rbs
|
@@ -88,6 +91,7 @@ licenses:
|
|
88
91
|
- Apache-2.0
|
89
92
|
metadata:
|
90
93
|
allowed_push_host: https://rubygems.org/
|
94
|
+
rubygems_mfa_required: 'true'
|
91
95
|
post_install_message:
|
92
96
|
rdoc_options: []
|
93
97
|
require_paths:
|
@@ -104,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
108
|
version: '0'
|
105
109
|
requirements:
|
106
110
|
- net-snmp
|
107
|
-
rubygems_version: 3.2.
|
111
|
+
rubygems_version: 3.2.32
|
108
112
|
signing_key:
|
109
113
|
specification_version: 4
|
110
114
|
summary: SNMP Client library
|
data/sig/openssl.rbs
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module OpenSSL
|
2
|
-
module ASN1
|
3
|
-
class ASN1Data
|
4
|
-
end
|
5
|
-
class ObjectId < ASN1Data
|
6
|
-
end
|
7
|
-
class Primitive < ASN1Data
|
8
|
-
end
|
9
|
-
class Integer < ASN1Data
|
10
|
-
end
|
11
|
-
class OctetString < ASN1Data
|
12
|
-
end
|
13
|
-
class Sequence < ASN1Data
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
interface _ToAsn
|
19
|
-
def to_asn: () -> OpenSSL::ASN1::ASN1Data
|
20
|
-
end
|