Skip to content

Instantly share code, notes, and snippets.

/strlen.rb Secret

Created November 1, 2015 05:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3926a5a908983bab6dbc to your computer and use it in GitHub Desktop.
Save anonymous/3926a5a908983bab6dbc to your computer and use it in GitHub Desktop.
require 'fiddle'
include Fiddle
h = dlopen('/lib/libc.so.6').sym('strlen')
strlen = Function.new(h, [TYPE_VOIDP], TYPE_SIZE_T)
str = "testing fiddle out"
puts "length of string is #{strlen.call(str)}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment