mirror of
https://github.com/bettercap/bettercap
synced 2025-07-16 10:03:39 -07:00
View HTTP Basic authorization credentials when sniffing
Undid changes in events_view_http.go Undid more changed to events_view_http.go Undid more changed to events_view_http.go Vew HTTP Basic authnoriyation credentials when sniffing Undid changes in events_view_http.go View HTTP Basic authorization credentials when sniffing Undid changes in events_view_http.go Undid more changed to events_view_http.go Undid more changed to events_view_http.go Vew HTTP Basic authnoriyation credentials when sniffing Undid changes in events_view_http.go Undid more changes
This commit is contained in:
parent
e51e097e43
commit
a88c9078b3
2 changed files with 34 additions and 14 deletions
|
@ -6,11 +6,11 @@ import (
|
|||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/bettercap/bettercap/modules/net_sniff"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/bettercap/bettercap/modules/net_sniff"
|
||||
"github.com/bettercap/bettercap/session"
|
||||
|
||||
"github.com/evilsocket/islazy/tui"
|
||||
|
|
|
@ -119,19 +119,39 @@ func toSerializableResponse(res *http.Response) HTTPResponse {
|
|||
func httpParser(ip *layers.IPv4, pkt gopacket.Packet, tcp *layers.TCP) bool {
|
||||
data := tcp.Payload
|
||||
if req, err := http.ReadRequest(bufio.NewReader(bytes.NewReader(data))); err == nil {
|
||||
NewSnifferEvent(
|
||||
pkt.Metadata().Timestamp,
|
||||
"http.request",
|
||||
ip.SrcIP.String(),
|
||||
req.Host,
|
||||
toSerializableRequest(req),
|
||||
"%s %s %s %s%s",
|
||||
tui.Wrap(tui.BACKRED+tui.FOREBLACK, "http"),
|
||||
vIP(ip.SrcIP),
|
||||
tui.Wrap(tui.BACKLIGHTBLUE+tui.FOREBLACK, req.Method),
|
||||
tui.Yellow(req.Host),
|
||||
vURL(req.URL.String()),
|
||||
).Push()
|
||||
if user, pass, ok := req.BasicAuth(); ok {
|
||||
NewSnifferEvent(
|
||||
pkt.Metadata().Timestamp,
|
||||
"http.request",
|
||||
ip.SrcIP.String(),
|
||||
req.Host,
|
||||
toSerializableRequest(req),
|
||||
"%s %s %s %s%s - %s %s, %s %s",
|
||||
tui.Wrap(tui.BACKRED+tui.FOREBLACK, "http"),
|
||||
vIP(ip.SrcIP),
|
||||
tui.Wrap(tui.BACKLIGHTBLUE+tui.FOREBLACK, req.Method),
|
||||
tui.Yellow(req.Host),
|
||||
vURL(req.URL.String()),
|
||||
tui.Bold("USER"),
|
||||
tui.Red(user),
|
||||
tui.Bold("PASS"),
|
||||
tui.Red(pass),
|
||||
).Push()
|
||||
} else {
|
||||
NewSnifferEvent(
|
||||
pkt.Metadata().Timestamp,
|
||||
"http.request",
|
||||
ip.SrcIP.String(),
|
||||
req.Host,
|
||||
toSerializableRequest(req),
|
||||
"%s %s %s %s%s",
|
||||
tui.Wrap(tui.BACKRED+tui.FOREBLACK, "http"),
|
||||
vIP(ip.SrcIP),
|
||||
tui.Wrap(tui.BACKLIGHTBLUE+tui.FOREBLACK, req.Method),
|
||||
tui.Yellow(req.Host),
|
||||
vURL(req.URL.String()),
|
||||
).Push()
|
||||
}
|
||||
|
||||
return true
|
||||
} else if res, err := http.ReadResponse(bufio.NewReader(bytes.NewReader(data)), nil); err == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue