Crate ja3_rustls

Source
Expand description

JA3 with Rustls types

§Example

Extract JA3 TLS fingerprint from a slice of bytes:

use ja3_rustls::{parse_tls_plain_message, TlsMessageExt, Ja3Extractor};
use hex_literal::hex;

let buf = hex!("16030100f5010000f10303ad8e0c8dfe3adbc045e51aee4cb9480c02d5da4a240f95e8282a1f51be34901a20681af80b44c4b359adb3f9543a966e07e6ba6bed551472a62cd4b107cbd40e830014130213011303c02cc02bcca9c030c02fcca800ff01000094002b00050403040303000b00020100000a00080006001d00170018000d00140012050304030807080608050804060105010401001700000005000501000000000000001800160000137777772e706574616c7365617263682e636f6d00120000003300260024001d0020086fffef5fa7f04fb7d788615bc425820eba366ddb5f75c7d8336a0a05722d38002d0002010100230000");
let chp = parse_tls_plain_message(&buf)
  .ok()
  .and_then(|message| message.into_client_hello_payload())
  .expect("Message valid");
println!("{:?}", chp.ja3());
println!("{}", chp.ja3());
println!("{}", chp.ja3_with_real_version());
assert_eq!(chp.ja3().to_string(), "771,4866-4865-4867-49196-49195-52393-49200-49199-52392-255,43-11-10-13-23-5-0-18-51-45-35,29-23-24,0");

To generate hex string of JA3, activating optional features via Cargo.toml:

# in Cargo.toml
# under [dependencies]
ja3-rustls = { version = "0.0.0", features = ["md5-string"] } # or just md5

, then

println!("{:x?}", chp.ja3().to_md5()); // requires feature: md5
println!("{}", chp.ja3().to_md5_string()); // requires feature: md5-string

Structs§

ClientHelloPayload
Ja3
JA3, as explained in [https://github.com/salesforce/ja3]
Ja3andMore
Ja3 and more fields.
Message
A message with decoded payload

Constants§

GREASE_U8
These values are reserved as GREASE values for PskKeyExchangeModes:
GREASE_U16_BE
These values, when interpreted as big-endian u8 tuples, are reserved GREASE values for cipher suites and Application-Layer Protocol Negotiation (ALPN). When interpreted as u16, are reserved GREASE values for extensions, named groups, signature algorithms, and versions:

Traits§

Ja3Extractor
TlsMessageExt

Functions§

grease_u8
Generate a random GREASE value.
grease_u16_be
Generate a random GREASE value.
is_grease_u8
is_grease_u16_be
parse_tls_plain_message
try_regrease_u8
Try to rewrite a GREASE value with a randomly generated one iff it is actally GREASE. Otherwise, the value is retuned as is.
try_regrease_u16_be
Try to rewrite a GREASE value with a randomly generated one iff it is actally GREASE. Otherwise, the value is retuned as is.