class OneGadget::Fetcher::AArch64
Define common methods for gadget fetchers.
Private Instance Methods
bin_sh_offset()
click to toggle source
# File lib/one_gadget/fetchers/aarch64.rb, line 25 def bin_sh_offset @bin_sh_offset ||= str_offset('/bin/sh') end
branch?(str)
click to toggle source
If str contains a branch instruction.
# File lib/one_gadget/fetchers/aarch64.rb, line 17 def branch?(str) %w[b b.hi b.gt b.eq b.le b.ls b.lt b.ne b.cs].any? { |f| str.include?(" #{f} ") } end
call_str()
click to toggle source
# File lib/one_gadget/fetchers/aarch64.rb, line 21 def call_str 'bl' end
emulator()
click to toggle source
# File lib/one_gadget/fetchers/aarch64.rb, line 12 def emulator OneGadget::Emulators::AArch64.new end
global_var?(str)
click to toggle source
# File lib/one_gadget/fetchers/aarch64.rb, line 38 def global_var?(str) str.include?('$base') end
str_bin_sh?(str)
click to toggle source
# File lib/one_gadget/fetchers/aarch64.rb, line 29 def str_bin_sh?(str) str.include?('$base') && str.include?(bin_sh_offset.to_s(16)) end
str_sh?(str)
click to toggle source
# File lib/one_gadget/fetchers/aarch64.rb, line 33 def str_sh?(str) # XXX: hardcode -0x10 is bad str.include?('$base') && str.include?((bin_sh_offset - 0x10).to_s(16)) end