mirror of
https://github.com/bettercap/bettercap
synced 2025-07-29 19:20:00 -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/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/bettercap/bettercap/modules/net_sniff"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/bettercap/bettercap/modules/net_sniff"
|
||||||
"github.com/bettercap/bettercap/session"
|
"github.com/bettercap/bettercap/session"
|
||||||
|
|
||||||
"github.com/evilsocket/islazy/tui"
|
"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 {
|
func httpParser(ip *layers.IPv4, pkt gopacket.Packet, tcp *layers.TCP) bool {
|
||||||
data := tcp.Payload
|
data := tcp.Payload
|
||||||
if req, err := http.ReadRequest(bufio.NewReader(bytes.NewReader(data))); err == nil {
|
if req, err := http.ReadRequest(bufio.NewReader(bytes.NewReader(data))); err == nil {
|
||||||
NewSnifferEvent(
|
if user, pass, ok := req.BasicAuth(); ok {
|
||||||
pkt.Metadata().Timestamp,
|
NewSnifferEvent(
|
||||||
"http.request",
|
pkt.Metadata().Timestamp,
|
||||||
ip.SrcIP.String(),
|
"http.request",
|
||||||
req.Host,
|
ip.SrcIP.String(),
|
||||||
toSerializableRequest(req),
|
req.Host,
|
||||||
"%s %s %s %s%s",
|
toSerializableRequest(req),
|
||||||
tui.Wrap(tui.BACKRED+tui.FOREBLACK, "http"),
|
"%s %s %s %s%s - %s %s, %s %s",
|
||||||
vIP(ip.SrcIP),
|
tui.Wrap(tui.BACKRED+tui.FOREBLACK, "http"),
|
||||||
tui.Wrap(tui.BACKLIGHTBLUE+tui.FOREBLACK, req.Method),
|
vIP(ip.SrcIP),
|
||||||
tui.Yellow(req.Host),
|
tui.Wrap(tui.BACKLIGHTBLUE+tui.FOREBLACK, req.Method),
|
||||||
vURL(req.URL.String()),
|
tui.Yellow(req.Host),
|
||||||
).Push()
|
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
|
return true
|
||||||
} else if res, err := http.ReadResponse(bufio.NewReader(bytes.NewReader(data)), nil); err == nil {
|
} 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