Permalink
Browse files

Minor release 0.1.8 - "Less likely to kill your dog"

  • Loading branch information...
1 parent 257b542 commit d8e3c99ce15f6b756b3141109b604880e97982b1 Ian Leitch committed Sep 18, 2009
Showing with 11 additions and 18 deletions.
  1. +1 −10 README.rdoc
  2. +2 −2 hijack.gemspec
  3. +5 −5 lib/hijack/gdb.rb
  4. +2 −0 lib/hijack/payload.rb
  5. +1 −1 tasks/gem.rake
View
@@ -6,10 +6,6 @@ Hijack allows you to connect to any ruby process and execute code as if it were
Hijack uses DRb over a unix socket file, so you need to be on the same machine as the process you want to hijack. This is by design for security reasons. You also need to run the hijack client as the same user as the remote process.
-== WARNING
-
-Hijack is new code, I'd think twice about trying it out on your critical production systems. I'd love to get some feedback though so if you have any development or staging systems to try it out on then please do!
-
== Using Hijack
$ hijack 16451
@@ -104,12 +100,7 @@ Back in hijack you'll see your browsing activity:
2009/08/22 14:24:53 - 127.0.0.1 - /login
2009/08/22 14:24:54 - 127.0.0.1 - /signup
-Instead of pasting your code into hijack, you can pass hijack the -e option at startup to execute from a file:
-
- $ hijack -e examples/rails_dispatcher.rb 61565
- => Hijacked 61565 (/opt/local/bin/thin) (ruby 1.8.7 [i686-darwin9])
- => Executing examples/rails_dispatcher.rb... done!
- >> 2009/08/22 14:46:36 - 127.0.0.1 - /
+Instead of pasting your code into hijack, you can pass hijack the -e option execute a local file on the target process.
== Process Output
View
@@ -1,15 +1,15 @@
--- !ruby/object:Gem::Specification
name: hijack
version: !ruby/object:Gem::Version
- version: 0.1.7
+ version: 0.1.8
platform: ruby
authors:
- Ian Leitch
autorequire:
bindir: bin
cert_chain: []
-date: 2009-09-14 00:00:00 -04:00
+date: 2009-09-17 00:00:00 -04:00
default_executable:
dependencies: []
View
@@ -9,10 +9,6 @@ def initialize(pid)
wait
end
- def backtrace
- @backtrace ||= exec('bt').reverse
- end
-
def attached_to_ruby_process?
backtrace.any? {|line| line =~ /ruby_run/}
end
@@ -36,6 +32,10 @@ def detach
end
protected
+ def backtrace
+ @backtrace ||= exec('bt').reverse
+ end
+
def set_trap_pending
exec("set variable (int)rb_trap_pending=1")
end
@@ -57,7 +57,7 @@ def call(cmd)
end
def exec(str)
- puts("(gdb) #{str}") if @verbose
+ puts("(gdb) #{str}") if @verbose
@gdb.puts(str)
wait
end
View
@@ -4,11 +4,13 @@ def self.inject(pid)
gdb = GDB.new(pid)
unless gdb.attached_to_ruby_process?
puts "\n=> #{pid} doesn't appear to be a Ruby process!"
+ gdb.detach
exit 1
end
if gdb.main_thread_blocked_by_join?
puts "\n=> Unable to hijack #{pid} because the main thread is blocked waiting for another thread to join."
puts "=> Check that you are using the most recent version of hijack, a newer version may have solved this shortcoming."
+ gdb.detach
exit 1
end
gdb.eval(payload(pid))
View
@@ -1,7 +1,7 @@
require 'rake/gempackagetask'
require 'yaml'
-HIJACK_VERSION = '0.1.7'
+HIJACK_VERSION = '0.1.8'
task :clean => :clobber_package

0 comments on commit d8e3c99

Please sign in to comment.