remove case for open smb file packet field

GSoC/Meterpreter_Web_Console
dmohanty-r7 2018-02-28 15:44:07 -06:00 committed by Brent Cook
parent 960c733f16
commit f2cf4fd1dc
3 changed files with 5 additions and 21 deletions

View File

@ -16,7 +16,6 @@ group :development do
gem 'yard' gem 'yard'
# for development and testing purposes # for development and testing purposes
gem 'pry' gem 'pry'
gem 'pry-byebug'
# module documentation # module documentation
gem 'octokit' gem 'octokit'
# Metasploit::Aggregator external session proxy # Metasploit::Aggregator external session proxy
@ -41,6 +40,3 @@ group :test do
# Manipulate Time.now in specs # Manipulate Time.now in specs
gem 'timecop' gem 'timecop'
end end
gem 'ruby_smb', git: 'https://github.com/rapid7/ruby_smb', branch: 'master'

View File

@ -70,7 +70,7 @@ attr_accessor :socket, :client, :direct, :shares, :last_share
self.client.send_ntlm = send_ntlm self.client.send_ntlm = send_ntlm
ok = self.client.negotiate ok = self.client.negotiate
self.server_max_buffer_size = ok['Payload'].v['MaxBuff'] self.server_max_buffer_size = self.client.server_max_buffer_size
# Disable NTLMv2 Session for Windows 2000 (breaks authentication on some systems) # Disable NTLMv2 Session for Windows 2000 (breaks authentication on some systems)
# XXX: This in turn breaks SMB auth for Windows 2000 configured to enforce NTLMv2 # XXX: This in turn breaks SMB auth for Windows 2000 configured to enforce NTLMv2
@ -191,8 +191,6 @@ attr_accessor :socket, :client, :direct, :shares, :last_share
ok.guid.to_binary_s ok.guid.to_binary_s
elsif ok.respond_to? :fid elsif ok.respond_to? :fid
ok.fid.to_binary_s ok.fid.to_binary_s
else
ok['Payload'].v['FileID']
end end
fh = OpenPipe.new(self.client, path, self.client.last_tree_id, file_id) fh = OpenPipe.new(self.client, path, self.client.last_tree_id, file_id)
end end

View File

@ -61,14 +61,7 @@ class OpenFile
return data return data
else else
ok = self.client.read(self.file_id, offset, length) ok = self.client.read(self.file_id, offset, length)
data = if ok.is_a? Array data = ok.pack('C*')
ok.pack('C*')
else
ok.to_s.slice(
ok['Payload'].v['DataOffset'] + 4,
ok['Payload'].v['DataLenLow']
)
end
return data return data
end end
end end
@ -91,12 +84,9 @@ class OpenFile
# Keep writing data until we run out # Keep writing data until we run out
while (chunk.length > 0) while (chunk.length > 0)
ok = self.client.write(self.file_id, fptr, chunk) ok = self.client.write(self.file_id, fptr, chunk)
if ok.is_a? BinData::Uint32le
cl = ok cl = ok
else
cl = ok['Payload'].v['CountLow']
end
# Partial write, push the failed data back into the queue # Partial write, push the failed data back into the queue
if (cl != chunk.length) if (cl != chunk.length)