packetgen-plugin-smb 0.6.3 → 0.7.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/.github/workflows/specs.yml +7 -3
- data/.rubocop.yml +5 -5
- data/Gemfile +7 -7
- data/README.md +8 -4
- data/examples/llmnr-responder +2 -2
- data/examples/smb-responder +8 -8
- data/lib/packetgen/plugin/gssapi.rb +7 -5
- data/lib/packetgen/plugin/netbios/datagram.rb +25 -27
- data/lib/packetgen/plugin/netbios/name.rb +3 -3
- data/lib/packetgen/plugin/netbios/session.rb +3 -3
- data/lib/packetgen/plugin/netbios.rb +0 -2
- data/lib/packetgen/plugin/ntlm/authenticate.rb +7 -7
- data/lib/packetgen/plugin/ntlm/av_pair.rb +17 -17
- data/lib/packetgen/plugin/ntlm/challenge.rb +4 -4
- data/lib/packetgen/plugin/ntlm/negotiate.rb +6 -6
- data/lib/packetgen/plugin/ntlm/ntlmv2_response.rb +10 -10
- data/lib/packetgen/plugin/ntlm.rb +21 -22
- data/lib/packetgen/plugin/smb/blocks.rb +8 -8
- data/lib/packetgen/plugin/smb/browser/domain_announcement.rb +1 -1
- data/lib/packetgen/plugin/smb/browser/host_announcement.rb +12 -12
- data/lib/packetgen/plugin/smb/browser/local_master_announcement.rb +1 -1
- data/lib/packetgen/plugin/smb/browser.rb +5 -5
- data/lib/packetgen/plugin/smb/close/request.rb +4 -4
- data/lib/packetgen/plugin/smb/close/response.rb +3 -3
- data/lib/packetgen/plugin/smb/filetime.rb +4 -6
- data/lib/packetgen/plugin/smb/negotiate/dialect.rb +5 -5
- data/lib/packetgen/plugin/smb/negotiate/request.rb +4 -4
- data/lib/packetgen/plugin/smb/ntcreateandx/request.rb +23 -23
- data/lib/packetgen/plugin/smb/ntcreateandx/response.rb +21 -21
- data/lib/packetgen/plugin/smb/string.rb +1 -1
- data/lib/packetgen/plugin/smb/trans/request.rb +24 -23
- data/lib/packetgen/plugin/smb/trans/response.rb +18 -17
- data/lib/packetgen/plugin/smb.rb +52 -62
- data/lib/packetgen/plugin/smb2/base.rb +4 -4
- data/lib/packetgen/plugin/smb2/error.rb +6 -6
- data/lib/packetgen/plugin/smb2/guid.rb +12 -12
- data/lib/packetgen/plugin/smb2/negotiate/context.rb +19 -19
- data/lib/packetgen/plugin/smb2/negotiate/request.rb +27 -27
- data/lib/packetgen/plugin/smb2/negotiate/response.rb +31 -26
- data/lib/packetgen/plugin/smb2/session_setup/request.rb +9 -11
- data/lib/packetgen/plugin/smb2/session_setup/response.rb +5 -6
- data/lib/packetgen/plugin/smb2.rb +49 -55
- data/lib/packetgen/plugin/smb_version.rb +1 -1
- data/packetgen-plugin-smb.gemspec +3 -3
- metadata +12 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2f94bc3d0ed58308ab1d611d9faa159f435a63a814212a3ee14fa6272674d32
|
4
|
+
data.tar.gz: 6148519a4129845f7666ec176a794a5165877ef9a1baa087949c168ff0b0336e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cefd0a896096abb5c01234e3836b4b9aae5a1c408debdaafc997d57dbaa6cd778df977704ee5e64d9fb16f25720df15f5163d1470bbe85c8637364191e50cb6
|
7
|
+
data.tar.gz: 477d0dcee0533af2591c3ba0c8dcfe43b872cbd12a44a06a9195ad11850bc88c78d2a5c595577eee3f77c7109072240a38515a9955c8294ae4756d6cd8e823f7
|
data/.github/workflows/specs.yml
CHANGED
@@ -1,28 +1,32 @@
|
|
1
1
|
name: Specs
|
2
|
+
|
2
3
|
on:
|
3
4
|
push:
|
4
5
|
branches: [ master ]
|
5
6
|
pull_request:
|
6
7
|
branches: [ master ]
|
8
|
+
|
7
9
|
jobs:
|
8
10
|
test:
|
9
11
|
strategy:
|
10
12
|
fail-fast: false
|
11
13
|
matrix:
|
12
14
|
os: [ubuntu-latest]
|
13
|
-
ruby: ['
|
15
|
+
ruby: ['3.0', '3.1', '3.2', '3.3', '3.4']
|
14
16
|
runs-on: ${{ matrix.os }}
|
15
17
|
steps:
|
16
|
-
- uses: actions/checkout@
|
18
|
+
- uses: actions/checkout@v4
|
17
19
|
- name: Install dependencies
|
18
20
|
run: sudo apt-get update -qq && sudo apt-get install libpcap-dev -qq
|
19
21
|
- name: Set up Ruby
|
20
22
|
uses: ruby/setup-ruby@v1
|
21
23
|
with:
|
22
24
|
ruby-version: ${{ matrix.ruby }}
|
23
|
-
- name:
|
25
|
+
- name: Install Gems
|
24
26
|
run: |
|
25
27
|
bundle config set path 'vendor/bundle'
|
26
28
|
bundle config set --local without noci
|
27
29
|
bundle install
|
30
|
+
- name: Run tests
|
31
|
+
run: |
|
28
32
|
bundle exec rake
|
data/.rubocop.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
plugins:
|
2
2
|
- rubocop-performance
|
3
3
|
AllCops:
|
4
|
-
TargetRubyVersion:
|
4
|
+
TargetRubyVersion: "3.0"
|
5
5
|
NewCops: enable
|
6
6
|
Exclude:
|
7
7
|
- .git/**/*
|
@@ -16,11 +16,11 @@ Lint/EmptyWhen:
|
|
16
16
|
Lint/Void:
|
17
17
|
Enabled: false
|
18
18
|
Metrics/AbcSize:
|
19
|
-
|
19
|
+
Max: 20
|
20
20
|
Metrics/ClassLength:
|
21
|
-
|
21
|
+
Max: 200
|
22
22
|
Metrics/MethodLength:
|
23
|
-
|
23
|
+
Max: 20
|
24
24
|
Metrics/ParameterLists:
|
25
25
|
MaxOptionalParameters: 4
|
26
26
|
Naming/FileName:
|
data/Gemfile
CHANGED
@@ -5,14 +5,14 @@ source 'https://rubygems.org'
|
|
5
5
|
gemspec
|
6
6
|
|
7
7
|
gem 'bundler', '>=1.17', '<3'
|
8
|
-
gem 'rake', '~>
|
9
|
-
gem 'rspec', '~>
|
8
|
+
gem 'rake', '~>13.0', require: false
|
9
|
+
gem 'rspec', '~>3.13'
|
10
10
|
|
11
11
|
group :noci do
|
12
|
-
gem '
|
13
|
-
gem 'rubocop', '~> 1.
|
14
|
-
gem '
|
15
|
-
gem 'ruby-
|
12
|
+
gem 'rubocop', '~> 1.75', require: false
|
13
|
+
gem 'rubocop-performance', '~> 1.25', require: false
|
14
|
+
gem 'ruby-lsp', require: false
|
15
|
+
gem 'ruby-lsp-rspec', require: false
|
16
16
|
gem 'simplecov', '~> 0.18'
|
17
|
-
gem 'yard', '~> 0.9'
|
17
|
+
gem 'yard', '~> 0.9', require: false
|
18
18
|
end
|
data/README.md
CHANGED
@@ -32,11 +32,15 @@ gem 'packetgen-plugin-smb'
|
|
32
32
|
|
33
33
|
And then execute:
|
34
34
|
|
35
|
-
|
35
|
+
```bash
|
36
|
+
bundle
|
37
|
+
```
|
36
38
|
|
37
39
|
Or install it yourself as:
|
38
40
|
|
39
|
-
|
41
|
+
```bash
|
42
|
+
gem install packetgen-plugin-smb
|
43
|
+
```
|
40
44
|
|
41
45
|
## Usage
|
42
46
|
|
@@ -79,7 +83,7 @@ You have to manage multicast if you want to make a LLMNR responder. For further
|
|
79
83
|
|
80
84
|
## See also
|
81
85
|
|
82
|
-
API documentation: http://www.rubydoc.info/gems/packetgen-plugin-smb
|
86
|
+
API documentation: <http://www.rubydoc.info/gems/packetgen-plugin-smb>
|
83
87
|
|
84
88
|
## License
|
85
89
|
|
@@ -87,4 +91,4 @@ MIT License (see [LICENSE](https://github.com/sdaubert/packetgen-plugin-smb/blob
|
|
87
91
|
|
88
92
|
## Contributing
|
89
93
|
|
90
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/sdaubert/packetgen-plugin-smb
|
94
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/sdaubert/packetgen-plugin-smb>.
|
data/examples/llmnr-responder
CHANGED
@@ -70,7 +70,7 @@ class LlmnrResponder
|
|
70
70
|
end
|
71
71
|
response_pkt.calc
|
72
72
|
|
73
|
-
next unless response_pkt.llmnr.ancount
|
73
|
+
next unless response_pkt.llmnr.ancount.positive?
|
74
74
|
|
75
75
|
socket.send(response_pkt.to_s, 0, peer_ip, peer_port)
|
76
76
|
end
|
@@ -105,6 +105,6 @@ end
|
|
105
105
|
|
106
106
|
options = parse_options
|
107
107
|
|
108
|
-
check_options
|
108
|
+
check_options(options)
|
109
109
|
|
110
110
|
LlmnrResponder.new.start(bind_addr: BIND_ADDR, iface: options[:iface])
|
data/examples/smb-responder
CHANGED
@@ -28,7 +28,7 @@ Credentials = Struct.new(:user, :computer, :challenge, :proof, :response, :ip) d
|
|
28
28
|
def to_s
|
29
29
|
user = self.user.encode('UTF-8')
|
30
30
|
computer = self.computer.encode('UTF-8')
|
31
|
-
str =
|
31
|
+
str = "User: #{user}\nComputer:#{computer} (IP: #{ip})\n"
|
32
32
|
str << "Challenge: #{challenge}\nProof: #{proof}\n"
|
33
33
|
str << "Response: #{response}"
|
34
34
|
end
|
@@ -77,7 +77,7 @@ class Smb2Responder
|
|
77
77
|
max_trans_size: SMB2_SIZE,
|
78
78
|
max_read_size: SMB2_SIZE,
|
79
79
|
max_write_size: SMB2_SIZE)
|
80
|
-
@resp1_pkt.smb2_negotiate_response[:buffer] =
|
80
|
+
@resp1_pkt.smb2_negotiate_response[:buffer] = BinStruct::String.new.read(SMB2_NEGO_RESP_BUFFER)
|
81
81
|
@resp1_pkt.calc
|
82
82
|
@resp1_pkt
|
83
83
|
end
|
@@ -105,13 +105,13 @@ class Smb2Responder
|
|
105
105
|
max_read_size: SMB2_SIZE,
|
106
106
|
max_write_size: SMB2_SIZE,
|
107
107
|
system_time: PacketGen::Plugin::SMB::Filetime.now,
|
108
|
-
buffer:
|
108
|
+
buffer: BinStruct::String.new.read(SMB2_NEGO_RESP_BUFFER))
|
109
109
|
|
110
110
|
pkt.smb2_negotiate_response.context_list << { type: 1, salt_length: SMB2_SALT_LEN, salt: salt }
|
111
|
-
pkt.smb2_negotiate_response.context_list.last.hash_alg <<
|
111
|
+
pkt.smb2_negotiate_response.context_list.last.hash_alg << BinStruct::Int16le.new(value: 1)
|
112
112
|
|
113
113
|
pkt.smb2_negotiate_response.context_list << { type: 2 }
|
114
|
-
pkt.smb2_negotiate_response.context_list.last.ciphers <<
|
114
|
+
pkt.smb2_negotiate_response.context_list.last.ciphers << BinStruct::Int16le.new(value: 1)
|
115
115
|
pkt.calc
|
116
116
|
pkt
|
117
117
|
end
|
@@ -165,7 +165,7 @@ class Smb2Responder
|
|
165
165
|
reserved: smb2_req.reserved)
|
166
166
|
.add('SMB2::SessionSetup::Response')
|
167
167
|
# Remove buffer
|
168
|
-
pkt.smb2_sessionsetup_response[:buffer] =
|
168
|
+
pkt.smb2_sessionsetup_response[:buffer] = BinStruct::String.new
|
169
169
|
pkt.calc
|
170
170
|
pkt
|
171
171
|
end
|
@@ -220,13 +220,13 @@ class Smb2Responder
|
|
220
220
|
client.send(pkt_to_send.to_s, 0) if pkt_to_send
|
221
221
|
client.close if to_close
|
222
222
|
|
223
|
-
puts credentials
|
223
|
+
puts credentials unless credentials.response.nil?
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
227
227
|
|
228
228
|
def binary2hex(str)
|
229
|
-
str.
|
229
|
+
str.unpack1('H*')
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
@@ -61,7 +61,7 @@ module PacketGen::Plugin
|
|
61
61
|
# gssapi[:token_resp][:response] #=> RASN1::Types::OctetString
|
62
62
|
# @author Sylvain Daubert
|
63
63
|
class GSSAPI < RASN1::Model
|
64
|
-
include
|
64
|
+
include BinStruct::Structable
|
65
65
|
|
66
66
|
# GSS API Negotiation Token Init
|
67
67
|
#
|
@@ -73,7 +73,8 @@ module PacketGen::Plugin
|
|
73
73
|
# * +mech_token+ is an optional OCTET STRING, explicitly tagged 2.
|
74
74
|
# * +mech_list_mic+ is an optional OCTET STRING, explicitly tagged 3.
|
75
75
|
class NegTokenInit < RASN1::Model
|
76
|
-
sequence :token,
|
76
|
+
sequence :token,
|
77
|
+
explicit: 0, class: :context, constructed: true,
|
77
78
|
content: [sequence_of(:mech_types, RASN1::Types::ObjectId, explicit: 0, class: :context),
|
78
79
|
bit_string(:req_flags, explicit: 1, class: :context, constructed: true, optional: true),
|
79
80
|
octet_string(:mech_token, explicit: 2, class: :context, constructed: true, optional: true),
|
@@ -89,7 +90,8 @@ module PacketGen::Plugin
|
|
89
90
|
'reject' => 2,
|
90
91
|
'request-mic' => 3
|
91
92
|
}.freeze
|
92
|
-
sequence :token,
|
93
|
+
sequence :token,
|
94
|
+
explicit: 1, class: :context, constructed: true,
|
93
95
|
content: [enumerated(:negstate, enum: NEG_STATES, explicit: 0, class: :context, constructed: true, optional: true),
|
94
96
|
objectid(:supported_mech, explicit: 1, class: :context, constructed: true, optional: true),
|
95
97
|
octet_string(:response, explicit: 2, class: :context, constructed: true, optional: true),
|
@@ -98,8 +100,8 @@ module PacketGen::Plugin
|
|
98
100
|
|
99
101
|
class NegTokenInitEnvelop < RASN1::Model
|
100
102
|
sequence(:init, implicit: 0, class: :application,
|
101
|
-
|
102
|
-
|
103
|
+
content: [objectid(:oid, value: '1.3.6.1.5.5.2'),
|
104
|
+
model(:token_init, NegTokenInit)])
|
103
105
|
end
|
104
106
|
|
105
107
|
choice :gssapi,
|
@@ -35,63 +35,61 @@ module PacketGen::Plugin
|
|
35
35
|
# @!attribute type
|
36
36
|
# 8-bit session packet type
|
37
37
|
# @return [Integer]
|
38
|
-
|
38
|
+
define_attr :type, BinStruct::Int8Enum, enum: TYPES
|
39
39
|
# @!attribute flags
|
40
40
|
# 8-bit flags
|
41
41
|
# @return [Integer]
|
42
|
-
|
42
|
+
# @!attribute :rsv
|
43
|
+
# 4-bit rsv field. 4 upper bits of {#flags}
|
44
|
+
# @return [Integer]
|
45
|
+
# @!attribute :snt
|
46
|
+
# 2-bit SNT (Source end-Node Type) field from {#flags}.
|
47
|
+
# @return [Integer]
|
48
|
+
# @!attribute f
|
49
|
+
# First packet flag. If set then this is first
|
50
|
+
# (and possibly only) fragment of NetBIOS datagram.
|
51
|
+
# @return [Boolean]
|
52
|
+
# @!attribute m
|
53
|
+
# More flag. If set then more NetBIOS datagram
|
54
|
+
# fragments follow.
|
55
|
+
# @return [Boolean]
|
56
|
+
define_bit_attr :flags, rsv: 4, snt: 2, f: 1, m: 1
|
43
57
|
# @!attribute dgm_id
|
44
58
|
# 16-bit next transaction ID for datagrams
|
45
59
|
# @return [Integer]
|
46
|
-
|
60
|
+
define_attr :dgm_id, BinStruct::Int16
|
47
61
|
# @!attribute src_ip
|
48
62
|
# Source IP address
|
49
63
|
# @return [IP::Addr]
|
50
|
-
|
64
|
+
define_attr :src_ip, PacketGen::Header::IP::Addr
|
51
65
|
# @!attribute src_port
|
52
66
|
# Source port
|
53
67
|
# @return [IP::Addr]
|
54
|
-
|
68
|
+
define_attr :src_port, BinStruct::Int16
|
55
69
|
# @!attribute dgm_length
|
56
70
|
# Length of data + second level of encoded names. Not present in error datagram.
|
57
71
|
# @return [Integer]
|
58
|
-
|
72
|
+
define_attr :dgm_length, BinStruct::Int16, optional: ->(h) { h.type != 0x13 }
|
59
73
|
# @!attribute packet_offset
|
60
74
|
# Not present in error datagram.
|
61
75
|
# @return [Integer]
|
62
|
-
|
76
|
+
define_attr :packet_offset, BinStruct::Int16, optional: ->(h) { h.type != 0x13 }
|
63
77
|
# @!attribute error_code
|
64
78
|
# Error code. Only present in error datagrams.
|
65
79
|
# @return [Integer]
|
66
|
-
|
80
|
+
define_attr :error_code, BinStruct::Int16, optional: ->(h) { h.type == 0x13 }
|
67
81
|
# @!attribute src_name
|
68
82
|
# NetBIOS source name. Only present in direct_unique, direct_group and broadcast datagrams.
|
69
83
|
# @return []
|
70
|
-
|
84
|
+
define_attr :src_name, Name, default: '', optional: ->(h) { (h.type >= 0x10) && (h.type <= 0x12) }
|
71
85
|
# @!attribute dst_name
|
72
86
|
# NetBIOS destination name. Present in all but error datagrams.
|
73
87
|
# @return []
|
74
|
-
|
88
|
+
define_attr :dst_name, Name, default: '', optional: ->(h) { h.type != 0x13 }
|
75
89
|
# @!attribute body
|
76
90
|
# User data. Ony present in direct_unique, direct_group and broadcast datagrams.
|
77
91
|
# @return [String]
|
78
|
-
|
79
|
-
|
80
|
-
# @!attribute :rsv
|
81
|
-
# 4-bit rsv field. 4 upper bits of {#flags}
|
82
|
-
# @return [Integer]
|
83
|
-
# @!attribute :snt
|
84
|
-
# 2-bit SNT (Source end-Node Type) field from {#flags}.
|
85
|
-
# @return [Integer]
|
86
|
-
# @!attribute f
|
87
|
-
# First packet flag. If set then this is first
|
88
|
-
# (and possibly only) fragment of NetBIOS datagram.
|
89
|
-
# @return [Boolean]
|
90
|
-
# @!attribute m
|
91
|
-
# More flag. If set then more NetBIOS datagram
|
92
|
-
# fragments follow.
|
93
|
-
# @return [Boolean]
|
94
|
-
define_bit_fields_on :flags, :rsv, 4, :snt, 2, :f, :m
|
92
|
+
define_attr :body, BinStruct::String, optional: ->(h) { (h.type >= 0x10) && (h.type <= 0x12) }
|
95
93
|
|
96
94
|
# Compute and set {#dgm_length} field
|
97
95
|
# @return [Integer] calculated length
|
@@ -37,7 +37,7 @@ module PacketGen::Plugin
|
|
37
37
|
|
38
38
|
def encode_name(name)
|
39
39
|
basename, *scope_id = name.split('.')
|
40
|
-
basename
|
40
|
+
basename ||= ''
|
41
41
|
scope_id = scope_id.join('.')
|
42
42
|
encoded_name = +''
|
43
43
|
basename.each_byte do |byte|
|
@@ -45,7 +45,7 @@ module PacketGen::Plugin
|
|
45
45
|
b = (byte & 0xf) + 0x41
|
46
46
|
encoded_name << [a, b].pack('C2')
|
47
47
|
end
|
48
|
-
encoded_name << 'CA' * ((ENCODED_NAME_SIZE - encoded_name.size) / 2) if encoded_name.size < ENCODED_NAME_SIZE
|
48
|
+
encoded_name << ('CA' * ((ENCODED_NAME_SIZE - encoded_name.size) / 2)) if encoded_name.size < ENCODED_NAME_SIZE
|
49
49
|
encoded_name << ".#{scope_id}" if scope_id
|
50
50
|
encoded_name
|
51
51
|
end
|
@@ -55,7 +55,7 @@ module PacketGen::Plugin
|
|
55
55
|
encoded_name.partition('.').first.scan(/../).map do |duo|
|
56
56
|
a = (duo[0].ord - 0x41) & 0xf
|
57
57
|
b = (duo[1].ord - 0x41) & 0xf
|
58
|
-
name << (a << 4 | b).chr
|
58
|
+
name << ((a << 4) | b).chr
|
59
59
|
end
|
60
60
|
name.strip
|
61
61
|
end
|
@@ -36,14 +36,14 @@ module PacketGen::Plugin
|
|
36
36
|
# @!attribute type
|
37
37
|
# 8-bit session packet type
|
38
38
|
# @return [Integer]
|
39
|
-
|
39
|
+
define_attr :type, BinStruct::Int8Enum, enum: TYPES
|
40
40
|
# @!attribute length
|
41
41
|
# 17-bit session packet length
|
42
42
|
# @return [Integer]
|
43
|
-
|
43
|
+
define_attr :length, BinStruct::Int24
|
44
44
|
# @!attribute body
|
45
45
|
# @return [String]
|
46
|
-
|
46
|
+
define_attr :body, BinStruct::String
|
47
47
|
|
48
48
|
# Compute and set {#length} field
|
49
49
|
# @return [Integer] calculated length
|
@@ -13,12 +13,12 @@ module PacketGen::Plugin
|
|
13
13
|
# void MIC
|
14
14
|
VOID_MIC = ([0] * 16).pack('C').freeze
|
15
15
|
|
16
|
-
|
16
|
+
update_attr :type, default: NTLM::TYPES['authenticate']
|
17
17
|
|
18
18
|
# @!attribute lm_response
|
19
19
|
# A LM_RESPONSE or LMV2_RESPONSE structure that contains the computed
|
20
20
|
# LM response to the challenge.
|
21
|
-
# @return [
|
21
|
+
# @return [BinStruct::String]
|
22
22
|
# @!attribute lm_response_len
|
23
23
|
# 16-bit unsigned integer that defines the size in bytes of
|
24
24
|
# {#lm_response} in {#payload}.
|
@@ -30,7 +30,7 @@ module PacketGen::Plugin
|
|
30
30
|
# A 32-bit unsigned integer that defines the offset, in bytes, from
|
31
31
|
# the beginning of the AUTHENTICATE MESSAGE to {#lm_response} in {#payload}.
|
32
32
|
# @return [Integer]
|
33
|
-
define_in_payload :lm_response,
|
33
|
+
define_in_payload :lm_response, BinStruct::String
|
34
34
|
|
35
35
|
# @!attribute nt_response
|
36
36
|
# A NTLM_RESPONSE or NTLMV2_RESPONSE structure that contains the computed
|
@@ -96,7 +96,7 @@ module PacketGen::Plugin
|
|
96
96
|
|
97
97
|
# @!attribute session_key
|
98
98
|
# The client's encrypted random session key. On
|
99
|
-
# @return [
|
99
|
+
# @return [BinStruct::String]
|
100
100
|
# @!attribute session_key_len
|
101
101
|
# 2-byte {#session_key} length
|
102
102
|
# @return [Integer]
|
@@ -107,7 +107,7 @@ module PacketGen::Plugin
|
|
107
107
|
# 4-byte {#session_key} offset from the beginning of the AUTHENTICATE
|
108
108
|
# MESSAGE in {#payload}.
|
109
109
|
# @return [Integer]
|
110
|
-
define_in_payload :session_key,
|
110
|
+
define_in_payload :session_key, BinStruct::String
|
111
111
|
|
112
112
|
# @!attribute flags
|
113
113
|
# Negotiate flags
|
@@ -186,12 +186,12 @@ module PacketGen::Plugin
|
|
186
186
|
# @!attribute version
|
187
187
|
# 8-byte version information
|
188
188
|
# @return [String]
|
189
|
-
|
189
|
+
define_attr_before :payload, :version, BinStruct::String, static_length: 8, default: VOID_VERSION
|
190
190
|
|
191
191
|
# @!attribute mic
|
192
192
|
# 16-byte message integrity code
|
193
193
|
# @return [String]
|
194
|
-
|
194
|
+
define_attr_before :payload, :mic, BinStruct::String, static_length: 16, default: VOID_MIC
|
195
195
|
end
|
196
196
|
end
|
197
197
|
end
|
@@ -23,9 +23,9 @@ module PacketGen::Plugin
|
|
23
23
|
}.freeze
|
24
24
|
|
25
25
|
# AVPAIR structure, with value of type {SMB::String}.
|
26
|
-
AvPair =
|
27
|
-
|
28
|
-
|
26
|
+
AvPair = BinStruct::AbstractTLV.create(type_class: BinStruct::Int16leEnum,
|
27
|
+
length_class: BinStruct::Int16le,
|
28
|
+
value_class: SMB::String)
|
29
29
|
AvPair.define_type_enum AVPAIR_TYPES
|
30
30
|
|
31
31
|
class AvPair
|
@@ -36,30 +36,30 @@ module PacketGen::Plugin
|
|
36
36
|
end
|
37
37
|
|
38
38
|
# EOL AVPAIR structure, with no value
|
39
|
-
EOLAvPair =
|
40
|
-
|
39
|
+
EOLAvPair = BinStruct::AbstractTLV.create(type_class: BinStruct::Int16leEnum,
|
40
|
+
length_class: BinStruct::Int16le)
|
41
41
|
EOLAvPair.define_type_enum AVPAIR_TYPES
|
42
42
|
|
43
43
|
# Timestamp AVPAIR structure, with value of type {SMB::Filetime}.
|
44
|
-
TimestampAvPair =
|
45
|
-
|
46
|
-
|
44
|
+
TimestampAvPair = BinStruct::AbstractTLV.create(type_class: BinStruct::Int16leEnum,
|
45
|
+
length_class: BinStruct::Int16le,
|
46
|
+
value_class: SMB::Filetime)
|
47
47
|
TimestampAvPair.define_type_enum AVPAIR_TYPES
|
48
48
|
|
49
|
-
# Int32le AVPAIR structure, with value a {
|
50
|
-
Int32leAvPair =
|
51
|
-
|
52
|
-
|
49
|
+
# Int32le AVPAIR structure, with value a {BinStruct::Int32le}.
|
50
|
+
Int32leAvPair = BinStruct::AbstractTLV.create(type_class: BinStruct::Int16leEnum,
|
51
|
+
length_class: BinStruct::Int16le,
|
52
|
+
value_class: BinStruct::Int32le)
|
53
53
|
Int32leAvPair.define_type_enum AVPAIR_TYPES
|
54
54
|
|
55
|
-
# String AVPAIR structure, with value a {
|
56
|
-
StringAvPair =
|
57
|
-
|
58
|
-
|
55
|
+
# String AVPAIR structure, with value a {BinStruct::String}.
|
56
|
+
StringAvPair = BinStruct::AbstractTLV.create(type_class: BinStruct::Int16leEnum,
|
57
|
+
length_class: BinStruct::Int16le,
|
58
|
+
value_class: BinStruct::String)
|
59
59
|
StringAvPair.define_type_enum AVPAIR_TYPES
|
60
60
|
|
61
61
|
# Specialized array containing {AvPair AvPairs}.
|
62
|
-
class ArrayOfAvPair <
|
62
|
+
class ArrayOfAvPair < BinStruct::Array
|
63
63
|
set_of AvPair
|
64
64
|
|
65
65
|
# Get unicode property
|
@@ -10,7 +10,7 @@ module PacketGen::Plugin
|
|
10
10
|
# NTLM Challenge message
|
11
11
|
# @author Sylvain Daubert
|
12
12
|
class Challenge < NTLM
|
13
|
-
|
13
|
+
update_attr :type, default: NTLM::TYPES['challenge']
|
14
14
|
|
15
15
|
# @!attribute target_name
|
16
16
|
# Name of the server authentication realm. Must be expressed in the
|
@@ -108,11 +108,11 @@ module PacketGen::Plugin
|
|
108
108
|
# @!attribute challenge
|
109
109
|
# 64-bit value containing the NTLM challenge.
|
110
110
|
# @return [String]
|
111
|
-
|
111
|
+
define_attr_before :payload, :challenge, BinStruct::String, static_length: 8, default: VOID_CHALLENGE
|
112
112
|
# @!attribute reserved
|
113
113
|
# 64-bit reserved field
|
114
114
|
# @return [Integer]
|
115
|
-
|
115
|
+
define_attr_before :payload, :reserved, BinStruct::Int64le
|
116
116
|
|
117
117
|
# @!attribute target_info
|
118
118
|
# @return [ArrayOfAvPair]
|
@@ -134,7 +134,7 @@ module PacketGen::Plugin
|
|
134
134
|
# @!attribute version
|
135
135
|
# 8-byte version information
|
136
136
|
# @return [String]
|
137
|
-
|
137
|
+
define_attr_before :payload, :version, BinStruct::String, static_length: 8, default: VOID_VERSION
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
@@ -15,7 +15,7 @@ module PacketGen::Plugin
|
|
15
15
|
# @return [String]
|
16
16
|
attr_accessor :workstation
|
17
17
|
|
18
|
-
|
18
|
+
update_attr :type, default: NTLM::TYPES['negotiate']
|
19
19
|
# @!attribute flags
|
20
20
|
# Negotiate flags
|
21
21
|
# @return [Integer]
|
@@ -92,7 +92,7 @@ module PacketGen::Plugin
|
|
92
92
|
|
93
93
|
# @!attribute domain_name
|
94
94
|
# Name of the client authentication domain. Must be OEM encoded.
|
95
|
-
# @return [
|
95
|
+
# @return [BinStruct::String]
|
96
96
|
# @!attribute domain_name_len
|
97
97
|
# 2-byte domain name length
|
98
98
|
# @return [Integer]
|
@@ -102,11 +102,11 @@ module PacketGen::Plugin
|
|
102
102
|
# @!attribute domain_name_offset
|
103
103
|
# 4-byte domain name offset
|
104
104
|
# @return [Integer]
|
105
|
-
define_in_payload :domain_name,
|
105
|
+
define_in_payload :domain_name, BinStruct::String
|
106
106
|
|
107
107
|
# @!attribute workstation
|
108
108
|
# Name of the client machine. Must be OEM encoded.
|
109
|
-
# @return [
|
109
|
+
# @return [BinStruct::String]
|
110
110
|
# @!attribute workstation_len
|
111
111
|
# 2-byte workstation length
|
112
112
|
# @return [Integer]
|
@@ -116,12 +116,12 @@ module PacketGen::Plugin
|
|
116
116
|
# @!attribute workstation_offset
|
117
117
|
# 4-byte workstation offset
|
118
118
|
# @return [Integer]
|
119
|
-
define_in_payload :workstation,
|
119
|
+
define_in_payload :workstation, BinStruct::String
|
120
120
|
|
121
121
|
# @!attribute version
|
122
122
|
# 8-byte version information
|
123
123
|
# @return [String]
|
124
|
-
|
124
|
+
define_attr_before :payload, :version, BinStruct::String, static_length: 8, default: VOID_VERSION
|
125
125
|
end
|
126
126
|
end
|
127
127
|
end
|
@@ -7,46 +7,46 @@
|
|
7
7
|
|
8
8
|
module PacketGen::Plugin
|
9
9
|
class NTLM
|
10
|
-
class Ntlmv2Response <
|
10
|
+
class Ntlmv2Response < BinStruct::Struct
|
11
11
|
# @!attribute response
|
12
12
|
# 16-byte array of unsigned char containing the client's NT challenge
|
13
13
|
# response.
|
14
14
|
# @return [String]
|
15
|
-
|
15
|
+
define_attr :response, BinStruct::String, static_length: 16
|
16
16
|
alias ntproof_str response
|
17
17
|
alias ntproof_str= response=
|
18
18
|
|
19
19
|
# @!attribute type
|
20
20
|
# 8-bit current version of the challenge. Should be 1.
|
21
21
|
# @return [Integer]
|
22
|
-
|
22
|
+
define_attr :type, BinStruct::Int8, default: 1
|
23
23
|
# @!attribute hi_type
|
24
24
|
# 8-bit maximum supported version of the challenge. Should be 1.
|
25
25
|
# @return [Integer]
|
26
|
-
|
26
|
+
define_attr :hi_type, BinStruct::Int8, default: 1
|
27
27
|
# @!attribute reserved1
|
28
28
|
# 16-bit reserved word.
|
29
29
|
# @return [Integer]
|
30
|
-
|
30
|
+
define_attr :reserved1, BinStruct::Int16le
|
31
31
|
# @!attribute reserved2
|
32
32
|
# 32-bit reserved word.
|
33
33
|
# @return [Integer]
|
34
|
-
|
34
|
+
define_attr :reserved2, BinStruct::Int32le
|
35
35
|
# @!attribute timestamp
|
36
36
|
# 64-bit current system time.
|
37
37
|
# @return [SMB::Filetime]
|
38
|
-
|
38
|
+
define_attr :timestamp, SMB::Filetime
|
39
39
|
# @!attribute client_challenge
|
40
40
|
# 8-byte challenge from client
|
41
41
|
# @return [String]
|
42
|
-
|
42
|
+
define_attr :client_challenge, BinStruct::String, static_length: 8
|
43
43
|
# @!attribute reserved3
|
44
44
|
# 32-bit reserved word.
|
45
45
|
# @return [Integer]
|
46
|
-
|
46
|
+
define_attr :reserved3, BinStruct::Int32le
|
47
47
|
# @!attribute avpairs
|
48
48
|
# @return [ArrayOfAvPair]
|
49
|
-
|
49
|
+
define_attr :avpairs, ArrayOfAvPair
|
50
50
|
|
51
51
|
# @return [false]
|
52
52
|
def empty?
|