avoid begin rescue blocks
parent
3eaa07afae
commit
1e64d36320
|
@ -45,7 +45,6 @@ class Metasploit3 < Msf::Post
|
|||
end
|
||||
|
||||
def parse_bookmarks
|
||||
begin
|
||||
if not parse_header
|
||||
return
|
||||
end
|
||||
|
@ -54,9 +53,6 @@ class Metasploit3 < Msf::Post
|
|||
parse_entry
|
||||
@contents_bookmark.slice!(0, 25) # 25 null bytes between entries
|
||||
end
|
||||
rescue
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -93,8 +89,10 @@ class Metasploit3 < Msf::Post
|
|||
|
||||
def decrypt(encrypted)
|
||||
length = encrypted.unpack("C")[0]
|
||||
return "" if length.nil?
|
||||
@xor_key = length
|
||||
encrypted = encrypted[1..length]
|
||||
return "" if encrypted.length != length
|
||||
decrypted = ""
|
||||
encrypted.unpack("C*").each { |byte|
|
||||
key = generate_xor_key
|
||||
|
@ -104,15 +102,11 @@ class Metasploit3 < Msf::Post
|
|||
end
|
||||
|
||||
def parse_object
|
||||
begin
|
||||
object_length = @contents_bookmark[0,1].unpack("C")[0]
|
||||
object = @contents_bookmark[0, object_length + 1 ]
|
||||
@contents_bookmark.slice!(0, object_length+1)
|
||||
content = decrypt(object)
|
||||
return content
|
||||
rescue
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
def parse_entry
|
||||
|
@ -141,7 +135,8 @@ class Metasploit3 < Msf::Post
|
|||
return false # Error!
|
||||
end
|
||||
|
||||
@contents_bookmark.slice!(0, 4) # "\x01\x00\x00\x00"
|
||||
unknown = @contents_bookmark.slice!(0, 4) # "\x01\x00\x00\x00"
|
||||
return false unless unknown == "\x01\x00\x00\x00"
|
||||
|
||||
return true
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue