diff --git a/js/data.go b/js/data.go index d6975c3a..e2bfe5b0 100644 --- a/js/data.go +++ b/js/data.go @@ -4,6 +4,7 @@ import ( "bytes" "compress/gzip" "encoding/base64" + "github.com/robertkrimen/otto" ) @@ -13,6 +14,7 @@ func btoa(call otto.FunctionCall) otto.Value { if err != nil { return ReportError("Could not convert to string: %s", varValue) } + return v } @@ -21,10 +23,12 @@ func atob(call otto.FunctionCall) otto.Value { if err != nil { return ReportError("Could not decode string: %s", call.Argument(0).String()) } + v, err := otto.ToValue(string(varValue)) if err != nil { return ReportError("Could not convert to string: %s", varValue) } + return v } diff --git a/js/fs.go b/js/fs.go index fbe02ccf..52443ec6 100644 --- a/js/fs.go +++ b/js/fs.go @@ -67,4 +67,4 @@ func writeFile(call otto.FunctionCall) otto.Value { } return otto.NullValue() -} \ No newline at end of file +} diff --git a/js/http.go b/js/http.go index 1adbcc27..615928cb 100644 --- a/js/http.go +++ b/js/http.go @@ -3,12 +3,13 @@ package js import ( "bytes" "fmt" - "github.com/robertkrimen/otto" "io" "io/ioutil" "net/http" "net/url" "strings" + + "github.com/robertkrimen/otto" ) type httpPackage struct { @@ -26,7 +27,10 @@ func (c httpPackage) Encode(s string) string { return url.QueryEscape(s) } -func (c httpPackage) Request(method string, uri string, headers map[string]string, form map[string]string, json string) httpResponse { +func (c httpPackage) Request(method string, uri string, + headers map[string]string, + form map[string]string, + json string) httpResponse { var reader io.Reader if form != nil { diff --git a/js/init.go b/js/init.go index 1b49fee8..6415dd88 100644 --- a/js/init.go +++ b/js/init.go @@ -3,7 +3,6 @@ package js import ( "github.com/evilsocket/islazy/log" "github.com/evilsocket/islazy/plugin" - "github.com/robertkrimen/otto" ) diff --git a/packets/mdns.go b/packets/mdns.go index e3610a24..2de3a383 100644 --- a/packets/mdns.go +++ b/packets/mdns.go @@ -5,7 +5,6 @@ import ( "strings" "github.com/evilsocket/islazy/str" - "github.com/google/gopacket" "github.com/google/gopacket/layers" ) diff --git a/routing/update_darwin.go b/routing/update_darwin.go index e5f507d8..9417f7a5 100644 --- a/routing/update_darwin.go +++ b/routing/update_darwin.go @@ -1,10 +1,11 @@ package routing import ( - "github.com/bettercap/bettercap/core" - "github.com/evilsocket/islazy/str" "regexp" "strings" + + "github.com/bettercap/bettercap/core" + "github.com/evilsocket/islazy/str" ) var parser = regexp.MustCompile(`^([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+).*$`)