phishing-framework-code / ml-engine /models /tls_rendering_encoder.py
Amal340's picture
Upload complete Cloud-Native Multimodal Phishing Detection Framework (Go + Deep Learning + XAI + K8s) (part 2)
cf9e03f verified
Raw History Blame Contribute Delete
729 Bytes
"""
Real-Time Rendering Signals and TLS Handshake Fingerprint Encoder
(Dawson, Cartwright, & Whitfeild, 2026)
Analyzes JA3/JA4 TLS handshake attributes, certificate chain anomalies, and dynamic DOM rendering telemetry.
"""
import numpy as np
class TLSRenderingEncoder:
def __init__(self, input_dim: int = 16, embed_dim: int = 16, seed: int = 202):
rng = np.random.default_rng(seed)
self.W = rng.normal(0, np.sqrt(2.0 / input_dim), size=(input_dim, embed_dim))
self.b = np.zeros(embed_dim)
def forward(self, x_tls: np.ndarray) -> np.ndarray:
z_tls = np.maximum(0.0, x_tls @ self.W + self.b)
norm = np.linalg.norm(z_tls, axis=-1, keepdims=True) + 1e-8
return z_tls / norm