Reorganize trans2_find_first2 requests

bug/bundler_fix
jvazquez-r7 2015-02-20 18:28:49 -06:00
parent 52a0e6dd1c
commit df903120e3
1 changed files with 27 additions and 18 deletions

View File

@ -415,21 +415,7 @@ module Msf
smb_cmd_trans_query_path_info_standard(c, buff)
end
when CONST::TRANS2_FIND_FIRST2
dprint("\t[find_first2]")
loi = ar[156..159].unpack('n*').reverse.pack('n*').to_i(16)
case loi
when CONST::SMB_FIND_FILE_NAMES_INFO
dprint("\t\t[SMB_FIND_FILE_NAMES_INFO]")
smb_cmd_trans_find_first2_file(c, buff)
when CONST::SMB_FIND_FILE_BOTH_DIRECTORY_INFO
dprint("\t\t[SMB_FIND_FILE_BOTH_DIRECTORY_INFO]")
smb_cmd_trans_find_first2(c, buff)
when CONST::SMB_FIND_FILE_FULL_DIRECTORY_INFO
dprint("\t\t[SMB_FIND_FILE_FULL_DIRECTORY_INFO]")
smb_cmd_trans_find_first2_full(c, buff)
else
smb_cmd_trans_find_first2(c, buff)
end
smb_cmd_trans2_find_first2(c, buff)
else
dprint("\t[UNKNOWN SUBCOMMAND]")
pkt = CONST::SMB_TRANS_RES_PKT.make_struct
@ -721,11 +707,34 @@ module Msf
end
end
def smb_cmd_trans2_find_first2(c, buff)
dprint("[smb_cmd_trans2_find_first2]")
ar = Rex::Text.to_hex(buff, '').to_s
loi = ar[156..159].unpack('n*').reverse.pack('n*').to_i(16)
case loi
when CONST::SMB_FIND_FILE_NAMES_INFO
dprint("\t[SMB_FIND_FILE_NAMES_INFO]")
smb_cmd_find_file_names_info(c, buff)
when CONST::SMB_FIND_FILE_BOTH_DIRECTORY_INFO
dprint("\t[SMB_FIND_FILE_BOTH_DIRECTORY_INFO]")
smb_cmd_find_file_both_directory_info(c, buff)
when CONST::SMB_FIND_FILE_FULL_DIRECTORY_INFO
dprint("\t[SMB_FIND_FILE_FULL_DIRECTORY_INFO]")
smb_cmd_find_file_full_directory_info(c, buff)
else
dprint("\t[Unexpected :?]") #TODO
#smb_cmd_trans_find_first2(c, buff)
fail_with(Failure::Unknown, "Invalid or unknown TRANS2_FIND_FIRST2 REQUEST???") #TODO
end
end
#
# Responds to FIND_FIRST2 requests
# Command: Find File Both Directory Info
#
def smb_cmd_trans_find_first2(c, buff)
def smb_cmd_find_file_both_directory_info(c, buff)
dprint("[smb_cmd_trans_find_first2]")
pkt = CONST::SMB_TRANS_RES_PKT.make_struct
smb_set_defaults(c, pkt)
@ -804,7 +813,7 @@ module Msf
# Responds to FIND_FIRST2 requests
# Command: Find File Names Info
#
def smb_cmd_trans_find_first2_file(c, buff)
def smb_cmd_find_file_names_info(c, buff)
dprint("[smb_cmd_trans_find_first2_file]")
pkt = CONST::SMB_TRANS_RES_PKT.make_struct
smb_set_defaults(c, pkt)
@ -860,7 +869,7 @@ module Msf
# Responds to FIND_FIRST2 requests
# Command: Find File Full Directory Info
#
def smb_cmd_trans_find_first2_full(c, buff)
def smb_cmd_find_file_full_directory_info(c, buff)
dprint("[smb_cmd_trans_find_first2_full]")
pkt = CONST::SMB_TRANS_RES_PKT.make_struct
smb_set_defaults(c, pkt)