Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/sse-client.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
<div class="metadata">${highlight(`${src} → :${port}${path}`,kw)}</div>
<div class="details">
${detailHTML('JA3', m.ja3 || '—', kw)}
${detailHTML('JA3R', m.ja3Raw || '—', kw)}
${detailHTML('JA4', m.ja4 || '—', kw)}
${detailHTML('JA4H', m.ja4h || '—', kw)}
${detailHTML('HTTP2', m.http2 || '—', kw)}
Expand Down
10 changes: 10 additions & 0 deletions internal/fingerprint/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import (
"net/http"

fp "github.com/0x4D31/fingerproxy/pkg/fingerprint"
fpja3 "github.com/0x4D31/fingerproxy/pkg/ja3"
fpja4h "github.com/0x4D31/fingerproxy/pkg/ja4h"
"github.com/0x4D31/fingerproxy/pkg/metadata"
"github.com/dreadl0ck/tlsx"
)

// RequestCtx contains request metadata needed for rule evaluation.
type RequestCtx struct {
JA3 string
JA3Raw string
JA4 string
JA4H string
HTTP2 string
Expand Down Expand Up @@ -50,6 +53,12 @@ func New(r *http.Request) (RequestCtx, error) {
if err != nil {
return RequestCtx{}, err
}
ch := &tlsx.ClientHelloBasic{}
if err := ch.Unmarshal(md.ClientHelloRecord); err != nil {
return RequestCtx{}, err
}
ja3Raw := string(fpja3.Bare(ch))

ja4, err := fp.JA4Fingerprint(md)
if err != nil {
return RequestCtx{}, err
Expand All @@ -62,6 +71,7 @@ func New(r *http.Request) (RequestCtx, error) {
}

ctx.JA3 = ja3
ctx.JA3Raw = ja3Raw
ctx.JA4 = ja4
ctx.JA4H = ja4h
ctx.HTTP2 = http2fp
Expand Down
1 change: 1 addition & 0 deletions internal/logger/jsonl.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Event struct {
ProtocolVersion string `json:"protocolVersion"`
UserAgent string `json:"userAgent"`
JA3 string `json:"ja3"`
JA3Raw string `json:"ja3Raw"`
JA4 string `json:"ja4"`
JA4H string `json:"ja4h"`
HTTP2 string `json:"http2"`
Expand Down
3 changes: 3 additions & 0 deletions internal/proxy/echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type detailResponse struct {
type summaryResponse struct {
UserAgent string `json:"userAgent"`
JA3 string `json:"ja3"`
JA3Raw string `json:"ja3Raw"`
JA4 string `json:"ja4"`
JA4H string `json:"ja4h"`
HTTP2 string `json:"http2"`
Expand Down Expand Up @@ -156,6 +157,7 @@ func echoHandler(w http.ResponseWriter, r *http.Request) {
resp := summaryResponse{
UserAgent: r.UserAgent(),
JA3: ctx.JA3,
JA3Raw: ctx.JA3Raw,
JA4: ctx.JA4,
JA4H: ctx.JA4H,
HTTP2: ctx.HTTP2,
Expand All @@ -169,6 +171,7 @@ func echoHandler(w http.ResponseWriter, r *http.Request) {
resp := summaryResponse{
UserAgent: r.UserAgent(),
JA3: ctx.JA3,
JA3Raw: ctx.JA3Raw,
JA4: ctx.JA4,
JA4H: ctx.JA4H,
HTTP2: ctx.HTTP2,
Expand Down
2 changes: 2 additions & 0 deletions internal/proxy/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ func (h *ruleHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
ProtocolVersion: r.Proto,
UserAgent: r.UserAgent(),
JA3: reqCtx.JA3,
JA3Raw: reqCtx.JA3Raw,
JA4: reqCtx.JA4,
JA4H: reqCtx.JA4H,
HTTP2: reqCtx.HTTP2,
Expand Down Expand Up @@ -619,6 +620,7 @@ func (h *ruleHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
ProtocolVersion: ev.ProtocolVersion,
UserAgent: ev.UserAgent,
JA3: ev.JA3,
JA3Raw: ev.JA3Raw,
JA4: ev.JA4,
JA4H: ev.JA4H,
HTTP2: ev.HTTP2,
Expand Down