don't dump a stack trace when it's a normal encoding failure.

git-svn-id: file:///home/svn/framework3/trunk@13532 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2011-08-11 21:29:53 +00:00
parent 925016535f
commit 6f5961db52
2 changed files with 18 additions and 7 deletions

View File

@ -255,10 +255,14 @@ protected
loop_block.depends_on(init_counter, init_key)
loop_inst.depends_on(loop_block)
# Generate a permutation saving the ECX and ESP registers
loop_inst.generate([
Rex::Arch::X86::ESP,
Rex::Arch::X86::ECX ], nil, state.badchars)
begin
# Generate a permutation saving the ECX and ESP registers
loop_inst.generate([
Rex::Arch::X86::ESP,
Rex::Arch::X86::ECX ], nil, state.badchars)
rescue RuntimeError => e
raise EncodingError
end
end
def sub_immediate(regnum, imm)

View File

@ -282,6 +282,7 @@ else
end
opts[:format] ||= 'ruby'
opts[:encoder] ||= nil
opts[:encode] ||= !(opts[:badchars].nil? or opts[:badchars].empty?)
if opts[:encoder].nil?
@ -332,7 +333,13 @@ if opts[:encode]
#puts opts[:badchars].inspect
1.upto(opts[:iterations].to_i) do |iteration|
raw = enc.encode(eout, opts[:badchars], nil, opts[:platform])
begin
raw = enc.encode(eout, opts[:badchars], nil, opts[:platform])
rescue Msf::EncodingError
print_error("#{enc.refname} failed: #{$!.class} : #{$!}")
skip = true
break
end
if opts[:space] and opts[:space] > 0 and raw.length > opts[:space]
print_error("#{enc.refname} created buffer that is too big (#{raw.length})\n\n")
skip = true
@ -353,9 +360,9 @@ if opts[:encode]
break
rescue => e
print_error("#{enc.refname} failed: #{e}")
print_error("#{enc.refname} failed: #{e.class} #{e}")
e.backtrace.each { |el|
print_error(el.to_s)
$stderr.puts(el.to_s)
}
end
end