Created
March 21, 2015 22:30
-
-
Save NigoroJr/915d11cceb603d58623c to your computer and use it in GitHub Desktop.
Ruby script that uses NoMethodError and Object#send to get to an existing method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class Class | |
def foo | |
puts "FOO!!" | |
return false | |
end | |
end | |
str = "foa" | |
c = Class.new | |
flag = true | |
while flag | |
begin | |
flag = c.send str | |
rescue | |
puts "nope" | |
str.next! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment