// called when script is loaded
function onLoad() {
console.log( "PROXY SCRIPT LOADED" );
}
// called before a request is proxied
function onRequest(req, res) {
if( req.Path == "/test-page" ){
res.Status = 200;
res.ContentType = "text/html";
res.Headers = "Server: bettercap\r\n" +
"Connection: close";
res.Body = "" +
"
" +
"Test Page" +
"" +
"" +
"Hello world from bettercap!
" +
"" +
"";
}
}
// called after a request is proxied and there's a response
function onResponse(req, res) {
if( res.Status == 404 ){
res.ContentType = "text/html";
res.Headers = "Server: bettercap\r\n" +
"Connection: close";
res.Body = "" +
"" +
"Test 404 Page" +
"" +
"" +
"Custom 404 from bettercap.
" +
"" +
"";
}
}