ruby_smb 3.1.1 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -2
- data/examples/file_server.rb +8 -1
- data/examples/virtual_file_server.rb +143 -0
- data/lib/ruby_smb/fscc/file_information/file_access_information.rb +15 -0
- data/lib/ruby_smb/fscc/file_information/file_alignment_information.rb +45 -0
- data/lib/ruby_smb/fscc/file_information/file_all_information.rb +23 -0
- data/lib/ruby_smb/fscc/file_information/file_basic_information.rb +20 -0
- data/lib/ruby_smb/fscc/file_information/file_both_directory_information.rb +3 -3
- data/lib/ruby_smb/fscc/file_information/file_directory_information.rb +3 -3
- data/lib/ruby_smb/fscc/file_information/file_ea_information.rb +1 -0
- data/lib/ruby_smb/fscc/file_information/file_full_directory_information.rb +3 -3
- data/lib/ruby_smb/fscc/file_information/file_id_both_directory_information.rb +3 -3
- data/lib/ruby_smb/fscc/file_information/file_id_full_directory_information.rb +3 -3
- data/lib/ruby_smb/fscc/file_information/file_internal_information.rb +15 -0
- data/lib/ruby_smb/fscc/file_information/file_mode_information.rb +29 -0
- data/lib/ruby_smb/fscc/file_information/file_name_information.rb +16 -0
- data/lib/ruby_smb/fscc/file_information/file_names_information.rb +1 -1
- data/lib/ruby_smb/fscc/file_information/file_normalized_name_information.rb +16 -0
- data/lib/ruby_smb/fscc/file_information/file_position_information.rb +15 -0
- data/lib/ruby_smb/fscc/file_information/file_rename_information.rb +1 -1
- data/lib/ruby_smb/fscc/file_information/file_standard_information.rb +20 -0
- data/lib/ruby_smb/fscc/file_information/file_stream_information.rb +3 -0
- data/lib/ruby_smb/fscc/file_information.rb +41 -8
- data/lib/ruby_smb/fscc/file_system_information/file_fs_attribute_information.rb +1 -0
- data/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information.rb +1 -0
- data/lib/ruby_smb/fscc/file_system_information.rb +4 -0
- data/lib/ruby_smb/gss/provider/ntlm.rb +16 -3
- data/lib/ruby_smb/gss/provider.rb +10 -1
- data/lib/ruby_smb/server/server_client/session_setup.rb +4 -2
- data/lib/ruby_smb/server/server_client.rb +9 -1
- data/lib/ruby_smb/server/session.rb +5 -1
- data/lib/ruby_smb/server/share/provider/disk/processor/close.rb +9 -5
- data/lib/ruby_smb/server/share/provider/disk/processor/create.rb +2 -2
- data/lib/ruby_smb/server/share/provider/disk/processor/query.rb +2 -2
- data/lib/ruby_smb/server/share/provider/disk/processor/read.rb +15 -14
- data/lib/ruby_smb/server/share/provider/disk/processor.rb +76 -12
- data/lib/ruby_smb/server/share/provider/disk.rb +8 -2
- data/lib/ruby_smb/server/share/provider/virtual_disk/virtual_file.rb +85 -0
- data/lib/ruby_smb/server/share/provider/virtual_disk/virtual_pathname.rb +196 -0
- data/lib/ruby_smb/server/share/provider/virtual_disk/virtual_stat.rb +175 -0
- data/lib/ruby_smb/server/share/provider/virtual_disk.rb +116 -0
- data/lib/ruby_smb/server/share/provider.rb +1 -0
- data/lib/ruby_smb/server.rb +13 -3
- data/lib/ruby_smb/smb2/tree.rb +1 -0
- data/lib/ruby_smb/version.rb +1 -1
- data/spec/lib/ruby_smb/fscc/file_information/file_access_information_spec.rb +21 -0
- data/spec/lib/ruby_smb/fscc/file_information/file_alignment_information_spec.rb +21 -0
- data/spec/lib/ruby_smb/fscc/file_information/file_all_information_spec.rb +61 -0
- data/spec/lib/ruby_smb/fscc/file_information/file_basic_information_spec.rb +41 -0
- data/spec/lib/ruby_smb/fscc/file_information/file_both_directory_information_spec.rb +59 -10
- data/spec/lib/ruby_smb/fscc/file_information/file_directory_information_spec.rb +30 -12
- data/spec/lib/ruby_smb/fscc/file_information/file_ea_information_spec.rb +21 -0
- data/spec/lib/ruby_smb/fscc/file_information/file_full_directory_information_spec.rb +30 -12
- data/spec/lib/ruby_smb/fscc/file_information/file_id_both_directory_information_spec.rb +63 -10
- data/spec/lib/ruby_smb/fscc/file_information/file_id_full_directory_information_spec.rb +30 -12
- data/spec/lib/ruby_smb/fscc/file_information/file_internal_information_spec.rb +21 -0
- data/spec/lib/ruby_smb/fscc/file_information/file_mode_information_spec.rb +21 -0
- data/spec/lib/ruby_smb/fscc/file_information/file_name_information_spec.rb +44 -0
- data/spec/lib/ruby_smb/fscc/file_information/file_names_information_spec.rb +30 -12
- data/spec/lib/ruby_smb/fscc/file_information/file_network_open_information_spec.rb +51 -0
- data/spec/lib/ruby_smb/fscc/file_information/file_normalized_name_information_spec.rb +44 -0
- data/spec/lib/ruby_smb/fscc/file_information/file_position_information_spec.rb +21 -0
- data/spec/lib/ruby_smb/fscc/file_information/file_rename_information_spec.rb +1 -1
- data/spec/lib/ruby_smb/fscc/file_information/file_standard_information_spec.rb +41 -0
- data/spec/lib/ruby_smb/fscc/file_information/file_stream_information_spec.rb +51 -0
- data/spec/lib/ruby_smb/fscc/file_information_spec.rb +14 -0
- data/spec/lib/ruby_smb/fscc/file_system_information/file_fs_attribute_information_spec.rb +46 -0
- data/spec/lib/ruby_smb/fscc/file_system_information/file_fs_volume_information_spec.rb +51 -0
- data/spec/lib/ruby_smb/fscc/file_system_information_spec.rb +14 -0
- data/spec/lib/ruby_smb/server/server_client_spec.rb +15 -0
- data/spec/lib/ruby_smb/server/share/provider/virtual_disk/virtual_pathname_spec.rb +581 -0
- data/spec/lib/ruby_smb/server/share/provider/virtual_disk/virtual_stat_spec.rb +207 -0
- data/spec/lib/ruby_smb/server/share/provider/virtual_disk_spec.rb +122 -0
- data.tar.gz.sig +0 -0
- metadata +57 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 498d32e1eeed4cb410f03dfdc5ea1b23dd5506d89e387a3533494b9f73294ffa
|
4
|
+
data.tar.gz: 838a864709be049725a3978de10d71a0cf9eb75e91d00468cdee07fc5e614250
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e60651395300c2f7bc88049e7572a2b5376646615da08a1978d8e71afe694ca2f32396e124cbda71cc203811ff8df0241aa072f58aeffa8265498789cab7696f
|
7
|
+
data.tar.gz: e9d3bd5ffb781a01e4382d8f0f2327cd384d4be520a394fbf00336fbc23b9913fae58b380c05c1782c320364edd8ac5e729639091c0f54b32208469972810705
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
�|�A�C���\�~ۀ.�T)? ~\G��kG��z��� ����}'>
|
1
|
+
&+��R#�����h�;����ꂤ�2��m�8�u���U{gqۗ����B�Ó;�+���;>r� _ sYN1�a��� �{Z�x{E�e�����^�����敨J@I��>\��N6�j�ĩK��]Bm[Q+��������/1M����[���.�h�Ɏ.t����'�Ch]h�N��e�ǜVaV%�z��p�o����*1���;]4C�s�-�3������ebX� �.}��ml���
|
data/examples/file_server.rb
CHANGED
@@ -10,6 +10,7 @@ Encoding.default_internal = 'UTF-8' if Encoding.default_internal.nil?
|
|
10
10
|
|
11
11
|
options = {
|
12
12
|
allow_anonymous: true,
|
13
|
+
allow_guests: false,
|
13
14
|
domain: nil,
|
14
15
|
username: 'RubySMB',
|
15
16
|
password: 'password',
|
@@ -39,6 +40,9 @@ OptionParser.new do |opts|
|
|
39
40
|
opts.on("--[no-]smbv3", "Enable or disable SMBv3 (default: #{options[:smbv3] ? 'Enabled' : 'Disabled'})") do |smbv3|
|
40
41
|
options[:smbv3] = smbv3
|
41
42
|
end
|
43
|
+
opts.on("--[no-]guests", "Allow guest accounts (default: #{options[:allow_guests]})") do |allow_guests|
|
44
|
+
options[:allow_guests] = allow_guests
|
45
|
+
end
|
42
46
|
opts.on("--username USERNAME", "The account's username (default: #{options[:username]})") do |username|
|
43
47
|
if username.include?('\\')
|
44
48
|
options[:domain], options[:username] = username.split('\\', 2)
|
@@ -51,7 +55,10 @@ OptionParser.new do |opts|
|
|
51
55
|
end
|
52
56
|
end.parse!
|
53
57
|
|
54
|
-
ntlm_provider = RubySMB::Gss::Provider::NTLM.new(
|
58
|
+
ntlm_provider = RubySMB::Gss::Provider::NTLM.new(
|
59
|
+
allow_anonymous: options[:allow_anonymous],
|
60
|
+
allow_guests: options[:allow_guests]
|
61
|
+
)
|
55
62
|
ntlm_provider.put_account(options[:username], options[:password], domain: options[:domain]) # password can also be an NTLM hash
|
56
63
|
|
57
64
|
server = RubySMB::Server.new(
|
@@ -0,0 +1,143 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'optparse'
|
5
|
+
require 'ruby_smb'
|
6
|
+
require 'ruby_smb/gss/provider/ntlm'
|
7
|
+
|
8
|
+
# we just need *a* default encoding to handle the strings from the NTLM messages
|
9
|
+
Encoding.default_internal = 'UTF-8' if Encoding.default_internal.nil?
|
10
|
+
|
11
|
+
# see: https://en.wikipedia.org/wiki/Magic_8-ball#Possible_answers
|
12
|
+
MAGIC_8_BALL_ANSWERS = [
|
13
|
+
'It is certain.',
|
14
|
+
'It is decidedly so.',
|
15
|
+
'Without a doubt.',
|
16
|
+
'Yes definitely.',
|
17
|
+
'You may rely on it.',
|
18
|
+
'As I see it, yes.',
|
19
|
+
'Most likely.',
|
20
|
+
'Outlook good.',
|
21
|
+
'Yes.',
|
22
|
+
'Signs point to yes.',
|
23
|
+
'Reply hazy, try again.',
|
24
|
+
'Ask again later.',
|
25
|
+
'Better not tell you now.',
|
26
|
+
'Cannot predict now.',
|
27
|
+
'Concentrate and ask again.',
|
28
|
+
'Don\'t count on it.',
|
29
|
+
'My reply is no.',
|
30
|
+
'My sources say no.',
|
31
|
+
'Outlook not so good.',
|
32
|
+
'Very doubtful'
|
33
|
+
]
|
34
|
+
|
35
|
+
options = {
|
36
|
+
allow_anonymous: true,
|
37
|
+
domain: nil,
|
38
|
+
username: 'RubySMB',
|
39
|
+
password: 'password',
|
40
|
+
share_name: 'home',
|
41
|
+
smbv1: true,
|
42
|
+
smbv2: true,
|
43
|
+
smbv3: true
|
44
|
+
}
|
45
|
+
OptionParser.new do |opts|
|
46
|
+
opts.banner = "Usage: #{File.basename(__FILE__)} [options]"
|
47
|
+
opts.on("--share SHARE", "The share name (default: #{options[:share_name]})") do |share|
|
48
|
+
options[:share_name] = share
|
49
|
+
end
|
50
|
+
opts.on("--[no-]anonymous", "Allow anonymous access (default: #{options[:allow_anonymous]})") do |allow_anonymous|
|
51
|
+
options[:allow_anonymous] = allow_anonymous
|
52
|
+
end
|
53
|
+
opts.on("--[no-]smbv1", "Enable or disable SMBv1 (default: #{options[:smbv1] ? 'Enabled' : 'Disabled'})") do |smbv1|
|
54
|
+
options[:smbv1] = smbv1
|
55
|
+
end
|
56
|
+
opts.on("--[no-]smbv2", "Enable or disable SMBv2 (default: #{options[:smbv2] ? 'Enabled' : 'Disabled'})") do |smbv2|
|
57
|
+
options[:smbv2] = smbv2
|
58
|
+
end
|
59
|
+
opts.on("--[no-]smbv3", "Enable or disable SMBv3 (default: #{options[:smbv3] ? 'Enabled' : 'Disabled'})") do |smbv3|
|
60
|
+
options[:smbv3] = smbv3
|
61
|
+
end
|
62
|
+
opts.on("--username USERNAME", "The account's username (default: #{options[:username]})") do |username|
|
63
|
+
if username.include?('\\')
|
64
|
+
options[:domain], options[:username] = username.split('\\', 2)
|
65
|
+
else
|
66
|
+
options[:username] = username
|
67
|
+
end
|
68
|
+
end
|
69
|
+
opts.on("--password PASSWORD", "The account's password (default: #{options[:password]})") do |password|
|
70
|
+
options[:password] = password
|
71
|
+
end
|
72
|
+
opts.on("--virtual-content CONTENT", "The virtual share contents") do |virtual_content|
|
73
|
+
options[:virtual_content] = virtual_content
|
74
|
+
end
|
75
|
+
opts.on("--virtual-name NAME", "The virtual share file name") do |virtual_name|
|
76
|
+
options[:virtual_name] = virtual_name
|
77
|
+
end
|
78
|
+
opts.on("--virtual-type TYPE", "The virtual share type") do |virtual_type|
|
79
|
+
options[:virtual_type] = virtual_type
|
80
|
+
end
|
81
|
+
end.parse!
|
82
|
+
|
83
|
+
ntlm_provider = RubySMB::Gss::Provider::NTLM.new(allow_anonymous: options[:allow_anonymous])
|
84
|
+
ntlm_provider.put_account(options[:username], options[:password], domain: options[:domain]) # password can also be an NTLM hash
|
85
|
+
|
86
|
+
server = RubySMB::Server.new(
|
87
|
+
gss_provider: ntlm_provider,
|
88
|
+
logger: :stdout
|
89
|
+
)
|
90
|
+
server.dialects.select! { |dialect| RubySMB::Dialect[dialect].family != RubySMB::Dialect::FAMILY_SMB1 } unless options[:smbv1]
|
91
|
+
server.dialects.select! { |dialect| RubySMB::Dialect[dialect].family != RubySMB::Dialect::FAMILY_SMB2 } unless options[:smbv2]
|
92
|
+
server.dialects.select! { |dialect| RubySMB::Dialect[dialect].family != RubySMB::Dialect::FAMILY_SMB3 } unless options[:smbv3]
|
93
|
+
|
94
|
+
if server.dialects.empty?
|
95
|
+
puts "at least one version must be enabled"
|
96
|
+
exit false
|
97
|
+
end
|
98
|
+
|
99
|
+
virtual_disk = RubySMB::Server::Share::Provider::VirtualDisk.new(options[:share_name])
|
100
|
+
|
101
|
+
# greeting is a static text file
|
102
|
+
virtual_disk.add_static_file('greeting', 'Hello World!')
|
103
|
+
|
104
|
+
# self is this example file, it's read when it's added and its #stat object is copied over
|
105
|
+
virtual_disk.add_static_file('self/static', File.open(__FILE__))
|
106
|
+
|
107
|
+
# self is this example file, it's mapped in using a real Pathname object
|
108
|
+
virtual_disk.add_mapped_file('self/mapped', Pathname.new(File.expand_path(__FILE__)))
|
109
|
+
|
110
|
+
# magic_8_ball is a dynamic file that is generated each time it is open
|
111
|
+
virtual_disk.add_dynamic_file('magic_8_ball') do
|
112
|
+
MAGIC_8_BALL_ANSWERS.sample
|
113
|
+
end
|
114
|
+
|
115
|
+
if options[:virtual_content] && options[:virtual_name] && options[:virtual_type]
|
116
|
+
case options[:virtual_type].downcase
|
117
|
+
when 'static'
|
118
|
+
# for static, content is left as is
|
119
|
+
virtual_disk.add_static_file(options[:virtual_name], options[:virtual_content])
|
120
|
+
when 'mapped'
|
121
|
+
# for mapped, content is a file path
|
122
|
+
virtual_disk.add_mapped_file(options[:virtual_name], Pathname.new(File.expand_path(options[:virtual_content])))
|
123
|
+
when 'dynamic'
|
124
|
+
# for dynamic, content is a file path
|
125
|
+
virtual_disk.add_dynamic_file(options[:virtual_name]) do
|
126
|
+
File.read(options[:virtual_content])
|
127
|
+
end
|
128
|
+
else
|
129
|
+
puts "virtual type: #{options[:virtual_type]}, must be one of static, mapped, or dynamic"
|
130
|
+
exit false
|
131
|
+
end
|
132
|
+
elsif options[:virtual_content] || options[:virtual_name] || options[:virtual_type]
|
133
|
+
puts 'the --virtual-* flags are only used when all are specified'
|
134
|
+
exit false
|
135
|
+
end
|
136
|
+
|
137
|
+
server.add_share(virtual_disk)
|
138
|
+
puts "server is running"
|
139
|
+
server.run do |server_client|
|
140
|
+
puts "received connection"
|
141
|
+
true
|
142
|
+
end
|
143
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Fscc
|
3
|
+
module FileInformation
|
4
|
+
# The FileAccessInformation Class as defined in
|
5
|
+
# [2.4.1 FileAccessInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/01cf43d2-deb3-40d3-a39b-9e68693d7c90)
|
6
|
+
class FileAccessInformation < BinData::Record
|
7
|
+
CLASS_LEVEL = FileInformation::FILE_ACCESS_INFORMATION
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
uint32 :access_flags, label: 'Access Flags'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Fscc
|
3
|
+
module FileInformation
|
4
|
+
# The FileAlignmentInformation Class as defined in
|
5
|
+
# [2.4.3 FileAlignmentInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/9b0b9971-85aa-4651-8438-f1c4298bcb0d)
|
6
|
+
class FileAlignmentInformation < BinData::Record
|
7
|
+
CLASS_LEVEL = FileInformation::FILE_ALIGNMENT_INFORMATION
|
8
|
+
|
9
|
+
# If this value is specified, there are no alignment requirements for the device.
|
10
|
+
FILE_BYTE_ALIGNMENT = 0x00000000 # 0
|
11
|
+
|
12
|
+
# If this value is specified, data MUST be aligned on a 2-byte boundary.
|
13
|
+
FILE_WORD_ALIGNMENT = 0x00000001 # 1
|
14
|
+
|
15
|
+
# If this value is specified, data MUST be aligned on a 4-byte boundary.
|
16
|
+
FILE_LONG_ALIGNMENT = 0x00000003 # 3
|
17
|
+
|
18
|
+
# If this value is specified, data MUST be aligned on an 8-byte boundary.
|
19
|
+
FILE_QUAD_ALIGNMENT = 0x00000007 # 7
|
20
|
+
|
21
|
+
# If this value is specified, data MUST be aligned on a 16-byte boundary.
|
22
|
+
FILE_OCTA_ALIGNMENT = 0X0000000F # 15
|
23
|
+
|
24
|
+
# If this value is specified, data MUST be aligned on a 32-byte boundary.
|
25
|
+
FILE_32_BYTE_ALIGNMENT = 0X0000001F # 31
|
26
|
+
|
27
|
+
# If this value is specified, data MUST be aligned on a 64-byte boundary.
|
28
|
+
FILE_64_BYTE_ALIGNMENT = 0X0000003F # 63
|
29
|
+
|
30
|
+
# If this value is specified, data MUST be aligned on a 128-byte boundary.
|
31
|
+
FILE_128_BYTE_ALIGNMENT = 0X0000007F # 127
|
32
|
+
|
33
|
+
# If this value is specified, data MUST be aligned on a 256-byte boundary.
|
34
|
+
FILE_256_BYTE_ALIGNMENT = 0X000000FF # 255
|
35
|
+
|
36
|
+
# If this value is specified, data MUST be aligned on a 512-byte boundary.
|
37
|
+
FILE_512_BYTE_ALIGNMENT = 0X000001FF # 511
|
38
|
+
|
39
|
+
endian :little
|
40
|
+
|
41
|
+
uint32 :alignment_requirement, label: 'Alignment Requirement', initial_value: FILE_BYTE_ALIGNMENT
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Fscc
|
3
|
+
module FileInformation
|
4
|
+
# The FileAllInformation Class as defined in
|
5
|
+
# [2.4.2 FileAllInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/95f3056a-ebc1-4f5d-b938-3f68a44677a6)
|
6
|
+
class FileAllInformation < BinData::Record
|
7
|
+
CLASS_LEVEL = FileInformation::FILE_ALL_INFORMATION
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
file_basic_information :basic_information, label: 'Basic Information'
|
12
|
+
file_standard_information :standard_information, label: 'Standard Information'
|
13
|
+
file_internal_information :internal_information, label: 'Internal Information'
|
14
|
+
file_ea_information :ea_information, label: 'EA Information'
|
15
|
+
file_access_information :access_information, label: 'Access Information'
|
16
|
+
file_position_information :position_information, label: 'Position Information'
|
17
|
+
file_mode_information :mode_information, label: 'Mode Information'
|
18
|
+
file_alignment_information :alignment_information, label: 'Alignment Information'
|
19
|
+
file_name_information :name_information, label: 'Name Information'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Fscc
|
3
|
+
module FileInformation
|
4
|
+
# The FileBasicInformation Class as defined in
|
5
|
+
# [2.4.7 FileBasicInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/16023025-8a78-492f-8b96-c873b042ac50)
|
6
|
+
class FileBasicInformation < BinData::Record
|
7
|
+
CLASS_LEVEL = FileInformation::FILE_BASIC_INFORMATION
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
file_time :create_time, label: 'Create Time'
|
12
|
+
file_time :last_access, label: 'Last Accessed Time'
|
13
|
+
file_time :last_write, label: 'Last Write Time'
|
14
|
+
file_time :last_change, label: 'Last Modified Time'
|
15
|
+
file_attributes :file_attributes, label: 'File Attributes'
|
16
|
+
string :reserved, label: 'Reserved', length: 4
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -2,7 +2,7 @@ module RubySMB
|
|
2
2
|
module Fscc
|
3
3
|
module FileInformation
|
4
4
|
# The FileBothDirectoryInformation Class as defined in
|
5
|
-
# [2.4.8 FileBothDirectoryInformation](https://
|
5
|
+
# [2.4.8 FileBothDirectoryInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/270df317-9ba5-4ccb-ba00-8d22be139bc5)
|
6
6
|
class FileBothDirectoryInformation < BinData::Record
|
7
7
|
CLASS_LEVEL = FileInformation::FILE_BOTH_DIRECTORY_INFORMATION
|
8
8
|
|
@@ -14,8 +14,8 @@ module RubySMB
|
|
14
14
|
file_time :last_access, label: 'Last Accessed Time'
|
15
15
|
file_time :last_write, label: 'Last Write Time'
|
16
16
|
file_time :last_change, label: 'Last Modified Time'
|
17
|
-
|
18
|
-
|
17
|
+
int64 :end_of_file, label: 'End of File'
|
18
|
+
int64 :allocation_size, label: 'Allocated Size'
|
19
19
|
file_attributes :file_attributes, label: 'File Attributes'
|
20
20
|
uint32 :file_name_length, label: 'File Name Length', initial_value: -> { file_name.do_num_bytes }
|
21
21
|
uint32 :ea_size, label: 'Extended Attributes Size'
|
@@ -2,7 +2,7 @@ module RubySMB
|
|
2
2
|
module Fscc
|
3
3
|
module FileInformation
|
4
4
|
# The FileDirectoryInformation Class as defined in
|
5
|
-
# [2.4.10 FileDirectoryInformation](https://
|
5
|
+
# [2.4.10 FileDirectoryInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/b38bf518-9057-4c88-9ddd-5e2d3976a64b)
|
6
6
|
class FileDirectoryInformation < BinData::Record
|
7
7
|
CLASS_LEVEL = FileInformation::FILE_DIRECTORY_INFORMATION
|
8
8
|
|
@@ -14,8 +14,8 @@ module RubySMB
|
|
14
14
|
file_time :last_access, label: 'Last Accessed Time'
|
15
15
|
file_time :last_write, label: 'Last Write Time'
|
16
16
|
file_time :last_change, label: 'Last Modified Time'
|
17
|
-
|
18
|
-
|
17
|
+
int64 :end_of_file, label: 'End of File'
|
18
|
+
int64 :allocation_size, label: 'Allocated Size'
|
19
19
|
file_attributes :file_attributes, label: 'File Attributes'
|
20
20
|
uint32 :file_name_length, label: 'File Name Length', initial_value: -> { file_name.do_num_bytes }
|
21
21
|
string16 :file_name, label: 'File Name', read_length: -> { file_name_length }
|
@@ -2,7 +2,7 @@ module RubySMB
|
|
2
2
|
module Fscc
|
3
3
|
module FileInformation
|
4
4
|
# The FileFullDirectoryInformation Class as defined in
|
5
|
-
# [2.4.14 FileFullDirectoryInformation](https://
|
5
|
+
# [2.4.14 FileFullDirectoryInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/e8d926d1-3a22-4654-be9c-58317a85540b)
|
6
6
|
class FileFullDirectoryInformation < BinData::Record
|
7
7
|
CLASS_LEVEL = FileInformation::FILE_FULL_DIRECTORY_INFORMATION
|
8
8
|
|
@@ -14,8 +14,8 @@ module RubySMB
|
|
14
14
|
file_time :last_access, label: 'Last Accessed Time'
|
15
15
|
file_time :last_write, label: 'Last Write Time'
|
16
16
|
file_time :last_change, label: 'Last Modified Time'
|
17
|
-
|
18
|
-
|
17
|
+
int64 :end_of_file, label: 'End of File'
|
18
|
+
int64 :allocation_size, label: 'Allocated Size'
|
19
19
|
file_attributes :file_attributes, label: 'File Attributes'
|
20
20
|
uint32 :file_name_length, label: 'File Name Length', initial_value: -> { file_name.do_num_bytes }
|
21
21
|
uint32 :ea_size, label: 'Extended Attributes Size'
|
@@ -14,8 +14,8 @@ module RubySMB
|
|
14
14
|
file_time :last_access, label: 'Last Accessed Time'
|
15
15
|
file_time :last_write, label: 'Last Write Time'
|
16
16
|
file_time :last_change, label: 'Last Modified Time'
|
17
|
-
|
18
|
-
|
17
|
+
int64 :end_of_file, label: 'End of File'
|
18
|
+
int64 :allocation_size, label: 'Allocated Size'
|
19
19
|
file_attributes :file_attributes, label: 'File Attributes'
|
20
20
|
uint32 :file_name_length, label: 'File Name Length', initial_value: -> { file_name.do_num_bytes }
|
21
21
|
uint32 :ea_size, label: 'Extended Attributes Size'
|
@@ -23,7 +23,7 @@ module RubySMB
|
|
23
23
|
uint8 :reserved, label: 'Reserved Space'
|
24
24
|
string16 :short_name, label: 'File Short Name', length: 24
|
25
25
|
uint16 :reserved2, label: 'Reserved Space'
|
26
|
-
uint64 :file_id, label: 'File
|
26
|
+
uint64 :file_id, label: 'File ID'
|
27
27
|
string16 :file_name, label: 'File Name', read_length: -> { file_name_length }
|
28
28
|
end
|
29
29
|
end
|
@@ -2,7 +2,7 @@ module RubySMB
|
|
2
2
|
module Fscc
|
3
3
|
module FileInformation
|
4
4
|
# The FileIdDirectoryInformation Class as defined in
|
5
|
-
# [2.4.18 FileIdFullDirectoryInformation](https://
|
5
|
+
# [2.4.18 FileIdFullDirectoryInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/ab8e7558-899c-4be1-a7c5-3a9ae8ab76a0)
|
6
6
|
class FileIdFullDirectoryInformation < BinData::Record
|
7
7
|
CLASS_LEVEL = FileInformation::FILE_ID_FULL_DIRECTORY_INFORMATION
|
8
8
|
|
@@ -14,8 +14,8 @@ module RubySMB
|
|
14
14
|
file_time :last_access, label: 'Last Accessed Time'
|
15
15
|
file_time :last_write, label: 'Last Write Time'
|
16
16
|
file_time :last_change, label: 'Last Modified Time'
|
17
|
-
|
18
|
-
|
17
|
+
int64 :end_of_file, label: 'End of File'
|
18
|
+
int64 :allocation_size, label: 'Allocated Size'
|
19
19
|
file_attributes :file_attributes, label: 'File Attributes'
|
20
20
|
uint32 :file_name_length, label: 'File Name Length', initial_value: -> { file_name.do_num_bytes }
|
21
21
|
uint32 :ea_size, label: 'Extended Attributes Size'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Fscc
|
3
|
+
module FileInformation
|
4
|
+
# The FileInternalInformation Class as defined in
|
5
|
+
# [2.4.22 FileInternalInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/7d796611-2fa5-41ac-8178-b6fea3a017b3)
|
6
|
+
class FileInternalInformation < BinData::Record
|
7
|
+
CLASS_LEVEL = FileInformation::FILE_INTERNAL_INFORMATION
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
uint64 :file_id, label: 'File ID'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Fscc
|
3
|
+
module FileInformation
|
4
|
+
# The FileModeInformation Class as defined in
|
5
|
+
# [2.4.26 FileModeInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/52df7798-8330-474b-ac31-9afe8075640c)
|
6
|
+
class FileModeInformation < BinData::Record
|
7
|
+
CLASS_LEVEL = FileInformation::FILE_MODE_INFORMATION
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
struct :flags do
|
12
|
+
bit2 :reserved
|
13
|
+
bit1 :file_synchronous_io_nonalert, label: 'File Synchronous IO Nonalert'
|
14
|
+
bit1 :file_synchronous_io_alert, label: 'File Synchronous IO Alert'
|
15
|
+
bit1 :file_no_intermediate_buffering, label: 'File No Intermediate Buffering'
|
16
|
+
bit1 :file_sequential_only, label: 'File Sequential Only'
|
17
|
+
bit1 :file_write_through, label: 'File Write Through'
|
18
|
+
bit1 :reserved2
|
19
|
+
# byte boundary
|
20
|
+
bit3 :reserved3
|
21
|
+
bit1 :file_delete_on_close, label: 'File Delete On Close'
|
22
|
+
bit4 :reserved4
|
23
|
+
# byte boundary
|
24
|
+
bit16 :reserved5
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Fscc
|
3
|
+
module FileInformation
|
4
|
+
# The FileNameInformation Class as defined in
|
5
|
+
# [2.4.27 FileNameInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/cb30e415-54c5-4483-a346-822ea90e1e89)
|
6
|
+
class FileNameInformation < BinData::Record
|
7
|
+
CLASS_LEVEL = FileInformation::FILE_NAME_INFORMATION
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
uint32 :file_name_length, label: 'File Name Length', initial_value: -> { file_name.do_num_bytes }
|
12
|
+
string16 :file_name, label: 'File Name', read_length: -> { file_name_length }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -2,7 +2,7 @@ module RubySMB
|
|
2
2
|
module Fscc
|
3
3
|
module FileInformation
|
4
4
|
# The FileNamesInformation Class as defined in
|
5
|
-
# [2.4.
|
5
|
+
# [2.4.28 FileNamesInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/a289f7a8-83d2-4927-8c88-b2d328dde5a5)
|
6
6
|
class FileNamesInformation < BinData::Record
|
7
7
|
CLASS_LEVEL = FileInformation::FILE_NAMES_INFORMATION
|
8
8
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Fscc
|
3
|
+
module FileInformation
|
4
|
+
# The FileNormalizedNameInformation Class as defined in
|
5
|
+
# [2.4.30 FileNormalizedNameInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/20bcadba-808c-4880-b757-4af93e41edf6)
|
6
|
+
class FileNormalizedNameInformation < BinData::Record
|
7
|
+
CLASS_LEVEL = FileInformation::FILE_NORMALIZED_NAME_INFORMATION
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
uint32 :file_name_length, label: 'File Name Length', initial_value: -> { file_name.do_num_bytes }
|
12
|
+
string16 :file_name, label: 'File Name', read_length: -> { file_name_length }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Fscc
|
3
|
+
module FileInformation
|
4
|
+
# The FilePositionInformation Class as defined in
|
5
|
+
# [2.4.35 FilePositionInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/e3ce4a39-327e-495c-99b6-6b61606b6f16)
|
6
|
+
class FilePositionInformation < BinData::Record
|
7
|
+
CLASS_LEVEL = FileInformation::FILE_POSITION_INFORMATION
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
int64 :current_byte_offset, label: 'Current Byte Offset'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -4,7 +4,7 @@ module RubySMB
|
|
4
4
|
# The FileRenameInformation Class as defined in
|
5
5
|
# [2.4.34.2 FileRenameInformation](https://msdn.microsoft.com/en-us/library/cc704597.aspx)
|
6
6
|
class FileRenameInformation < BinData::Record
|
7
|
-
CLASS_LEVEL = FileInformation::
|
7
|
+
CLASS_LEVEL = FileInformation::FILE_RENAME_INFORMATION
|
8
8
|
|
9
9
|
endian :little
|
10
10
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Fscc
|
3
|
+
module FileInformation
|
4
|
+
# The FileStandardInformation Class as defined in
|
5
|
+
# [2.4.41 FileStandardInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/5afa7f66-619c-48f3-955f-68c4ece704ae)
|
6
|
+
class FileStandardInformation < BinData::Record
|
7
|
+
CLASS_LEVEL = FileInformation::FILE_STANDARD_INFORMATION
|
8
|
+
|
9
|
+
endian :little
|
10
|
+
|
11
|
+
int64 :allocation_size, label: 'Allocation Size'
|
12
|
+
int64 :end_of_file, label: 'End of File'
|
13
|
+
uint32 :number_of_links, label: 'Number of Links'
|
14
|
+
int8 :delete_pending, label: 'Delete Pending'
|
15
|
+
int8 :directory, label: 'Directory'
|
16
|
+
string :reserved, label: 'Reserved', length: 2
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -4,7 +4,10 @@ module RubySMB
|
|
4
4
|
# The FileStreamInformation
|
5
5
|
# [2.4.43 FileStreamInformation](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/f8762be6-3ab9-411e-a7d6-5cc68f70c78d)
|
6
6
|
class FileStreamInformation < BinData::Record
|
7
|
+
CLASS_LEVEL = Fscc::FileInformation::FILE_STREAM_INFORMATION
|
8
|
+
|
7
9
|
endian :little
|
10
|
+
|
8
11
|
uint32 :next_entry_offset, label: 'Next Entry Offset'
|
9
12
|
uint32 :stream_name_length, label: 'Stream Name Length', initial_value: -> { stream_name.do_num_bytes }
|
10
13
|
int64 :stream_size, label: 'Stream Size'
|