Path: blob/master/tools/bettercap/modules/rickroll.rb
527 views
=begin12BETTERCAP34Author : Simone 'evilsocket' Margaritelli5Email : [email protected]6Blog : http://www.evilsocket.net/78This project is released under the GPL 3 license.910=end11class RickRoll < BetterCap::Proxy::HTTP::Module12meta(13'Name' => 'RickRoll',14'Description' => 'Adds a "rickroll" video iframe on every webpage.',15'Version' => '1.0.0',16'Author' => "Simone 'evilsocket' Margaritelli",17'License' => 'GPL3'18)1920def on_request( request, response )21# is it a html page?22if response.content_type =~ /^text\/html.*/23BetterCap::Logger.info "Inserting video iframe on http://#{request.host}#{request.path}"24# make sure to use sub! or gsub! to update the instance25file = File.open(File.dirname(__FILE__) + '/tmp/yplay.txt', "r")26contents = file.read27response.body.sub!( '<head>',contents)28end29end30end313233