Debian Codegraph @

modules/net_sniff/net_sniff_ntlm.go

raw symbols SCIP
1 package net_sniffscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/
2
3 import (
4 "netscip-go gomod github.com/golang/go/src go1.16 net/"
5 "regexpscip-go gomod github.com/golang/go/src go1.16 regexp/"
6 "stringsscip-go gomod github.com/golang/go/src go1.16 strings/"
7
8 "github.com/bettercap/bettercap/packetsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/"
9
10 "github.com/google/gopacketscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket`/"
11 "github.com/google/gopacket/layersscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/"
12
13 "github.com/evilsocket/islazy/tuiscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/"
14 )
15
16 var (
17 ntlmRescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/ntlmRe. = regexpscip-go gomod github.com/golang/go/src go1.16 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.16 regexp/MustCompile().("(WWW-|Proxy-|)(Authenticate|Authorization): (NTLM|Negotiate)")
18 challRescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/challRe. = regexpscip-go gomod github.com/golang/go/src go1.16 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.16 regexp/MustCompile().("(WWW-|Proxy-|)(Authenticate): (NTLM|Negotiate)")
19 respRescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/respRe. = regexpscip-go gomod github.com/golang/go/src go1.16 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.16 regexp/MustCompile().("(WWW-|Proxy-|)(Authorization): (NTLM|Negotiate)")
20 ntlmscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/ntlm. = packetsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/.NewNTLMStatescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/NewNTLMState().()
21 )
22
23 func isNtlmscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/isNtlm().(s string) bool {
24 return ntlmRescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/ntlmRe..FindStringscip-go gomod github.com/golang/go/src go1.16 regexp/Regexp#FindString().(s) != ""
25 }
26
27 func isChallengescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/isChallenge().(s string) bool {
28 return challRescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/challRe..FindStringscip-go gomod github.com/golang/go/src go1.16 regexp/Regexp#FindString().(s) != ""
29 }
30
31 func isResponsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/isResponse().(s string) bool {
32 return respRescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/respRe..FindStringscip-go gomod github.com/golang/go/src go1.16 regexp/Regexp#FindString().(s) != ""
33 }
34
35 func ntlmParserscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/ntlmParser().(srcIP, dstIP netscip-go gomod github.com/golang/go/src go1.16 net/.IPscip-go gomod github.com/golang/go/src go1.16 net/IP#, payload []byte, pkt gopacketscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket`/.Packetscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket`/Packet#, tcp *layersscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/.TCPscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/TCP#) bool {
36 data := tcp.Payloadscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/BaseLayer#Payload.
37 ok := false
38
39 for _, line := range stringsscip-go gomod github.com/golang/go/src go1.16 strings/.Splitscip-go gomod github.com/golang/go/src go1.16 strings/Split().(string(data), "\r\n") {
40 if isNtlmscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/isNtlm().(line) {
41 tokens := stringsscip-go gomod github.com/golang/go/src go1.16 strings/.Splitscip-go gomod github.com/golang/go/src go1.16 strings/Split().(line, " ")
42 if len(tokens) != 3 {
43 continue
44 }
45 if isChallengescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/isChallenge().(line) {
46 ok = true
47 ntlmscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/ntlm..AddServerResponsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/NTLMState#AddServerResponse().(tcp.Ackscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/TCP#Ack., tokens[2])
48 } else if isResponsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/isResponse().(line) {
49 ok = true
50 ntlmscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/ntlm..AddClientResponsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/NTLMState#AddClientResponse().(tcp.Seqscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/TCP#Seq., tokens[2], func(data packetsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/.NTLMChallengeResponseParsedscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/NTLMChallengeResponseParsed#) {
51 NewSnifferEventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/NewSnifferEvent().(
52 pkt.Metadatascip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket`/Packet#Metadata().().Timestampscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket`/CaptureInfo#Timestamp.,
53 "ntlm.response",
54 srcIP.Stringscip-go gomod github.com/golang/go/src go1.16 net/IP#String().(),
55 dstIP.Stringscip-go gomod github.com/golang/go/src go1.16 net/IP#String().(),
56 nil,
57 "%s %s > %s | %s",
58 tuiscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/.Wrapscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/Wrap().(tuiscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/.BACKDARKGRAYscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/BACKDARKGRAY.+tuiscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/.FOREWHITEscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/FOREWHITE., "ntlm.response"),
59 vIPscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/vIP().(srcIP),
60 vIPscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/vIP().(dstIP),
61 data.LcStringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/NTLMChallengeResponseParsed#LcString().(),
62 ).Pushscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferEvent#Push().()
63 })
64 }
65 }
66 }
67 return ok
68 }