mirror of
https://github.com/bettercap/bettercap
synced 2025-07-07 13:32:07 -07:00
new: added new log builtin function for sync logging with prompt
This commit is contained in:
parent
acbc10d4e8
commit
d87bf8a3ba
4 changed files with 16 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
function onLoad() {
|
||||
console.log( "BeefInject loaded." );
|
||||
console.log("targets: " + env['arp.spoof.targets']);
|
||||
log( "BeefInject loaded." );
|
||||
log("targets: " + env['arp.spoof.targets']);
|
||||
}
|
||||
|
||||
function onResponse(req, res) {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
var RESET = "\033[0m";
|
||||
var log = console.log;
|
||||
|
||||
function R(s) {
|
||||
return "\033[31m" + s + RESET;
|
||||
|
@ -119,7 +118,7 @@ function dumpRaw(req) {
|
|||
}
|
||||
|
||||
function onRequest(req, res) {
|
||||
log( BOLD(req.Client), ">", B(req.Method), req.Hostname + req.Path + ( req.Query ? "?" + req.Query : '') );
|
||||
log( BOLD(req.Client), " > ", B(req.Method), req.Hostname + req.Path + ( req.Query ? "?" + req.Query : '') );
|
||||
|
||||
dumpHeaders(req);
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
var AbuserJavascript = "";
|
||||
|
||||
function onLoad() {
|
||||
// console.log( "Loading abuser code from caplets/login-man-abuser.js" );
|
||||
// log( "Loading abuser code from caplets/login-man-abuser.js" );
|
||||
AbuserJavascript = readFile("caplets/login-man-abuser.js")
|
||||
}
|
||||
|
||||
// here we intercept the ajax POST request with leaked credentials.
|
||||
function onRequest(req, res) {
|
||||
if( req.Method == 'POST' && req.Path == "/login-man-abuser" ) {
|
||||
console.log( "[LOGIN MANAGER ABUSER]", req.ReadBody() );
|
||||
log( "[LOGIN MANAGER ABUSER]\n", req.ReadBody() );
|
||||
// this was just a fake request we needed to exfiltrate
|
||||
// credentials to us, drop the connection with an empty 200.
|
||||
res.Status = 200;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package modules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/evilsocket/bettercap-ng/log"
|
||||
|
@ -26,5 +27,15 @@ func (s *ProxyScript) defineBuiltins() error {
|
|||
return v
|
||||
})
|
||||
|
||||
s.VM.Set("log", func(call otto.FunctionCall) otto.Value {
|
||||
for _, v := range call.ArgumentList {
|
||||
fmt.Printf("%s", v.String())
|
||||
}
|
||||
fmt.Println()
|
||||
s.sess.Input.Refresh()
|
||||
|
||||
return otto.Value{}
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue