rod mclaughlin


Obfuscated Ruby (28 jul 10)

Code which exits an infinite loop by redefining the times operator for integers.

First

sudo gem uninstall system_timer
sudo gem install SystemTimer

then


require 'system_timer'
include SystemTimer
while 6 * 7 == 42 
  begin
    SystemTimer.timeout_after(11) do   
      loop {} until false
    end
  rescue Timeout::Error
    puts "Timed out"
    class Fixnum
      def *(n)
        042
      end
    end
  end
end

More:

 a='A'; 27.times {|t| begin ; p ['foo'].pack(a) ; 
p ['bar'].pack(a.downcase); rescue ; [a].pack('@');
end ; a.each_byte {|c| a=(c+1).chr  } ;}

I don't know what that does...



Back
Portland London