Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Catch SIGINT whilst injecting payload to stop the remote process gett…

…ing killed. Process may still seg fault though... humpf. Probably not possible to avoid while using popen.. rb-libgdb anyone?
  • Loading branch information...
commit c93c51c5459d9576fa4d504ca39d82de1850fd82 1 parent 1020eb4
Ian Leitch authored
Showing with 8 additions and 0 deletions.
  1. +2 −0  lib/hijack/gdb.rb
  2. +6 −0 lib/hijack/payload.rb
View
2  lib/hijack/gdb.rb
@@ -31,10 +31,12 @@ def eval(cmd)
end
def detach
+ return unless @gdb
exec('detach')
exec('quit')
@backtrace = nil
@gdb.close
+ @gdb = nil
end
protected
View
6 lib/hijack/payload.rb
@@ -1,9 +1,15 @@
module Hijack
class Payload
def self.inject(pid)
+ gdb = nil
+ trap('SIGINT') do
+ puts
+ @received_sigint = true
+ end
gdb = GDB.new(pid)
gdb.eval(payload(pid))
gdb.detach
+ exit if @received_sigint
end
def self.payload(pid)

0 comments on commit c93c51c

Please sign in to comment.
Something went wrong with that request. Please try again.