diff --git a/lib/one_gadget/fetchers/amd64.rb b/lib/one_gadget/fetchers/amd64.rb index eaa7998..c12f55b 100644 --- a/lib/one_gadget/fetchers/amd64.rb +++ b/lib/one_gadget/fetchers/amd64.rb @@ -33,7 +33,7 @@ def candidates # ... # call execve def jmp_case_candidates - `#{@objdump.command}|egrep '# #{bin_sh_hex}' -A 8`.split('--').map do |cand| + `#{@objdump.command}|grep -E '# #{bin_sh_hex}' -A 8`.split('--').map do |cand| cand = cand.lines.map(&:strip).reject(&:empty?) jmp_at = cand.index { |c| c.include?('jmp') } next nil if jmp_at.nil? @@ -42,7 +42,7 @@ def jmp_case_candidates next if cand.any? { |c| c.include?(call_str) } jmp_addr = cand.last.scan(/jmp\s+([\da-f]+)\s/)[0][0].to_i(16) - dump = `#{@objdump.command(start: jmp_addr, stop: jmp_addr + 100)}|egrep '[0-9a-f]+:'` + dump = `#{@objdump.command(start: jmp_addr, stop: jmp_addr + 100)}|grep -E '[0-9a-f]+:'` remain = dump.lines.map(&:strip).reject(&:empty?) call_execve = remain.index { |r| r.match(/call.*/) } next if call_execve.nil? diff --git a/lib/one_gadget/fetchers/base.rb b/lib/one_gadget/fetchers/base.rb index 11ea867..1a33c90 100644 --- a/lib/one_gadget/fetchers/base.rb +++ b/lib/one_gadget/fetchers/base.rb @@ -51,7 +51,7 @@ def find def candidates(&block) call_regexp = "#{call_str}.*<(exec[^+]*|posix_spawn[^+]*)>$" cands = [] - `#{@objdump.command}|egrep '#{call_regexp}' -B 30`.split('--').each do |cand| + `#{@objdump.command}|grep -E '#{call_regexp}' -B 30`.split('--').each do |cand| lines = cand.lines.map(&:strip).reject(&:empty?) # split with call_regexp loop do