Do better handling of TRAN2_QUERY_FILE_INFORMATION requests

bug/bundler_fix
jvazquez-r7 2015-02-24 17:20:41 -06:00
parent d29e9fc20b
commit ec53e27249
3 changed files with 33 additions and 28 deletions

View File

@ -31,16 +31,13 @@ module Msf
case sub_command
when CONST::TRANS2_QUERY_FILE_INFO
smb_cmd_trans2_query_file_information(c, buff)
parameters = data_trans2.v['Parameters'].gsub(/^[\x00]*/, '') #delete padding
#smb_cmd_trans2_query_file_information(c, buff)
smb_cmd_trans2_query_file_information(c, parameters)
when CONST::TRANS2_QUERY_PATH_INFO
smb_cmd_trans2_query_path_information(c, buff)
when CONST::TRANS2_FIND_FIRST2
puts "TRANS2_FIND_FIRST2"
puts "#{Rex::Text.to_hex_dump(pkt['Payload'].v['SetupData'])}"
#smb_cmd_trans2_find_first2(c, buff)
parameters = data_trans2.v['Parameters'].gsub(/^[\x00]*/, '') #delete padding
puts "TRANS2_FIND_FIRST2 parameters"
puts "#{Rex::Text.to_hex_dump(parameters)}"
smb_cmd_trans2_find_first2(c, parameters)
else
dprint("\t[Unsupported/Unknown command] SUB_COMMAND: #{sub_command}")

View File

@ -10,18 +10,25 @@ module Msf
def smb_cmd_trans2_query_file_information(c, buff)
#dprint("[smb_cmd_trans2_query_file_information]")
ar = Rex::Text.to_hex(buff, '').to_s
loi = ar[148..151].unpack('n*').reverse.pack('n*').to_i(16)
#ar = Rex::Text.to_hex(buff, '').to_s
#loi = ar[148..151].unpack('n*').reverse.pack('n*').to_i(16)
params = CONST::SMB_QUERY_FILE_TRANS2_PARAMETERS.make_struct
params.from_s(buff)
loi = params.v['InformationLevel']
fid = params.v['FID']
case loi
when CONST::SMB_QUERY_FILE_STANDARD_INFO, CONST::SMB_QUERY_FILE_STANDARD_INFO_ALIAS
#dprint("\t\t[smb_cmd_trans_query_file_info_standard]")
smb_cmd_trans_query_file_info_standard(c, buff)
smb_cmd_trans_query_file_info_standard(c, fid)
when CONST::SMB_QUERY_FILE_BASIC_INFO, CONST::SMB_QUERY_FILE_BASIC_INFO_ALIAS, CONST::SMB_SET_FILE_BASIC_INFO_ALIAS
#dprint("\t\t[smb_cmd_trans_query_file_info_basic]")
smb_cmd_trans_query_file_info_basic(c, buff)
when CONST::SMB_QUERY_FILE_NETWORK_OPEN_INFO
dprint("\t\t[smb_cmd_trans_query_file_info_network]")
smb_cmd_trans_query_file_info_network(c, buff)
smb_cmd_trans_query_file_info_basic(c, fid)
#when CONST::SMB_QUERY_FILE_NETWORK_OPEN_INFO
#dprint("\t\t[smb_cmd_trans_query_file_info_network]")
#smb_cmd_trans_query_file_info_network(c, fid)
else
dprint("\t\tUnknown LOI [smb_cmd_trans2_query_file_information] - #{loi.to_s}")
# SEND success with the hope of going ahead...

View File

@ -273,8 +273,9 @@ module Msf
pkt.from_s(buff)
payload = pkt['Payload'].v['SetupData'].gsub(/\x00/, '').gsub(/.*\\/, '').chomp.strip
#dprint("[smb_cmd_trans_query_file_info_network] Payload length: #{payload.length.to_s}")
#dprint("[smb_cmd_trans_query_file_info_network] Payload is : #{payload.to_s}")
dprint("[smb_cmd_trans_query_file_info_network] Payload length: #{payload.length.to_s}")
dprint("[smb_cmd_trans_query_file_info_network] Payload is : #{payload.to_s}")
if payload.length.to_s.eql?('4')
attrib = "\x10\x00\x00\x00" # File attributes => directory