1.1.0 • Published 2 years ago

ruby-trace v1.1.0

Weekly downloads
-
License
BSD-2-Clause/Ruby
Repository
-
Last release
2 years ago

ruby-trace

ruby-trace is a frida-based tracer for (c)ruby. It currently supports ruby 2.6-3.1.

Install

$ sudo npm install -g ruby-trace

Note: --unsafe-perm may be needed when installing as root with older versions of npm due to how the frida depdendency builds during install.

Building from Source

$ git clone https://github.com/nccgroup/ruby-trace
$ cd ruby-trace
$ npm install
$ npm run compile-agent
$ sudo npm install -g

Usage

ruby-trace uses Ruby's tracing infrastructure to enable/disable its own tracing. If you want to trace against an entire program, you can do something like the following:

$ ruby-trace -- ruby -e 'TracePoint.new(:call) { |tp| }.enable' -e "$(cat test/misc/readme.rb)"

Alternatively, for more fine-grained tracing, you would write something like the following:

def ruby_trace
  t = TracePoint.new(:call) { |tp| }
  t.enable
  yield
ensure
  t.disable
end

...

ruby_trace {
  ...
}

...
$ ruby-trace -- ruby /path/to/file.rb

License

ruby-trace is licensed under the 2-clause BSD License and the Ruby License.