rubyntlm 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +3 -3
- data/.rspec +2 -2
- data/.travis.yml +10 -11
- data/CHANGELOG.md +5 -5
- data/Gemfile +3 -3
- data/LICENSE +19 -19
- data/Rakefile +22 -22
- data/lib/net/ntlm.rb +266 -263
- data/lib/net/ntlm/blob.rb +28 -28
- data/lib/net/ntlm/channel_binding.rb +65 -0
- data/lib/net/ntlm/client.rb +65 -65
- data/lib/net/ntlm/client/session.rb +237 -223
- data/lib/net/ntlm/encode_util.rb +49 -49
- data/lib/net/ntlm/exceptions.rb +14 -0
- data/lib/net/ntlm/field.rb +34 -34
- data/lib/net/ntlm/field_set.rb +129 -129
- data/lib/net/ntlm/int16_le.rb +25 -25
- data/lib/net/ntlm/int32_le.rb +24 -24
- data/lib/net/ntlm/int64_le.rb +25 -25
- data/lib/net/ntlm/message.rb +129 -129
- data/lib/net/ntlm/message/type0.rb +16 -16
- data/lib/net/ntlm/message/type1.rb +18 -18
- data/lib/net/ntlm/message/type2.rb +102 -102
- data/lib/net/ntlm/message/type3.rb +131 -131
- data/lib/net/ntlm/security_buffer.rb +47 -47
- data/lib/net/ntlm/string.rb +34 -34
- data/lib/net/ntlm/target_info.rb +89 -0
- data/lib/net/ntlm/version.rb +11 -11
- data/rubyntlm.gemspec +28 -28
- data/spec/lib/net/ntlm/blob_spec.rb +16 -16
- data/spec/lib/net/ntlm/channel_binding_spec.rb +17 -0
- data/spec/lib/net/ntlm/client/session_spec.rb +68 -68
- data/spec/lib/net/ntlm/client_spec.rb +64 -64
- data/spec/lib/net/ntlm/encode_util_spec.rb +16 -16
- data/spec/lib/net/ntlm/field_set_spec.rb +33 -33
- data/spec/lib/net/ntlm/field_spec.rb +34 -34
- data/spec/lib/net/ntlm/int16_le_spec.rb +17 -17
- data/spec/lib/net/ntlm/int32_le_spec.rb +18 -18
- data/spec/lib/net/ntlm/int64_le_spec.rb +18 -18
- data/spec/lib/net/ntlm/message/type0_spec.rb +20 -20
- data/spec/lib/net/ntlm/message/type1_spec.rb +131 -131
- data/spec/lib/net/ntlm/message/type2_spec.rb +132 -132
- data/spec/lib/net/ntlm/message/type3_spec.rb +225 -225
- data/spec/lib/net/ntlm/message_spec.rb +16 -16
- data/spec/lib/net/ntlm/security_buffer_spec.rb +64 -64
- data/spec/lib/net/ntlm/string_spec.rb +72 -72
- data/spec/lib/net/ntlm/target_info_spec.rb +76 -0
- data/spec/lib/net/ntlm/version_spec.rb +27 -27
- data/spec/lib/net/ntlm_spec.rb +127 -127
- data/spec/spec_helper.rb +22 -22
- data/spec/support/certificates/sha_256_hash.pem +19 -0
- data/spec/support/shared/examples/net/ntlm/field_shared.rb +25 -25
- data/spec/support/shared/examples/net/ntlm/fieldset_shared.rb +239 -239
- data/spec/support/shared/examples/net/ntlm/int_shared.rb +43 -43
- data/spec/support/shared/examples/net/ntlm/message_shared.rb +35 -35
- metadata +12 -3
@@ -1,34 +1,34 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Net::NTLM::Field do
|
4
|
-
|
5
|
-
it_behaves_like 'a field', 'Foo', false
|
6
|
-
|
7
|
-
context 'with no size specified' do
|
8
|
-
let (:field_without_size) { Net::NTLM::Field.new({ :value => 'Foo', :active => true }) }
|
9
|
-
it 'should set size to 0 if not active' do
|
10
|
-
expect(field_without_size.size).to eq(0)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should return 0 if active but no size specified' do
|
14
|
-
field_without_size.active = true
|
15
|
-
expect(field_without_size.size).to eq(0)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'with a size specified' do
|
20
|
-
let (:field_with_size) { Net::NTLM::Field.new({ :value => 'Foo', :active => true, :size => 100 }) }
|
21
|
-
|
22
|
-
it 'should return the size provided in the initialize options if active' do
|
23
|
-
expect(field_with_size.size).to eq(100)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should still return 0 if not active' do
|
27
|
-
field_with_size.active = false
|
28
|
-
expect(field_with_size.size).to eq(0)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Net::NTLM::Field do
|
4
|
+
|
5
|
+
it_behaves_like 'a field', 'Foo', false
|
6
|
+
|
7
|
+
context 'with no size specified' do
|
8
|
+
let (:field_without_size) { Net::NTLM::Field.new({ :value => 'Foo', :active => true }) }
|
9
|
+
it 'should set size to 0 if not active' do
|
10
|
+
expect(field_without_size.size).to eq(0)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should return 0 if active but no size specified' do
|
14
|
+
field_without_size.active = true
|
15
|
+
expect(field_without_size.size).to eq(0)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'with a size specified' do
|
20
|
+
let (:field_with_size) { Net::NTLM::Field.new({ :value => 'Foo', :active => true, :size => 100 }) }
|
21
|
+
|
22
|
+
it 'should return the size provided in the initialize options if active' do
|
23
|
+
expect(field_with_size.size).to eq(100)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should still return 0 if not active' do
|
27
|
+
field_with_size.active = false
|
28
|
+
expect(field_with_size.size).to eq(0)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Net::NTLM::Int16LE do
|
4
|
-
|
5
|
-
int_values = {
|
6
|
-
:default => 15,
|
7
|
-
:default_hex => "\x0F\x00",
|
8
|
-
:alt => 14,
|
9
|
-
:alt_hex => "\x0E\x00",
|
10
|
-
:small => "\x0F",
|
11
|
-
:size => 2,
|
12
|
-
:bits => 16
|
13
|
-
}
|
14
|
-
|
15
|
-
it_behaves_like 'a field', 15, false
|
16
|
-
it_behaves_like 'an integer field', int_values
|
17
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Net::NTLM::Int16LE do
|
4
|
+
|
5
|
+
int_values = {
|
6
|
+
:default => 15,
|
7
|
+
:default_hex => "\x0F\x00",
|
8
|
+
:alt => 14,
|
9
|
+
:alt_hex => "\x0E\x00",
|
10
|
+
:small => "\x0F",
|
11
|
+
:size => 2,
|
12
|
+
:bits => 16
|
13
|
+
}
|
14
|
+
|
15
|
+
it_behaves_like 'a field', 15, false
|
16
|
+
it_behaves_like 'an integer field', int_values
|
17
|
+
|
18
18
|
end
|
@@ -1,19 +1,19 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Net::NTLM::Int32LE do
|
4
|
-
|
5
|
-
int_values = {
|
6
|
-
:default => 252716124,
|
7
|
-
:default_hex => "\x5C\x24\x10\x0f",
|
8
|
-
:alt => 235938908,
|
9
|
-
:alt_hex => "\x5C\x24\x10\x0e",
|
10
|
-
:small => "\x0F\x00",
|
11
|
-
:size => 4,
|
12
|
-
:bits => 32
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
it_behaves_like 'a field', 252716124, false
|
17
|
-
it_behaves_like 'an integer field', int_values
|
18
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Net::NTLM::Int32LE do
|
4
|
+
|
5
|
+
int_values = {
|
6
|
+
:default => 252716124,
|
7
|
+
:default_hex => "\x5C\x24\x10\x0f",
|
8
|
+
:alt => 235938908,
|
9
|
+
:alt_hex => "\x5C\x24\x10\x0e",
|
10
|
+
:small => "\x0F\x00",
|
11
|
+
:size => 4,
|
12
|
+
:bits => 32
|
13
|
+
}
|
14
|
+
|
15
|
+
|
16
|
+
it_behaves_like 'a field', 252716124, false
|
17
|
+
it_behaves_like 'an integer field', int_values
|
18
|
+
|
19
19
|
end
|
@@ -1,19 +1,19 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Net::NTLM::Int64LE do
|
4
|
-
|
5
|
-
int_values = {
|
6
|
-
:default => 5294967295,
|
7
|
-
:default_hex => [5294967295 & 0x00000000ffffffff, 5294967295 >> 32].pack("V2"),
|
8
|
-
:alt => 5294967294,
|
9
|
-
:alt_hex => [5294967294 & 0x00000000ffffffff, 5294967294 >> 32].pack("V2"),
|
10
|
-
:small => "\x5C\x24\x10\x0f",
|
11
|
-
:size => 8,
|
12
|
-
:bits => 64
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
it_behaves_like 'a field', 252716124, false
|
17
|
-
it_behaves_like 'an integer field', int_values
|
18
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Net::NTLM::Int64LE do
|
4
|
+
|
5
|
+
int_values = {
|
6
|
+
:default => 5294967295,
|
7
|
+
:default_hex => [5294967295 & 0x00000000ffffffff, 5294967295 >> 32].pack("V2"),
|
8
|
+
:alt => 5294967294,
|
9
|
+
:alt_hex => [5294967294 & 0x00000000ffffffff, 5294967294 >> 32].pack("V2"),
|
10
|
+
:small => "\x5C\x24\x10\x0f",
|
11
|
+
:size => 8,
|
12
|
+
:bits => 64
|
13
|
+
}
|
14
|
+
|
15
|
+
|
16
|
+
it_behaves_like 'a field', 252716124, false
|
17
|
+
it_behaves_like 'an integer field', int_values
|
18
|
+
|
19
19
|
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Net::NTLM::Message::Type0 do
|
4
|
-
|
5
|
-
fields = [
|
6
|
-
{ :name => :sign, :class => Net::NTLM::String, :value => Net::NTLM::SSP_SIGN, :active => true },
|
7
|
-
{ :name => :type, :class => Net::NTLM::Int32LE, :value => 0, :active => true },
|
8
|
-
]
|
9
|
-
flags = [
|
10
|
-
:UNICODE,
|
11
|
-
:OEM,
|
12
|
-
:REQUEST_TARGET,
|
13
|
-
:NTLM,
|
14
|
-
:ALWAYS_SIGN,
|
15
|
-
:NTLM2_KEY
|
16
|
-
]
|
17
|
-
it_behaves_like 'a fieldset', fields
|
18
|
-
it_behaves_like 'a message', flags
|
19
|
-
|
20
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Net::NTLM::Message::Type0 do
|
4
|
+
|
5
|
+
fields = [
|
6
|
+
{ :name => :sign, :class => Net::NTLM::String, :value => Net::NTLM::SSP_SIGN, :active => true },
|
7
|
+
{ :name => :type, :class => Net::NTLM::Int32LE, :value => 0, :active => true },
|
8
|
+
]
|
9
|
+
flags = [
|
10
|
+
:UNICODE,
|
11
|
+
:OEM,
|
12
|
+
:REQUEST_TARGET,
|
13
|
+
:NTLM,
|
14
|
+
:ALWAYS_SIGN,
|
15
|
+
:NTLM2_KEY
|
16
|
+
]
|
17
|
+
it_behaves_like 'a fieldset', fields
|
18
|
+
it_behaves_like 'a message', flags
|
19
|
+
|
20
|
+
|
21
21
|
end
|
@@ -1,131 +1,131 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Net::NTLM::Message::Type1 do
|
4
|
-
fields = [
|
5
|
-
{ :name => :sign, :class => Net::NTLM::String, :value => Net::NTLM::SSP_SIGN, :active => true },
|
6
|
-
{ :name => :type, :class => Net::NTLM::Int32LE, :value => 1, :active => true },
|
7
|
-
{ :name => :flag, :class => Net::NTLM::Int32LE, :value => Net::NTLM::DEFAULT_FLAGS[:TYPE1], :active => true },
|
8
|
-
{ :name => :domain, :class => Net::NTLM::SecurityBuffer, :value => '', :active => true },
|
9
|
-
{ :name => :workstation, :class => Net::NTLM::SecurityBuffer, :value => Socket.gethostname, :active => true },
|
10
|
-
{ :name => :os_version, :class => Net::NTLM::String, :value => '', :active => false },
|
11
|
-
]
|
12
|
-
flags = [
|
13
|
-
:UNICODE,
|
14
|
-
:OEM,
|
15
|
-
:REQUEST_TARGET,
|
16
|
-
:NTLM,
|
17
|
-
:ALWAYS_SIGN,
|
18
|
-
:NTLM2_KEY
|
19
|
-
]
|
20
|
-
it_behaves_like 'a fieldset', fields
|
21
|
-
it_behaves_like 'a message', flags
|
22
|
-
|
23
|
-
let(:type1_packet) {"TlRMTVNTUAABAAAAB4IIAAAAAAAgAAAAAAAAACAAAAA="}
|
24
|
-
|
25
|
-
it 'should deserialize' do
|
26
|
-
t1 = Net::NTLM::Message.decode64(type1_packet)
|
27
|
-
expect(t1.class).to eq(Net::NTLM::Message::Type1)
|
28
|
-
expect(t1.domain).to eq('')
|
29
|
-
expect(t1.flag).to eq(557575)
|
30
|
-
expect(t1.os_version).to eq('')
|
31
|
-
expect(t1.sign).to eq("NTLMSSP\0")
|
32
|
-
expect(t1.type).to eq(1)
|
33
|
-
expect(t1.workstation).to eq('')
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'should serialize' do
|
37
|
-
t1 = Net::NTLM::Message::Type1.new
|
38
|
-
t1.workstation = ''
|
39
|
-
expect(t1.encode64).to eq(type1_packet)
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '.parse' do
|
43
|
-
subject(:message) { described_class.parse(data) }
|
44
|
-
# http://davenport.sourceforge.net/ntlm.html#appendixC7
|
45
|
-
context 'NTLM2 Session Response Authentication; NTLM2 Signing and Sealing Using the 128-bit NTLM2 Session Response User Session Key With Key Exchange Negotiated' do
|
46
|
-
let(:data) do
|
47
|
-
['4e544c4d5353500001000000b78208e000000000000000000000000000000000'].pack('H*')
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'should set the magic' do
|
51
|
-
expect(message.sign).to eql(Net::NTLM::SSP_SIGN)
|
52
|
-
end
|
53
|
-
it 'should set the type' do
|
54
|
-
expect(message.type).to eq(1)
|
55
|
-
end
|
56
|
-
it 'should set the flags' do
|
57
|
-
expect(message.flag).to eq(0xe00882b7)
|
58
|
-
expect(message).to have_flag(:UNICODE)
|
59
|
-
expect(message).to have_flag(:OEM)
|
60
|
-
expect(message).to have_flag(:REQUEST_TARGET)
|
61
|
-
expect(message).to have_flag(:SIGN)
|
62
|
-
expect(message).to have_flag(:SEAL)
|
63
|
-
expect(message).to have_flag(:NTLM)
|
64
|
-
expect(message).to have_flag(:ALWAYS_SIGN)
|
65
|
-
expect(message).to have_flag(:NTLM2_KEY)
|
66
|
-
expect(message).to have_flag(:KEY128)
|
67
|
-
expect(message).to have_flag(:KEY_EXCHANGE)
|
68
|
-
expect(message).to have_flag(:KEY56)
|
69
|
-
end
|
70
|
-
it 'should have empty workstation' do
|
71
|
-
expect(message.workstation).to be_empty
|
72
|
-
end
|
73
|
-
it 'should have empty domain' do
|
74
|
-
expect(message.domain).to be_empty
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
# http://davenport.sourceforge.net/ntlm.html#appendixC9
|
80
|
-
context 'NTLMv2 Authentication; NTLM1 Signing and Sealing Using the 40-bit NTLMv2 User Session Key' do
|
81
|
-
let(:data) { ['4e544c4d53535000010000003782000000000000000000000000000000000000'].pack('H*') }
|
82
|
-
|
83
|
-
it 'should set the magic' do
|
84
|
-
expect(message.sign).to eql(Net::NTLM::SSP_SIGN)
|
85
|
-
end
|
86
|
-
it 'should set the type' do
|
87
|
-
expect(message.type).to eq(1)
|
88
|
-
end
|
89
|
-
it 'should set the flags' do
|
90
|
-
expect(message.flag).to eq(0x00008237)
|
91
|
-
expect(message).to have_flag(:UNICODE)
|
92
|
-
expect(message).to have_flag(:OEM)
|
93
|
-
expect(message).to have_flag(:REQUEST_TARGET)
|
94
|
-
expect(message).to have_flag(:SIGN)
|
95
|
-
expect(message).to have_flag(:SEAL)
|
96
|
-
expect(message).to have_flag(:NTLM)
|
97
|
-
expect(message).to have_flag(:ALWAYS_SIGN)
|
98
|
-
end
|
99
|
-
it 'should have empty workstation' do
|
100
|
-
expect(message.workstation).to be_empty
|
101
|
-
end
|
102
|
-
it 'should have empty domain' do
|
103
|
-
expect(message.domain).to be_empty
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
context 'NTLMv2 with OS version' do
|
108
|
-
let(:data) { ['4e544c4d5353500001000000978208e2000000000000000000000000000000000602f0230000000f'].pack('H*') }
|
109
|
-
|
110
|
-
it 'should set the magic' do
|
111
|
-
expect(message.sign).to eql(Net::NTLM::SSP_SIGN)
|
112
|
-
end
|
113
|
-
it 'should set the type' do
|
114
|
-
expect(message.type).to eq(1)
|
115
|
-
end
|
116
|
-
it 'should have empty workstation' do
|
117
|
-
expect(message.workstation).to be_empty
|
118
|
-
end
|
119
|
-
it 'should have empty domain' do
|
120
|
-
expect(message.domain).to be_empty
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'should set OS version info' do
|
124
|
-
expect(message.os_version).to eq(['0602f0230000000f'].pack('H*'))
|
125
|
-
end
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
end
|
130
|
-
|
131
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Net::NTLM::Message::Type1 do
|
4
|
+
fields = [
|
5
|
+
{ :name => :sign, :class => Net::NTLM::String, :value => Net::NTLM::SSP_SIGN, :active => true },
|
6
|
+
{ :name => :type, :class => Net::NTLM::Int32LE, :value => 1, :active => true },
|
7
|
+
{ :name => :flag, :class => Net::NTLM::Int32LE, :value => Net::NTLM::DEFAULT_FLAGS[:TYPE1], :active => true },
|
8
|
+
{ :name => :domain, :class => Net::NTLM::SecurityBuffer, :value => '', :active => true },
|
9
|
+
{ :name => :workstation, :class => Net::NTLM::SecurityBuffer, :value => Socket.gethostname, :active => true },
|
10
|
+
{ :name => :os_version, :class => Net::NTLM::String, :value => '', :active => false },
|
11
|
+
]
|
12
|
+
flags = [
|
13
|
+
:UNICODE,
|
14
|
+
:OEM,
|
15
|
+
:REQUEST_TARGET,
|
16
|
+
:NTLM,
|
17
|
+
:ALWAYS_SIGN,
|
18
|
+
:NTLM2_KEY
|
19
|
+
]
|
20
|
+
it_behaves_like 'a fieldset', fields
|
21
|
+
it_behaves_like 'a message', flags
|
22
|
+
|
23
|
+
let(:type1_packet) {"TlRMTVNTUAABAAAAB4IIAAAAAAAgAAAAAAAAACAAAAA="}
|
24
|
+
|
25
|
+
it 'should deserialize' do
|
26
|
+
t1 = Net::NTLM::Message.decode64(type1_packet)
|
27
|
+
expect(t1.class).to eq(Net::NTLM::Message::Type1)
|
28
|
+
expect(t1.domain).to eq('')
|
29
|
+
expect(t1.flag).to eq(557575)
|
30
|
+
expect(t1.os_version).to eq('')
|
31
|
+
expect(t1.sign).to eq("NTLMSSP\0")
|
32
|
+
expect(t1.type).to eq(1)
|
33
|
+
expect(t1.workstation).to eq('')
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should serialize' do
|
37
|
+
t1 = Net::NTLM::Message::Type1.new
|
38
|
+
t1.workstation = ''
|
39
|
+
expect(t1.encode64).to eq(type1_packet)
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '.parse' do
|
43
|
+
subject(:message) { described_class.parse(data) }
|
44
|
+
# http://davenport.sourceforge.net/ntlm.html#appendixC7
|
45
|
+
context 'NTLM2 Session Response Authentication; NTLM2 Signing and Sealing Using the 128-bit NTLM2 Session Response User Session Key With Key Exchange Negotiated' do
|
46
|
+
let(:data) do
|
47
|
+
['4e544c4d5353500001000000b78208e000000000000000000000000000000000'].pack('H*')
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should set the magic' do
|
51
|
+
expect(message.sign).to eql(Net::NTLM::SSP_SIGN)
|
52
|
+
end
|
53
|
+
it 'should set the type' do
|
54
|
+
expect(message.type).to eq(1)
|
55
|
+
end
|
56
|
+
it 'should set the flags' do
|
57
|
+
expect(message.flag).to eq(0xe00882b7)
|
58
|
+
expect(message).to have_flag(:UNICODE)
|
59
|
+
expect(message).to have_flag(:OEM)
|
60
|
+
expect(message).to have_flag(:REQUEST_TARGET)
|
61
|
+
expect(message).to have_flag(:SIGN)
|
62
|
+
expect(message).to have_flag(:SEAL)
|
63
|
+
expect(message).to have_flag(:NTLM)
|
64
|
+
expect(message).to have_flag(:ALWAYS_SIGN)
|
65
|
+
expect(message).to have_flag(:NTLM2_KEY)
|
66
|
+
expect(message).to have_flag(:KEY128)
|
67
|
+
expect(message).to have_flag(:KEY_EXCHANGE)
|
68
|
+
expect(message).to have_flag(:KEY56)
|
69
|
+
end
|
70
|
+
it 'should have empty workstation' do
|
71
|
+
expect(message.workstation).to be_empty
|
72
|
+
end
|
73
|
+
it 'should have empty domain' do
|
74
|
+
expect(message.domain).to be_empty
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
# http://davenport.sourceforge.net/ntlm.html#appendixC9
|
80
|
+
context 'NTLMv2 Authentication; NTLM1 Signing and Sealing Using the 40-bit NTLMv2 User Session Key' do
|
81
|
+
let(:data) { ['4e544c4d53535000010000003782000000000000000000000000000000000000'].pack('H*') }
|
82
|
+
|
83
|
+
it 'should set the magic' do
|
84
|
+
expect(message.sign).to eql(Net::NTLM::SSP_SIGN)
|
85
|
+
end
|
86
|
+
it 'should set the type' do
|
87
|
+
expect(message.type).to eq(1)
|
88
|
+
end
|
89
|
+
it 'should set the flags' do
|
90
|
+
expect(message.flag).to eq(0x00008237)
|
91
|
+
expect(message).to have_flag(:UNICODE)
|
92
|
+
expect(message).to have_flag(:OEM)
|
93
|
+
expect(message).to have_flag(:REQUEST_TARGET)
|
94
|
+
expect(message).to have_flag(:SIGN)
|
95
|
+
expect(message).to have_flag(:SEAL)
|
96
|
+
expect(message).to have_flag(:NTLM)
|
97
|
+
expect(message).to have_flag(:ALWAYS_SIGN)
|
98
|
+
end
|
99
|
+
it 'should have empty workstation' do
|
100
|
+
expect(message.workstation).to be_empty
|
101
|
+
end
|
102
|
+
it 'should have empty domain' do
|
103
|
+
expect(message.domain).to be_empty
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
context 'NTLMv2 with OS version' do
|
108
|
+
let(:data) { ['4e544c4d5353500001000000978208e2000000000000000000000000000000000602f0230000000f'].pack('H*') }
|
109
|
+
|
110
|
+
it 'should set the magic' do
|
111
|
+
expect(message.sign).to eql(Net::NTLM::SSP_SIGN)
|
112
|
+
end
|
113
|
+
it 'should set the type' do
|
114
|
+
expect(message.type).to eq(1)
|
115
|
+
end
|
116
|
+
it 'should have empty workstation' do
|
117
|
+
expect(message.workstation).to be_empty
|
118
|
+
end
|
119
|
+
it 'should have empty domain' do
|
120
|
+
expect(message.domain).to be_empty
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'should set OS version info' do
|
124
|
+
expect(message.os_version).to eq(['0602f0230000000f'].pack('H*'))
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|