Fix an issue caused by pad_data being a string not an integer, this caused the evasion code to return a nil. Fixed a couple of ambiguities in how options are passed

git-svn-id: file:///home/svn/framework3/trunk@9674 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-07-05 13:38:39 +00:00
parent 21b3be4f53
commit f3afedf490
2 changed files with 22 additions and 21 deletions

View File

@ -21,41 +21,41 @@ EVASION_MAX = 3
min_size = max_size - 1
end
case level
when nil, EVASION_NONE
return ''
case level.to_i
when EVASION_LOW
Rex::Text.rand_text(32)
when EVASION_HIGH
Rex::Text.rand_text( rand(max_size - min_size) + min_size )
when EVASION_MAX
Rex::Text.rand_text( rand(max_size) )
else EVASION_NONE
return ''
end
end
# Obscures a named pipe pathname via leading and trailing slashes
def self.make_named_pipe_path(level, pipe)
case level
when nil, EVASION_NONE
return '\\' + pipe
case level.to_i
when EVASION_LOW
return ('\\' * (1024 + rand(512))) + pipe
when EVASION_HIGH, EVASION_MAX
return ('\\' * (1024 + rand(512))) + pipe + ('\\' * (1024 + rand(512)))
else
return '\\' + pipe
end
end
# Obscures the TransactNamedPipe \PIPE\ string
def self.make_trans_named_pipe_name(level)
case level
when nil, EVASION_NONE
return '\\PIPE\\'
case level.to_i
when EVASION_LOW
return ('\\' * (256 - rand(64)) + 'PIPE\\')
when EVASION_HIGH
return Rex::Text.rand_text(512 - rand(128))
when EVASION_MAX
return Rex::Text.rand_text(1024 - rand(256))
else
return '\\PIPE\\'
end
end
@ -63,3 +63,4 @@ end
end
end
end

View File

@ -661,7 +661,7 @@ module Text
# Base text generator method
def self.rand_base(len, bad, *foo)
cset = (foo.join.unpack("C*") - bad.to_s.unpack("C*")).uniq
return if cset.length == 0
return "" if cset.length == 0
outp = []
len.times { outp << cset[rand(cset.length)] }
outp.pack("C*")