Replace += with << for Strings in a bunch of places.

git-svn-id: file:///home/svn/framework3/trunk@6318 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2009-03-08 07:55:47 +00:00
parent 90c3586ac3
commit 96c8f6127c
21 changed files with 237 additions and 237 deletions

View File

@ -118,55 +118,55 @@ class ReadableText
#
def self.dump_exploit_module(mod, indent = '')
output = "\n"
output += " Name: #{mod.name}\n"
output += " Version: #{mod.version}\n"
output += " Platform: #{mod.platform_to_s}\n"
output += " Privileged: " + (mod.privileged? ? "Yes" : "No") + "\n"
output += " License: #{mod.license}\n"
output += "\n"
output << " Name: #{mod.name}\n"
output << " Version: #{mod.version}\n"
output << " Platform: #{mod.platform_to_s}\n"
output << " Privileged: " + (mod.privileged? ? "Yes" : "No") + "\n"
output << " License: #{mod.license}\n"
output << "\n"
# Authors
output += "Provided by:\n"
output << "Provided by:\n"
mod.each_author { |author|
output += indent + author.to_s + "\n"
output << indent + author.to_s + "\n"
}
output += "\n"
output << "\n"
# Targets
output += "Available targets:\n"
output += dump_exploit_targets(mod, indent)
output << "Available targets:\n"
output << dump_exploit_targets(mod, indent)
# Options
if (mod.options.has_options?)
output += "Basic options:\n"
output += dump_options(mod, indent)
output += "\n"
output << "Basic options:\n"
output << dump_options(mod, indent)
output << "\n"
end
# Payload information
if (mod.payload_info.length)
output += "Payload information:\n"
output << "Payload information:\n"
if (mod.payload_space)
output += indent + "Space: " + mod.payload_space.to_s + "\n"
output << indent + "Space: " + mod.payload_space.to_s + "\n"
end
if (mod.payload_badchars)
output += indent + "Avoid: " + mod.payload_badchars.length.to_s + " characters\n"
output << indent + "Avoid: " + mod.payload_badchars.length.to_s + " characters\n"
end
output += "\n"
output << "\n"
end
# Description
output += "Description:\n"
output += word_wrap(Rex::Text.compress(mod.description))
output += "\n"
output << "Description:\n"
output << word_wrap(Rex::Text.compress(mod.description))
output << "\n"
# References
if (mod.references.length > 0)
output += "References:\n"
output << "References:\n"
mod.references.each { |ref|
output += indent + ref.to_s + "\n"
output << indent + ref.to_s + "\n"
}
output += "\n"
output << "\n"
end
return output
@ -178,36 +178,36 @@ class ReadableText
#
def self.dump_auxiliary_module(mod, indent = '')
output = "\n"
output += " Name: #{mod.name}\n"
output += " Version: #{mod.version}\n"
output += "\n"
output << " Name: #{mod.name}\n"
output << " Version: #{mod.version}\n"
output << "\n"
# Authors
output += "Provided by:\n"
output << "Provided by:\n"
mod.each_author { |author|
output += indent + author.to_s + "\n"
output << indent + author.to_s + "\n"
}
output += "\n"
output << "\n"
# Options
if (mod.options.has_options?)
output += "Basic options:\n"
output += dump_options(mod, indent)
output += "\n"
output << "Basic options:\n"
output << dump_options(mod, indent)
output << "\n"
end
# Description
output += "Description:\n"
output += word_wrap(Rex::Text.compress(mod.description))
output += "\n"
output << "Description:\n"
output << word_wrap(Rex::Text.compress(mod.description))
output << "\n"
# References
if (mod.references.length > 0)
output += "References:\n"
output << "References:\n"
mod.references.each { |ref|
output += indent + ref.to_s + "\n"
output << indent + ref.to_s + "\n"
}
output += "\n"
output << "\n"
end
return output
@ -219,32 +219,32 @@ class ReadableText
def self.dump_payload_module(mod, indent = '')
# General
output = "\n"
output += " Name: #{mod.name}\n"
output += " Version: #{mod.version}\n"
output += " Platform: #{mod.platform_to_s}\n"
output += " Arch: #{mod.arch_to_s}\n"
output += "Needs Admin: " + (mod.privileged? ? "Yes" : "No") + "\n"
output += " Total size: #{mod.size}\n"
output += "\n"
output << " Name: #{mod.name}\n"
output << " Version: #{mod.version}\n"
output << " Platform: #{mod.platform_to_s}\n"
output << " Arch: #{mod.arch_to_s}\n"
output << "Needs Admin: " + (mod.privileged? ? "Yes" : "No") + "\n"
output << " Total size: #{mod.size}\n"
output << "\n"
# Authors
output += "Provided by:\n"
output << "Provided by:\n"
mod.each_author { |author|
output += indent + author.to_s + "\n"
output << indent + author.to_s + "\n"
}
output += "\n"
output << "\n"
# Options
if (mod.options.has_options?)
output += "Basic options:\n"
output += dump_options(mod)
output += "\n"
output << "Basic options:\n"
output << dump_options(mod)
output << "\n"
end
# Description
output += "Description:\n"
output += word_wrap(Rex::Text.compress(mod.description))
output += "\n\n"
output << "Description:\n"
output << word_wrap(Rex::Text.compress(mod.description))
output << "\n\n"
return output
end
@ -255,23 +255,23 @@ class ReadableText
def self.dump_basic_module(mod, indent = '')
# General
output = "\n"
output += " Name: #{mod.name}\n"
output += " Version: #{mod.version}\n"
output += " Platform: #{mod.platform_to_s}\n"
output += " Arch: #{mod.arch_to_s}\n"
output += "\n"
output << " Name: #{mod.name}\n"
output << " Version: #{mod.version}\n"
output << " Platform: #{mod.platform_to_s}\n"
output << " Arch: #{mod.arch_to_s}\n"
output << "\n"
# Authors
output += "Provided by:\n"
output << "Provided by:\n"
mod.each_author { |author|
output += indent + author.to_s + "\n"
output << indent + author.to_s + "\n"
}
output += "\n"
output << "\n"
# Description
output += "Description:\n"
output += word_wrap(Rex::Text.compress(mod.description))
output += "\n\n"
output << "Description:\n"
output << word_wrap(Rex::Text.compress(mod.description))
output << "\n\n"
return output
@ -325,9 +325,9 @@ class ReadableText
desc = word_wrap(opt.desc, indent.length + 3)
desc = desc.slice(indent.length + 3, desc.length)
output += pad + "Name : #{name}\n"
output += pad + "Current Setting: #{val}\n"
output += pad + "Description : #{desc}\n"
output << pad + "Name : #{name}\n"
output << pad + "Current Setting: #{val}\n"
output << pad + "Description : #{desc}\n"
}
return output
@ -350,9 +350,9 @@ class ReadableText
desc = word_wrap(opt.desc, indent.length + 3)
desc = desc.slice(indent.length + 3, desc.length)
output += pad + "Name : #{name}\n"
output += pad + "Current Setting: #{val}\n"
output += pad + "Description : #{desc}\n"
output << pad + "Name : #{name}\n"
output << pad + "Current Setting: #{val}\n"
output << pad + "Description : #{desc}\n"
}
return output
@ -438,4 +438,4 @@ class ReadableText
end
end end
end end

View File

@ -133,7 +133,7 @@ class DataStore < Hash
str = ''
keys.sort.each { |key|
str += "#{key}=#{self[key]}" + ((str.length) ? delim : '')
str << "#{key}=#{self[key]}" + ((str.length) ? delim : '')
}
return str
@ -259,4 +259,4 @@ class ModuleDataStore < DataStore
end
end
end

View File

@ -786,7 +786,7 @@ protected
body = Rex::Text.encode_base64(body)
new = ''
while (body.size > 0)
new += body.slice!(0, rand(3) + 1) + Rex::Text.rand_text(rand(5) + 1, '', " \n")
new << body.slice!(0, rand(3) + 1) + Rex::Text.rand_text(rand(5) + 1, '', " \n")
end
body = new
end

View File

@ -80,7 +80,7 @@ protected
#
def _find_tag
tag = (datastore['TAG'] || "msf!")
tag += ("\x01" * (tag.length - 4))
tag << ("\x01" * (tag.length - 4))
return tag[0, 4]
end
@ -88,4 +88,4 @@ protected
end
end
end
end

View File

@ -170,16 +170,16 @@ class Core
#
def cmd_banner(*args)
banner = Banner.to_s + "\n\n"
banner += " =[ msf v#{Msf::Framework::Version}\n"
banner += "+ -- --=[ "
banner += "#{framework.stats.num_exploits} exploits - "
banner += "#{framework.stats.num_payloads} payloads\n"
banner += "+ -- --=[ "
banner += "#{framework.stats.num_encoders} encoders - "
banner += "#{framework.stats.num_nops} nops\n"
banner += " =[ "
banner += "#{framework.stats.num_auxiliary} aux\n"
banner += "\n"
banner << " =[ msf v#{Msf::Framework::Version}\n"
banner << "+ -- --=[ "
banner << "#{framework.stats.num_exploits} exploits - "
banner << "#{framework.stats.num_payloads} payloads\n"
banner << "+ -- --=[ "
banner << "#{framework.stats.num_encoders} encoders - "
banner << "#{framework.stats.num_nops} nops\n"
banner << " =[ "
banner << "#{framework.stats.num_auxiliary} aux\n"
banner << "\n"
# Display the banner
print(banner)
@ -830,7 +830,7 @@ class Core
added = "Loaded #{overall} modules:\n"
totals.each_pair { |type, count|
added += " #{count} #{type}#{count != 1 ? 's' : ''}\n"
added << " #{count} #{type}#{count != 1 ? 's' : ''}\n"
}
print(added)

View File

@ -323,19 +323,19 @@ module Net # :nodoc:
del = ("+-" * 16) + "+\n"
len = del.length
str = del + "|" + @id.to_s.center(len-3) + "|\n"
str += del + "|" + @qr.to_s
str += "|" + @opCode.to_s.center(7)
str += "|" + @aa.to_s
str += "|" + @tc.to_s
str += "|" + @rd.to_s
str += "|" + @ra.to_s
str += "|" + @ad.to_s
str += "|" + @cd.to_s.center(3)
str += "|" + @rCode.to_s.center(7) + "|\n"
str += del + "|" + @qdCount.to_s.center(len-3) + "|\n"
str += del + "|" + @anCount.to_s.center(len-3) + "|\n"
str += del + "|" + @nsCount.to_s.center(len-3) + "|\n"
str += del + "|" + @arCount.to_s.center(len-3) + "|\n" + del
str << del + "|" + @qr.to_s
str << "|" + @opCode.to_s.center(7)
str << "|" + @aa.to_s
str << "|" + @tc.to_s
str << "|" + @rd.to_s
str << "|" + @ra.to_s
str << "|" + @ad.to_s
str << "|" + @cd.to_s.center(3)
str << "|" + @rCode.to_s.center(7) + "|\n"
str << del + "|" + @qdCount.to_s.center(len-3) + "|\n"
str << del + "|" + @anCount.to_s.center(len-3) + "|\n"
str << del + "|" + @nsCount.to_s.center(len-3) + "|\n"
str << del + "|" + @arCount.to_s.center(len-3) + "|\n" + del
str
end
@ -758,4 +758,4 @@ class HeaderWrongOpcode < ArgumentError # :nodoc: all
end
class HeaderDuplicateID < ArgumentError # :nodoc: all
end
end

View File

@ -249,42 +249,42 @@ module Net # :nodoc:
def inspect
retval = ""
if @answerfrom != "0.0.0.0:0" and @answerfrom
retval += ";; Answer received from #@answerfrom (#{@answersize} bytes)\n;;\n"
retval << ";; Answer received from #@answerfrom (#{@answersize} bytes)\n;;\n"
end
retval += ";; HEADER SECTION\n"
retval += @header.inspect
retval << ";; HEADER SECTION\n"
retval << @header.inspect
retval += "\n"
retval << "\n"
section = (@header.opCode == "UPDATE") ? "ZONE" : "QUESTION"
retval += ";; #{section} SECTION (#{@header.qdCount} record#{@header.qdCount == 1 ? '' : 's'}):\n"
retval << ";; #{section} SECTION (#{@header.qdCount} record#{@header.qdCount == 1 ? '' : 's'}):\n"
@question.each do |qr|
retval += ";; " + qr.inspect + "\n"
retval << ";; " + qr.inspect + "\n"
end
unless @answer.size == 0
retval += "\n"
retval << "\n"
section = (@header.opCode == "UPDATE") ? "PREREQUISITE" : "ANSWER"
retval += ";; #{section} SECTION (#{@header.anCount} record#{@header.anCount == 1 ? '' : 's'}):\n"
retval << ";; #{section} SECTION (#{@header.anCount} record#{@header.anCount == 1 ? '' : 's'}):\n"
@answer.each do |rr|
retval += rr.inspect + "\n"
retval << rr.inspect + "\n"
end
end
unless @authority.size == 0
retval += "\n"
retval << "\n"
section = (@header.opCode == "UPDATE") ? "UPDATE" : "AUTHORITY"
retval += ";; #{section} SECTION (#{@header.nsCount} record#{@header.nsCount == 1 ? '' : 's'}):\n"
retval << ";; #{section} SECTION (#{@header.nsCount} record#{@header.nsCount == 1 ? '' : 's'}):\n"
@authority.each do |rr|
retval += rr.inspect + "\n"
retval << rr.inspect + "\n"
end
end
unless @additional.size == 0
retval += "\n"
retval += ";; ADDITIONAL SECTION (#{@header.arCount} record#{@header.arCount == 1 ? '' : 's'}):\n"
retval << "\n"
retval << ";; ADDITIONAL SECTION (#{@header.arCount} record#{@header.arCount == 1 ? '' : 's'}):\n"
@additional.each do |rr|
retval += rr.inspect + "\n"
retval << rr.inspect + "\n"
end
end
@ -567,4 +567,4 @@ end # module Net
class PacketError < StandardError # :nodoc:
end
class PacketArgumentError < ArgumentError # :nodoc:
end
end

View File

@ -21,7 +21,7 @@ class AlphaMixed < Generic
else
mod = 'A' * (offset - 16)
nop = 'C' * (16 - mod.length)
mod += nop + '7QZ'
mod << nop + '7QZ'
edxmod = 'B' * (17 - (offset - 16))
end
regprefix = {
@ -61,4 +61,4 @@ class AlphaMixed < Generic
return decoder
end
end end end end
end end end end

View File

@ -22,7 +22,7 @@ class AlphaUpper < Generic
else
mod = 'A' * (offset - 10)
nop = 'C' * (10 - mod.length)
mod += nop + 'QZ'
mod << nop + 'QZ'
edxmod = 'B' * (11 - (offset - 10))
end
regprefix = {
@ -72,4 +72,4 @@ class AlphaUpper < Generic
return decoder
end
end end end end
end end end end

View File

@ -41,7 +41,7 @@ module NDR
# use to encode:
# char *element_1;
def NDR.string(string)
string += "\x00" # null pad
string << "\x00" # null pad
return long(string.length) + long(0) + long(string.length) + string + align(string)
end
@ -49,7 +49,7 @@ module NDR
# use to encode:
# w_char *element_1;
def NDR.wstring(string)
string += "\x00" # null pad
string << "\x00" # null pad
return long(string.length) + long(0) + long(string.length) + Rex::Text.to_unicode(string) + align(Rex::Text.to_unicode(string))
end
@ -57,7 +57,7 @@ module NDR
# use to encode:
# [unique] w_char *element_1;
def NDR.uwstring(string)
string += "\x00" # null pad
string << "\x00" # null pad
return long(rand(0xffffffff))+long(string.length) + long(0) + long(string.length) + Rex::Text.to_unicode(string) + align(Rex::Text.to_unicode(string))
end
@ -67,7 +67,7 @@ module NDR
def NDR.wstring_prebuilt(string)
# if the string len is odd, thats bad!
if string.length % 2 > 0
string += "\x00"
string << "\x00"
end
len = string.length / 2;
return long(len) + long(0) + long(len) + string + align(string)
@ -85,4 +85,4 @@ module NDR
end
end
end
end

View File

@ -31,7 +31,7 @@ module XDR
def XDR.encode_string(str, max=MAX_ARG)
raise ArgumentError, 'XDR: String too long' if str.length > max
len = str.length
str += "\x00" * ((4 - (len & 3)) & 3)
str << "\x00" * ((4 - (len & 3)) & 3)
return encode_int(len) + str
end
@ -102,4 +102,4 @@ module XDR
end
end
end
end

View File

@ -77,11 +77,11 @@ class Arguments
fmt.sort.each { |entry|
fmtspec, val = entry
txt += " #{fmtspec}" + ((val[0] == true) ? " <opt> " : " ")
txt += val[1] + "\n"
txt << " #{fmtspec}" + ((val[0] == true) ? " <opt> " : " ")
txt << val[1] + "\n"
}
txt += "\n"
txt << "\n"
return txt
end

View File

@ -121,31 +121,31 @@ class Client
uri = set_uri(c_uri)
req = ''
req += set_method(c_meth)
req += set_method_uri_spacer()
req += set_uri_prepend()
req += (c_enc ? set_encode_uri(uri) : uri)
req << set_method(c_meth)
req << set_method_uri_spacer()
req << set_uri_prepend()
req << (c_enc ? set_encode_uri(uri) : uri)
if (c_qs)
req += '?'
req += (c_enc ? set_encode_qs(c_qs) : c_qs)
req << '?'
req << (c_enc ? set_encode_qs(c_qs) : c_qs)
end
req += set_uri_append()
req += set_uri_version_spacer()
req += set_version(c_prot, c_vers)
req += set_host_header(c_host)
req += set_agent_header(c_ag)
req << set_uri_append()
req << set_uri_version_spacer()
req << set_version(c_prot, c_vers)
req << set_host_header(c_host)
req << set_agent_header(c_ag)
if (c_auth.length > 0)
req += set_basic_auth_header(c_auth)
req << set_basic_auth_header(c_auth)
end
req += set_cookie_header(c_cook)
req += set_connection_header(c_conn)
req += set_extra_headers(c_head)
req += set_raw_headers(c_rawh)
req += set_body(c_body)
req << set_cookie_header(c_cook)
req << set_connection_header(c_conn)
req << set_extra_headers(c_head)
req << set_raw_headers(c_rawh)
req << set_body(c_body)
req
end
@ -211,36 +211,36 @@ class Client
end
req = ''
req += set_method(c_meth)
req += set_method_uri_spacer()
req += set_uri_prepend()
req += set_encode_uri(uri)
req << set_method(c_meth)
req << set_method_uri_spacer()
req << set_uri_prepend()
req << set_encode_uri(uri)
if (qstr.length > 0)
req += '?'
req += qstr
req << '?'
req << qstr
end
req += set_path_info(c_path)
req += set_uri_append()
req += set_uri_version_spacer()
req += set_version(c_prot, c_vers)
req += set_host_header(c_host)
req += set_agent_header(c_ag)
req << set_path_info(c_path)
req << set_uri_append()
req << set_uri_version_spacer()
req << set_version(c_prot, c_vers)
req << set_host_header(c_host)
req << set_agent_header(c_ag)
if (c_auth.length > 0)
req += set_basic_auth_header(c_auth)
req << set_basic_auth_header(c_auth)
end
req += set_cookie_header(c_cook)
req += set_connection_header(c_conn)
req += set_extra_headers(c_head)
req << set_cookie_header(c_cook)
req << set_connection_header(c_conn)
req << set_extra_headers(c_head)
req += set_content_type_header(c_type)
req += set_content_len_header(pstr.length)
req += set_chunked_header()
req += set_raw_headers(c_rawh)
req += set_body(pstr)
req << set_content_type_header(c_type)
req << set_content_len_header(pstr.length)
req << set_chunked_header()
req << set_raw_headers(c_rawh)
req << set_body(pstr)
req
end
@ -448,19 +448,19 @@ class Client
uri.split('/').each do |part|
cnt = rand(8)+2
1.upto(cnt) { |idx|
buf += "/" + Rex::Text.rand_text_alphanumeric(rand(32)+1)
buf << "/" + Rex::Text.rand_text_alphanumeric(rand(32)+1)
}
buf += ("/.." * cnt)
buf += "/" + part
buf << ("/.." * cnt)
buf << "/" + part
end
uri = buf
end
if (self.config['uri_full_url'])
url = self.ssl ? "https" : "http"
url += self.config['vhost']
url += (self.port == 80) ? "" : ":#{self.port}"
url += uri
url << self.config['vhost']
url << (self.port == 80) ? "" : ":#{self.port}"
url << uri
url
else
uri
@ -481,10 +481,10 @@ class Client
uri.split('/').each do |part|
cnt = rand(8)+2
1.upto(cnt) { |idx|
buf += "/" + Rex::Text.rand_text_alphanumeric(rand(32)+1)
buf << "/" + Rex::Text.rand_text_alphanumeric(rand(32)+1)
}
buf += ("/.." * cnt)
buf += "/" + part
buf << ("/.." * cnt)
buf << "/" + part
end
uri = buf
end
@ -493,9 +493,9 @@ class Client
if (self.config['uri_full_url'])
url = self.ssl ? "https" : "http"
url += self.config['vhost']
url += (self.port == 80) ? "" : ":#{self.port}"
url += uri
url << self.config['vhost']
url << (self.port == 80) ? "" : ":#{self.port}"
url << uri
end
url
@ -540,7 +540,7 @@ class Client
ret = Rex::Text.to_rand_case(ret)
end
ret += "\r\n"
ret << "\r\n"
end
#
@ -552,7 +552,7 @@ class Client
chunked = ''
while str.size > 0
chunk = str.slice!(0,rand(self.config['chunked_size']) + 1)
chunked += sprintf("%x", chunk.size) + "\r\n" + chunk + "\r\n"
chunked << sprintf("%x", chunk.size) + "\r\n" + chunk + "\r\n"
end
"\r\n" + chunked + "0\r\n\r\n"
end
@ -694,7 +694,7 @@ class Client
if (self.config['pad_fake_headers'])
1.upto(self.config['pad_fake_headers_count'].to_i) do |i|
buf += set_formatted_header(
buf << set_formatted_header(
Rex::Text.rand_text_alphanumeric(rand(32)+1),
Rex::Text.rand_text_alphanumeric(rand(32)+1)
)
@ -702,7 +702,7 @@ class Client
end
headers.each_pair do |var,val|
buf += set_formatted_header(var, val)
buf << set_formatted_header(var, val)
end
buf
@ -782,4 +782,4 @@ end
end
end
end
end

View File

@ -46,7 +46,7 @@ class Handler::Erb < Handler
return
# If the request is for the root directory, use the document index file.
elsif (resource == '/')
resource += opts['DocumentIndex'] || 'index.rhtml'
resource << opts['DocumentIndex'] || 'index.rhtml'
end
begin
@ -125,4 +125,4 @@ end
end
end
end
end

View File

@ -32,7 +32,7 @@ class Packet::Header < Hash
# ghettoooooo!
# If we don't have any newlines..., put one there.
if (header.size > 0 && header !~ /\r\n/)
header += "\r\n"
header << "\r\n"
end
# put the non-standard line terminations back to normal
@ -49,7 +49,7 @@ class Packet::Header < Hash
header.split(/\r\n/m).each { |str|
if (md = str.match(/^(.+?): (.+?)$/))
if (self[md[1]])
self[md[1]] += ", " + md[2]
self[md[1]] << ", " + md[2]
else
self[md[1]] = md[2]
end
@ -103,22 +103,22 @@ class Packet::Header < Hash
if self.junk_headers
while str.length < 4096
if self.fold
str += "X-#{Rex::Text.rand_text_alphanumeric(rand(30) + 5)}:\r\n\t#{Rex::Text.rand_text_alphanumeric(rand(1024) + 1)}\r\n"
str << "X-#{Rex::Text.rand_text_alphanumeric(rand(30) + 5)}:\r\n\t#{Rex::Text.rand_text_alphanumeric(rand(1024) + 1)}\r\n"
else
str += "X-#{Rex::Text.rand_text_alphanumeric(rand(30) + 5)}: #{Rex::Text.rand_text_alphanumeric(rand(1024) + 1)}\r\n"
str << "X-#{Rex::Text.rand_text_alphanumeric(rand(30) + 5)}: #{Rex::Text.rand_text_alphanumeric(rand(1024) + 1)}\r\n"
end
end
end
each_pair { |var, val|
if self.fold
str += "#{var}:\r\n\t#{val}\r\n"
str << "#{var}:\r\n\t#{val}\r\n"
else
str += "#{var}: #{val}\r\n"
str << "#{var}: #{val}\r\n"
end
}
str += "\r\n"
str << "\r\n"
return str
end
@ -157,4 +157,4 @@ end
end
end
end
end

View File

@ -74,7 +74,7 @@ class Packet
def parse(buf)
# Append the incoming buffer to the buffer queue.
self.bufq += buf
self.bufq << buf
begin
# If we're processing headers, do that now.
@ -147,9 +147,9 @@ class Packet
while (str.size > 0)
chunk = str.slice!(0, rand(max_size - min_size) + min_size)
chunked += sprintf("%x", chunk.size) + "\r\n" + chunk + "\r\n"
chunked << sprintf("%x", chunk.size) + "\r\n" + chunk + "\r\n"
end
chunked += "0\r\n\r\n"
chunked << "0\r\n\r\n"
end
#
@ -189,7 +189,7 @@ class Packet
end
str = self.headers.to_s(cmd_string)
str += content || ''
str << content || ''
end
#
@ -393,11 +393,11 @@ protected
if (self.body_bytes_left > 0)
part = self.bufq.slice!(0, self.body_bytes_left)
self.body += part
self.body << part
self.body_bytes_left -= part.length
# Otherwise, just read it all.
else
self.body += self.bufq
self.body << self.bufq
self.bufq = ''
end

View File

@ -129,7 +129,7 @@ class Request < Packet
str.gsub!(/\//) {
dirs = ''
(rand(5)+5).times {
dirs += '/' + Rex::Text.rand_text_alpha(rand(5) + 1) + '/..'
dirs << '/' + Rex::Text.rand_text_alpha(rand(5) + 1) + '/..'
}
dirs + '/'
}
@ -155,7 +155,7 @@ class Request < Packet
if !PostRequests.include?(self.method)
if param_string.size > 0
str += '?' + param_string
str << '?' + param_string
end
end
str
@ -206,7 +206,7 @@ class Request < Packet
if self.headers['Host']
host = "Host: #{self.headers['Host']}\r\n"
end
str += "GET / HTTP/1.1\r\n#{host}Connection: Keep-Alive\r\n\r\n" * self.junk_pipeline
str << "GET / HTTP/1.1\r\n#{host}Connection: Keep-Alive\r\n\r\n" * self.junk_pipeline
self.headers['Connection'] = 'Closed'
end
str + super

View File

@ -72,7 +72,7 @@ class RangeWalker
addr = Rex::Socket.addr_itoa(self.curr_ip)
self.curr_ip += 1
addr += "%#{self.curr_scope}" if self.curr_scope
addr << "%#{self.curr_scope}" if self.curr_scope
return addr
end
@ -90,4 +90,4 @@ protected
end
end
end
end

View File

@ -298,9 +298,9 @@ module Text
raise TypeError, 'Invalid mode. Only "overlong" and "invalid" are acceptable modes for utf-8'
end
end
string += [out.join('')].pack('B*')
string << [out.join('')].pack('B*')
else
string += [a].pack('C')
string << [a].pack('C')
end
}
return string
@ -326,7 +326,7 @@ module Text
if possible.nil?
raise TypeError, "codepage #{mode} does not provide an encoding for 0x#{char.unpack('H*')[0]}"
end
string += possible[ rand(possible.length) ]
string << possible[ rand(possible.length) ]
}
return string
when 'uhwtfms-half' # suggested name from HD :P
@ -340,16 +340,16 @@ module Text
end
str.each_byte {|byte|
if ((byte >= 33 && byte <= 63) || (byte >= 96 && byte <= 126))
string += "\xFF" + [byte ^ 32].pack('C')
string << "\xFF" + [byte ^ 32].pack('C')
elsif (byte >= 64 && byte <= 95)
string += "\xFF" + [byte ^ 96].pack('C')
string << "\xFF" + [byte ^ 96].pack('C')
else
char = [byte].pack('C')
possible = @@codepage_map_cache[mode]['data'][char]
if possible.nil?
raise TypeError, "codepage #{mode} does not provide an encoding for 0x#{char.unpack('H*')[0]}"
end
string += possible[ rand(possible.length) ]
string << possible[ rand(possible.length) ]
end
}
return string
@ -508,12 +508,12 @@ module Text
# If this is a new line, prepend with the
# line start text
if (new_line == true)
append += line_start
append << line_start
new_line = false
end
# Append the hexified version of the byte
append += sprintf("\\x%.2x", byte)
append << sprintf("\\x%.2x", byte)
cur += append.length
# If we're about to hit the column or have gone past it,
@ -526,18 +526,18 @@ module Text
# If this is the last byte, use the buf_end instead of
# line_end
if (count == str.length)
append += buf_end + "\n"
append << buf_end + "\n"
else
append += line_end + "\n"
append << line_end + "\n"
end
end
output += append
output << append
}
# If we were in the middle of a line, finish the buffer at this point
if (new_line == false)
output += buf_end + "\n"
output << buf_end + "\n"
end
return output
@ -800,7 +800,7 @@ module Text
if foo.length >= 256
len.times { buff << Kernel.rand(256) }
else
len.times { buff += foo[ rand(foo.length) ] }
len.times { buff << foo[ rand(foo.length) ] }
end
return buff
@ -867,7 +867,7 @@ module Text
until buf.length >= length
begin
buf += converge_sets(sets, 0, offsets, length)
buf << converge_sets(sets, 0, offsets, length)
rescue RuntimeError
break
end
@ -1108,7 +1108,7 @@ protected
# If there are more sets after use, converage with them.
if (sets[idx + 1])
buf += converge_sets(sets, idx + 1, offsets, length)
buf << converge_sets(sets, idx + 1, offsets, length)
else
# Increment the current set offset as well as previous ones if we
# wrap back to zero.

View File

@ -319,7 +319,7 @@ module DispatcherShell
tbl << c
}
str += "\n" + tbl.to_s + "\n"
str << "\n" + tbl.to_s + "\n"
}
return str

View File

@ -88,19 +88,19 @@ class Table
#
def to_s
str = prefix
str += header_to_s || ''
str += columns_to_s || ''
str += hr_to_s || ''
str << header_to_s || ''
str << columns_to_s || ''
str << hr_to_s || ''
rows.each { |row|
if (is_hr(row))
str += hr_to_s
str << hr_to_s
else
str += row_to_s(row)
str << row_to_s(row)
end
}
str += postfix
str << postfix
return str
end
@ -185,14 +185,14 @@ protected
barline = nameline
columns.each_with_index { |col,idx|
nameline += col + pad(' ', col, idx)
remainder = colprops[idx]['MaxWidth'] - col.length
nameline << col + pad(' ', col, idx)
remainder = colprops[idx]['MaxWidth'] - col.length
if (remainder < 0)
remainder = 0
end
barline += ('-' * col.length) + (' ' * (cellpad + remainder))
barline << ('-' * col.length) + (' ' * (cellpad + remainder))
}
return "#{nameline}\n#{barline}"
@ -212,7 +212,7 @@ protected
line = ' ' * indent
row.each_with_index { |cell, idx|
line += cell.to_s + pad(' ', cell.to_s, idx)
line << cell.to_s + pad(' ', cell.to_s, idx)
}
return line + "\n"
@ -227,7 +227,7 @@ protected
val = chr * remainder;
if (use_cell_pad)
val += ' ' * cellpad
val << ' ' * cellpad
end
return val
@ -237,4 +237,4 @@ end
end
end
end
end