Documentation
¶
Index ¶
- Variables
- func CalculateJa4(tls *TLSDetails) string
- func CalculateJa4QUIC(tls *TLSDetails) string
- func CalculateJa4QUIC_r(tls *TLSDetails) string
- func CalculateJa4_r(tls *TLSDetails) string
- func CalculatePeetPrint(parsed ClientHello, j JA3Calculating) (string, string)
- func GetAkamaiFingerprint(frames []ParsedFrame) string
- func GetAllFlags(frame http2.Frame) []string
- func GetCipherSuiteName(cipher uint16) string
- func GetCurveNameByID(id uint16) string
- func GetExtensionNameByID(id uint16) string
- func GetHTTP1HeaderOrderFingerprint(headers []string) string
- func GetHTTP3FingerprintHash(fingerprint string) string
- func GetHTTP3HeaderOrder(headers []string) string
- func GetHTTP3SettingName(id uint64) string
- func GetHTTP3SettingsFingerprint(settings []Http3SettingPair, headerOrder string) string
- func GetMD5Hash(text string) string
- func GetSignatureNameByID(id uint16) string
- func IsGrease(cipher string) bool
- func PrettyPrintClientHello(ch ClientHello)
- func ReadFile(filename string) ([]byte, error)
- func SHA256trunc(in string) string
- func SniffTCP(device string, tlsPort int, fingerprints *sync.Map, stop <-chan struct{}) error
- func SortByVal(m map[string]int, x int) map[string]int
- func SplitBytesIntoChunks(buf []byte, lim int) [][]byte
- func ToHexAll(in []string, filterOut bool, shouldSort bool) []string
- func WriteToFile(filename string, data []byte) error
- type ClientHello
- type Extension
- type GoAway
- type Http1Details
- type Http2Details
- type Http3Details
- type Http3SettingPair
- type Http3Settings
- type IPDetails
- type JA3Calculating
- type ParsedFrame
- type Priority
- type Request
- type SmallResponse
- type TCPDetails
- type TCPIPDetails
- type TLSDetails
Constants ¶
This section is empty.
Variables ¶
var GreaseValues = []string{
"0x0A0A",
"0x1A1A",
"0x2A2A",
"0x3A3A",
"0x4A4A",
"0x5A5A",
"0x6A6A",
"0x7A7A",
"0x8A8A",
"0x9A9A",
"0xAAAA",
"0xBABA",
"0xCACA",
"0xDADA",
"0xEAEA",
"0xFAFA",
}
Functions ¶
func CalculateJa4 ¶
func CalculateJa4(tls *TLSDetails) string
func CalculateJa4QUIC ¶
func CalculateJa4QUIC(tls *TLSDetails) string
CalculateJa4QUIC calculates JA4 fingerprint for Quic/HTTP3 connections
func CalculateJa4QUIC_r ¶
func CalculateJa4QUIC_r(tls *TLSDetails) string
CalculateJa4QUIC_r calculates JA4_r fingerprint for Quic/HTTP3 connections
func CalculateJa4_r ¶
func CalculateJa4_r(tls *TLSDetails) string
func CalculatePeetPrint ¶
func CalculatePeetPrint(parsed ClientHello, j JA3Calculating) (string, string)
func GetAkamaiFingerprint ¶
func GetAkamaiFingerprint(frames []ParsedFrame) string
func GetAllFlags ¶
func GetCipherSuiteName ¶
func GetCurveNameByID ¶
func GetExtensionNameByID ¶
func GetHTTP1HeaderOrderFingerprint ¶
GetHTTP1HeaderOrderFingerprint returns a pipe-separated, lowercased list of header names in the exact order they were sent by the client, e.g. "host|user-agent|accept|accept-language|accept-encoding|connection". Header names are a strong signal for HTTP/1 client fingerprinting because different clients emit them in different orders.
func GetHTTP3FingerprintHash ¶
GetHTTP3FingerprintHash returns MD5 hash of the fingerprint
func GetHTTP3HeaderOrder ¶
GetHTTP3HeaderOrder extracts pseudo-header order from headers Headers are in format "key: value" Returns format like "m,a,s,p" for :method, :authority, :scheme, :path
func GetHTTP3SettingName ¶
GetHTTP3SettingName returns the name for a known HTTP/3 setting ID
func GetHTTP3SettingsFingerprint ¶
func GetHTTP3SettingsFingerprint(settings []Http3SettingPair, headerOrder string) string
GetHTTP3SettingsFingerprint generates a fingerprint string from HTTP/3 settings Format: "id:value;id:value;...|header_order"
func GetMD5Hash ¶
func GetSignatureNameByID ¶
func SHA256trunc ¶
func SniffTCP ¶
SniffTCP passively captures TCP packets destined for tlsPort on the given network device and stores their IP/TCP fingerprints in fingerprints, keyed by "sourceIP:sourcePort".
The capture loop runs until the device handle fails or stop is closed (the handle is then closed, unblocking the read loop). OpenLive errors are returned to the caller.
func SplitBytesIntoChunks ¶
func WriteToFile ¶
Types ¶
type ClientHello ¶
type ClientHello struct {
Length int
Version int // TLS version, always 1.2 because of middleboxes
ClientRandom string
SessionID string
CipherSuites []uint16
CompressionMethods string
AllExtensions []int
Extensions []interface{}
SupportedProtos []string
SupportedPoints []uint8
SupportedVersions []uint8
SupportedCurves []uint16
// For the PeetPrint
SupportedTLSVersions []int
SupportedProtocols []string
SignatureAlgorithms []int
PSKKeyExchangeMode int
CertCompressionAlgorithms []int
}
func ParseClientHello ¶
func ParseClientHello(ch string) ClientHello
Gets the ClientHello as hex bytes
type Http1Details ¶
type Http2Details ¶
type Http2Details struct {
AkamaiFingerprint string `json:"akamai_fingerprint"`
AkamaiFingerprintHash string `json:"akamai_fingerprint_hash"`
Settings []string `json:"settings,omitempty"`
SendFrames []ParsedFrame `json:"sent_frames"`
}
type Http3Details ¶
type Http3Details struct {
Used0RTT bool `json:"used_0rtt"`
SupportsDatagrams bool `json:"supports_datagrams"`
SupportsStreamResetPartialDelivery bool `json:"supports_stream_reset_partial_delivery"`
Version uint32 `json:"version"`
GSO bool `json:"gso"`
Settings []Http3SettingPair `json:"settings"`
AkamaiFingerprint string `json:"akamai_fingerprint"`
AkamaiFingerprintHash string `json:"akamai_fingerprint_hash"`
Headers []string `json:"headers,omitempty"`
}
type Http3SettingPair ¶
type Http3SettingPair struct {
ID uint64 `json:"id"`
Name string `json:"name"`
Value uint64 `json:"value"`
}
Http3SettingPair represents a single HTTP/3 setting for fingerprinting
type Http3Settings ¶
type Http3Settings struct {
EnableDatagrams bool `json:"enable_datagrams"`
EnableExtendedConnect bool `json:"enable_extended_connect"`
Other map[uint64]uint64 `json:"other,omitempty"`
RawSettings []Http3SettingPair `json:"settings,omitempty"`
}
type IPDetails ¶
type IPDetails struct {
DF int `json:"df,omitempty"`
HDRLength int `json:"hdr_length,omitempty"`
ID int `json:"id,omitempty"`
MF int `json:"mf,omitempty"`
NXT int `json:"nxt,omitempty"`
OFF int `json:"off,omitempty"`
PLEN int `json:"plen,omitempty"`
Protocol int `json:"protocol,omitempty"`
RF int `json:"rf,omitempty"`
TOS int `json:"tos,omitempty"`
TotalLength int `json:"total_length,omitempty"`
TTL int `json:"ttl,omitempty"`
IPVersion int `json:"ip_version,omitempty"`
DstIp string `json:"dst_ip,omitempty"`
SrcIP string `json:"src_ip,omitempty"`
}
IPDetails holds IPv4/IPv6 header fields extracted from captured TCP packets.
type JA3Calculating ¶
type JA3Calculating struct {
AllCiphers []uint16 `json:"-"`
JA3Ciphers []string `json:"-"`
ReadableCiphers []string `json:"ciphers"`
AllCurves []uint16 `json:"-"`
JA3Curves []string `json:"-"`
AllExtensions []int `json:"-"`
JA3Extensions []string `json:"-"`
AllPoints []uint8 `json:"-"`
JA3Points []string `json:"-"`
Version string
ReadableProtocols []string
ReadableVersions []string
JA3 string
JA3Hash string
// PeetPrint
PeetPrintCiphers []string
PeetPrintExtensions []string
PeetPrintCurves []string
}
func CalculateJA3 ¶
func CalculateJA3(parsed ClientHello) JA3Calculating
func (*JA3Calculating) Calculate ¶
func (j *JA3Calculating) Calculate()
func (*JA3Calculating) Parse ¶
func (j *JA3Calculating) Parse()
type ParsedFrame ¶
type ParsedFrame struct {
Type string `json:"frame_type,omitempty"`
Stream uint32 `json:"stream_id,omitempty"`
Length uint32 `json:"length,omitempty"`
Payload []byte `json:"payload,omitempty"`
Headers []string `json:"headers,omitempty"`
Settings []string `json:"settings,omitempty"`
Increment uint32 `json:"increment,omitempty"`
Flags []string `json:"flags,omitempty"`
Priority *Priority `json:"priority,omitempty"`
GoAway *GoAway `json:"goaway,omitempty"`
}
type Request ¶
type Request struct {
Conn net.Conn `json:"-"`
ObservedAt time.Time `json:"observed_at"`
Donate string `json:"donate"`
IP string `json:"ip"`
HTTPVersion string `json:"http_version"`
Path string `json:"path"`
Method string `json:"method"`
UserAgent string `json:"user_agent,omitempty"`
TLS *TLSDetails `json:"tls"`
TCPIP *TCPIPDetails `json:"tcpip,omitempty"`
Http1 *Http1Details `json:"http1,omitempty"`
Http2 *Http2Details `json:"http2,omitempty"`
Http3 *Http3Details `json:"http3,omitempty"`
}
type SmallResponse ¶
type SmallResponse struct {
JA3 string `json:"ja3"`
JA3Hash string `json:"ja3_hash"`
JA4 string `json:"ja4"`
JA4_r string `json:"ja4_r"`
Akamai string `json:"akamai"`
AkamaiHash string `json:"akamai_hash"`
PeetPrint string `json:"peetprint"`
PeetPrintHash string `json:"peetprint_hash"`
HTTPVersion string `json:"http_version"`
}
func (SmallResponse) ToJson ¶
func (res SmallResponse) ToJson() string
type TCPDetails ¶
type TCPDetails struct {
Ack int `json:"ack,omitempty"`
Checksum int `json:"checksum,omitempty"`
Flags int `json:"flags,omitempty"`
HeaderLength int `json:"header_length,omitempty"`
MSS int `json:"mss,omitempty"`
OFF int `json:"off,omitempty"`
Options string `json:"options,omitempty"`
OptionsOrder string `json:"options_order,omitempty"`
Seq int `json:"seq,omitempty"`
Timestamp int `json:"timestamp,omitempty"`
TimestampEchoReply int `json:"timestamp_echo_reply,omitempty"`
URP int `json:"urp,omitempty"`
Window int `json:"window,omitempty"`
}
TCPDetails holds TCP header fields extracted from captured TCP packets.
type TCPIPDetails ¶
type TCPIPDetails struct {
CapLen int `json:"cap_length,omitempty"`
DstPort int `json:"dst_port,omitempty"`
SrcPort int `json:"src_port,omitempty"`
HeaderLen int `json:"header_length,omitempty"`
TS []int `json:"ts,omitempty"`
IP IPDetails `json:"ip,omitempty"`
TCP TCPDetails `json:"tcp,omitempty"`
}
TCPIPDetails bundles the IP and TCP fingerprints of a captured packet.
type TLSDetails ¶
type TLSDetails struct {
Ciphers []string `json:"ciphers"`
Extensions []interface{} `json:"extensions"`
RecordVersion string `json:"tls_version_record"`
NegotiatedVersion string `json:"tls_version_negotiated"`
ServerName string `json:"server_name,omitempty"`
NegotiatedCipher string `json:"negotiated_cipher,omitempty"`
JA3 string `json:"ja3"`
JA3Hash string `json:"ja3_hash"`
JA4 string `json:"ja4"`
JA4_r string `json:"ja4_r"`
PeetPrint string `json:"peetprint"`
PeetPrintHash string `json:"peetprint_hash"`
ClientRandom string `json:"client_random"`
SessionID string `json:"session_id"`
RawBytes string `json:"-"`
RawB64 string `json:"-"`
}