Skip to content

Commit b853244

Browse files
committed
Don't waste instance variables
1 parent 91d9d93 commit b853244

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/msf/core/exploit/smb/server/share.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,6 @@ def smb_cmd_trans_find_first2(c, buff)
886886

887887
payload = pkt['Payload'].v['SetupData'].gsub(/\x00/, '').gsub(/.*\\/, '\\').chomp.strip
888888
file = file_name
889-
file_name = Rex::Text.to_unicode(file_name)
890889
path = Rex::Text.to_unicode(path_name)
891890

892891
dprint("[smb_cmd_trans_find_first2] Payload is: #{payload}")
@@ -927,7 +926,7 @@ def smb_cmd_trans_find_first2(c, buff)
927926

928927
if (payext and payext.downcase.eql?(fileext.downcase)) or payload.length.to_s.eql?('4')
929928
dprint("[smb_cmd_trans_find_first2] Sending file response #{file}")
930-
data = file_name
929+
data = Rex::Text.to_unicode(file_name)
931930
length = [exe_contents.length].pack("V")
932931
ea = "\x00\x00"
933932
alloc = "\x00\x00\x10\x00\x00\x00\x00\x00" # Allocation Size = 1048576 || 1Mb
@@ -995,7 +994,6 @@ def smb_cmd_trans_find_first2_file(c, buff)
995994

996995
payload = pkt['Payload'].v['SetupData'].gsub(/\x00/, '').gsub(/.*\\/, '\\').chomp.strip.split('\\').last
997996
file = file_name
998-
file_name = Rex::Text.to_unicode(file_name)
999997
path = Rex::Text.to_unicode(path_name)
1000998
dprint("[smb_cmd_trans_find_first2_file] Payload is: #{payload}")
1001999
dprint("[smb_cmd_trans_find_first2_file] Payload length: #{payload.length.to_s}")
@@ -1035,7 +1033,7 @@ def smb_cmd_trans_find_first2_file(c, buff)
10351033

10361034
if (payext and payext.downcase.eql?(fileext.downcase)) or payload.length.to_s.eql?('4')
10371035
dprint("[smb_cmd_trans_find_first2_file] Sending file response #{file}")
1038-
data = file_name
1036+
data = Rex::Text.to_unicode(file_name)
10391037
else
10401038
dprint("[smb_cmd_trans_find_first2_file] Sending directory response #{path}")
10411039
data = path
@@ -1083,7 +1081,6 @@ def smb_cmd_trans_find_first2_full(c, buff)
10831081

10841082
payload = pkt['Payload'].v['SetupData'].gsub(/\x00/, '').gsub(/.*\\/, '\\').chomp.strip
10851083
file = file_name
1086-
file_name = Rex::Text.to_unicode(file_name)
10871084
path = Rex::Text.to_unicode(path_name)
10881085

10891086
dprint("[smb_cmd_trans_find_first2_full] Payload is: #{payload}")
@@ -1124,7 +1121,7 @@ def smb_cmd_trans_find_first2_full(c, buff)
11241121

11251122
if (payext and payext.downcase.eql?(fileext.downcase)) or payload.length.to_s.eql?('4')
11261123
dprint("[smb_cmd_trans_find_first2_full] Sending file response #{file}")
1127-
data = file_name
1124+
data = Rex::Text.to_unicode(file_name)
11281125
length = [exe_contents.length].pack("V")
11291126
ea = "\x00\x00"
11301127
alloc = "\x00\x00\x10\x00\x00\x00\x00\x00" # Allocation Size = 1048576 || 1Mb

0 commit comments

Comments
 (0)