fix: rescue rex runtime errors in x86/nonalpha

This commit is contained in:
phra 2018-08-30 01:22:24 +02:00
parent 2616472025
commit a282d2a8b1
No known key found for this signature in database
GPG Key ID: 91FF93D1B85D76B5
1 changed files with 5 additions and 1 deletions

View File

@ -42,7 +42,11 @@ class MetasploitModule < Msf::Encoder::NonAlpha
# payload.
#
def encode_block(state, block)
newchar, state.key, state.decoder_key_size = Rex::Encoder::NonAlpha::encode_byte(block.unpack('C')[0], state.key, state.decoder_key_size)
begin
newchar, state.key, state.decoder_key_size = Rex::Encoder::NonAlpha::encode_byte(block.unpack('C')[0], state.key, state.decoder_key_size)
rescue RuntimeError => e
raise BadcharError if e.message == "BadChar"
end
return newchar
end