fix: added hostname in http.server logs

This commit is contained in:
evilsocket 2018-01-12 23:43:15 +01:00
commit b5e7b254e4

View file

@ -4,6 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"net/http" "net/http"
"strings"
"time" "time"
"github.com/evilsocket/bettercap-ng/core" "github.com/evilsocket/bettercap-ng/core"
@ -65,7 +66,7 @@ func (httpd *HttpServer) Author() string {
func wrapHandler(h http.Handler) http.Handler { func wrapHandler(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
log.Info("(%s) %s %s %s", core.Green("httpd"), core.Bold(r.RemoteAddr), r.Method, r.URL.Path) log.Info("(%s) %s %s %s%s", core.Green("httpd"), core.Bold(strings.Split(r.RemoteAddr, ":")[0]), r.Method, r.Host, r.URL.Path)
h.ServeHTTP(w, r) h.ServeHTTP(w, r)
}) })
} }