ja3

package
v0.0.0-...-b1b21d8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2023 License: LGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// HelloGolang will use default "crypto/tls" handshake marshaling codepath, which WILL
	// overwrite your changes to Hello(Config, Session are fine).
	// You might want to call BuildHandshakeState() before applying any changes.
	// UConn.Extensions will be completely ignored.
	HelloGolang = utls.HelloGolang

	// HelloCustom will prepare ClientHello with empty uconn.Extensions so you can fill it with
	// TLSExtensions manually or use ApplyPreset function
	HelloCustom = utls.HelloCustom

	// HelloRandomized* randomly adds/reorders extensions, ciphersuites, etc.
	HelloRandomized       = utls.HelloRandomized
	HelloRandomizedALPN   = utls.HelloRandomizedALPN
	HelloRandomizedNoALPN = utls.HelloRandomizedNoALPN

	// The rest will will parrot given browser.
	HelloFirefox_Auto = utls.HelloFirefox_Auto
	HelloFirefox_55   = utls.HelloFirefox_55
	HelloFirefox_56   = utls.HelloFirefox_56
	HelloFirefox_63   = utls.HelloFirefox_63
	HelloFirefox_65   = utls.HelloFirefox_65
	HelloFirefox_99   = utls.HelloFirefox_99
	HelloFirefox_102  = utls.HelloFirefox_102
	HelloFirefox_105  = utls.HelloFirefox_105

	HelloChrome_Auto        = utls.HelloChrome_Auto
	HelloChrome_58          = utls.HelloChrome_58
	HelloChrome_62          = utls.HelloChrome_62
	HelloChrome_70          = utls.HelloChrome_70
	HelloChrome_72          = utls.HelloChrome_72
	HelloChrome_83          = utls.HelloChrome_83
	HelloChrome_87          = utls.HelloChrome_87
	HelloChrome_96          = utls.HelloChrome_96
	HelloChrome_100         = utls.HelloChrome_100
	HelloChrome_102         = utls.HelloChrome_102
	HelloChrome_106_Shuffle = utls.HelloChrome_106_Shuffle

	// Chrome w/ PSK: Chrome start sending this ClientHello after doing TLS 1.3 handshake with the same server.
	// Beta: PSK extension added. However, uTLS doesn't ship with full PSK support.
	// Use at your own discretion.
	HelloChrome_100_PSK              = utls.HelloChrome_100_PSK
	HelloChrome_112_PSK_Shuf         = utls.HelloChrome_112_PSK_Shuf
	HelloChrome_114_Padding_PSK_Shuf = utls.HelloChrome_114_Padding_PSK_Shuf

	// Chrome w/ Post-Quantum Key Agreement
	// Beta: PQ extension added. However, uTLS doesn't ship with full PQ support. Use at your own discretion.
	HelloChrome_115_PQ     = utls.HelloChrome_115_PQ
	HelloChrome_115_PQ_PSK = utls.HelloChrome_115_PQ_PSK

	HelloIOS_Auto = utls.HelloIOS_Auto
	HelloIOS_11_1 = utls.HelloIOS_11_1
	HelloIOS_12_1 = utls.HelloIOS_12_1
	HelloIOS_13   = utls.HelloIOS_13
	HelloIOS_14   = utls.HelloIOS_14

	HelloAndroid_11_OkHttp = utls.HelloAndroid_11_OkHttp

	HelloEdge_Auto = utls.HelloEdge_Auto
	HelloEdge_85   = utls.HelloEdge_85
	HelloEdge_106  = utls.HelloEdge_106

	HelloSafari_Auto = utls.HelloSafari_Auto
	HelloSafari_16_0 = utls.HelloSafari_16_0

	Hello360_Auto = utls.Hello360_Auto
	Hello360_7_5  = utls.Hello360_7_5
	Hello360_11_0 = utls.Hello360_11_0

	HelloQQ_Auto = utls.HelloQQ_Auto
	HelloQQ_11_1 = utls.HelloQQ_11_1
)

Functions

func AddPsk

func AddPsk(obj *Ja3Spec)

func ConnContext

func ConnContext(ctx context.Context, c net.Conn) context.Context

func DelPsk

func DelPsk(obj *Ja3Spec)

func GetConfigForClient

func GetConfigForClient(chi *tls.ClientHelloInfo) (*tls.Config, error)

func NewClient

func NewClient(ctx context.Context, conn net.Conn, ja3Spec Ja3Spec, disHttp2 bool, utlsConfig *utls.Config) (utlsConn *utls.UConn, err error)

func Pipe

func Pipe(preCtx context.Context) (net.Conn, net.Conn)

func ShuffleExtensions

func ShuffleExtensions(chs *Ja3Spec)

func Utls2Tls

func Utls2Tls(preCtx, ctx context.Context, utlsConn *utls.UConn, host string) (*tls.Conn, error)

func VerifyWithMd5

func VerifyWithMd5(md string) (string, bool)

Types

type Addr

type Addr struct{}

func (Addr) Network

func (obj Addr) Network() string

func (Addr) String

func (obj Addr) String() string

type ClientHello

type ClientHello struct {
	ServerName        string
	SupportedProtos   []string      //列出客户端支持的应用协议。[h2 http/1.1]
	SupportedPoints   []uint8       //列出了客户端支持的点格式[0]
	SupportedCurves   []tls.CurveID //列出了客户端支持的椭圆曲线。 [CurveID(2570) X25519 CurveP256 CurveP384]
	SupportedVersions []uint16      //列出了客户端支持的TLS版本。[2570 772 771]

	CipherSuites     []uint16              //客户端支持的密码套件 [14906 4865 4866 4867 49195 49199 49196 49200 52393 52392 49171 49172 156 157 47 53]
	SignatureSchemes []tls.SignatureScheme //列出了客户端愿意验证的签名和散列方案[ECDSAWithP256AndSHA256 PSSWithSHA256 PKCS1WithSHA256 ECDSAWithP384AndSHA384 PSSWithSHA384 PKCS1WithSHA384 PSSWithSHA512 PKCS1WithSHA512]
}

type ClientHelloId

type ClientHelloId = utls.ClientHelloID

type ClientSessionCache

type ClientSessionCache struct {
	// contains filtered or unexported fields
}

func NewClientSessionCache

func NewClientSessionCache() *ClientSessionCache

func (*ClientSessionCache) Get

func (obj *ClientSessionCache) Get(sessionKey string) (session *utls.ClientSessionState, ok bool)

func (*ClientSessionCache) Put

func (obj *ClientSessionCache) Put(sessionKey string, cs *utls.ClientSessionState)

func (*ClientSessionCache) Session

func (obj *ClientSessionCache) Session() *utls.ClientSessionState

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

func (*Conn) Close

func (obj *Conn) Close() error

func (*Conn) LocalAddr

func (obj *Conn) LocalAddr() net.Addr

func (*Conn) Read

func (obj *Conn) Read(b []byte) (n int, err error)

func (*Conn) RemoteAddr

func (obj *Conn) RemoteAddr() net.Addr

func (*Conn) SetDeadline

func (obj *Conn) SetDeadline(t time.Time) error

func (*Conn) SetReadDeadline

func (obj *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetWriteDeadline

func (obj *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) Write

func (obj *Conn) Write(b []byte) (n int, err error)

type H2Ja3Spec

type H2Ja3Spec struct {
	InitialSetting []Setting
	ConnFlow       uint32   //WINDOW_UPDATE:15663105
	OrderHeaders   []string //伪标头顺序,例如:[]string{":method",":authority",":scheme",":path"}
	Priority       Priority
}

func DefaultH2Ja3Spec

func DefaultH2Ja3Spec() H2Ja3Spec

func (H2Ja3Spec) IsSet

func (obj H2Ja3Spec) IsSet() bool

是否设置了

type Ja3ContextData

type Ja3ContextData struct {
	ClientHello ClientHello `json:"clientHello"`
	Init        bool        `json:"init"`
}

func GetRequestJa3Data

func GetRequestJa3Data(r *http.Request) *Ja3ContextData

func (Ja3ContextData) Md5

func (obj Ja3ContextData) Md5() string

func (Ja3ContextData) Verify

func (obj Ja3ContextData) Verify() (string, bool)

type Ja3Spec

type Ja3Spec utls.ClientHelloSpec

func CreateSpecWithId

func CreateSpecWithId(ja3Id ClientHelloId) (clientHelloSpec Ja3Spec, err error)

ja3 clientHelloId 生成 clientHello

func CreateSpecWithStr

func CreateSpecWithStr(ja3Str string) (clientHelloSpec Ja3Spec, err error)

ja3 字符串中生成 clientHello

func DefaultJa3Spec

func DefaultJa3Spec() Ja3Spec

func (Ja3Spec) HasPsk

func (obj Ja3Spec) HasPsk() bool

func (Ja3Spec) IsSet

func (obj Ja3Spec) IsSet() bool

type OneSessionCache

type OneSessionCache struct {
	// contains filtered or unexported fields
}

func NewOneSessionCache

func NewOneSessionCache(session *utls.ClientSessionState) *OneSessionCache

func (*OneSessionCache) Get

func (obj *OneSessionCache) Get(sessionKey string) (*utls.ClientSessionState, bool)

func (*OneSessionCache) Put

func (obj *OneSessionCache) Put(sessionKey string, cs *utls.ClientSessionState)

func (*OneSessionCache) Session

func (obj *OneSessionCache) Session() *utls.ClientSessionState

type Priority

type Priority struct {
	// StreamDep is a 31-bit stream identifier for the
	// stream that this stream depends on. Zero means no
	// dependency.
	StreamDep uint32

	// Exclusive is whether the dependency is exclusive.
	Exclusive bool

	// Weight is the stream's zero-indexed weight. It should be
	// set together with StreamDep, or neither should be set. Per
	// the spec, "Add one to the value to obtain a weight between
	// 1 and 256."
	Weight uint8
}

func (Priority) IsSet

func (obj Priority) IsSet() bool

type Setting

type Setting struct {
	// ID is which setting is being set.
	// See https://httpwg.org/specs/rfc7540.html#SettingFormat
	Id uint16
	// Val is the value.
	Val uint32
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL