@anonympins/fingerprint 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## Version 0.5.5
2
+
3
+ - **🔒 Client Session Handshake & HMAC Metric Signing**: Implemented elliptic-curve Diffie-Hellman (ECDH over curve `P-256`) key exchange protocol during client initialization (`?fp_handshake=1`). Leveraged the negotiated session key to cryptographically sign behavioral metrics (`signMetrics`) on the client using HMAC-SHA256, protecting against replay attacks and telemetry tampering.
4
+ - **🧵 Non-Blocking Polymorphic Obfuscation Worker**: Offloaded CPU-heavy JavaScript obfuscation and parsing pipelines (`compilePolymorphicJs`) to a dedicated Node.js Worker Thread (`obfuscation.worker.js`). This isolates resource-intensive obfuscation tasks from the main event loop, preventing latency spikes on production servers.
5
+ - **💾 Performance Optimizations with SimpleLRUCache**: Added an in-memory `SimpleLRUCache` to eliminate synchronous file system calls (`readFileSync`). Standardized caching of custom HTML challenge pages and static files (`fp.js`/`fp.wasm`).
6
+ - **🛡️ Auto-Tuner Stability Guardrails & Rollbacks**: Implemented post-calculation validation checks with a configurable `validationTolerance` threshold (default `0.15`). Automatically rolls back unstable parameters and triggers an `autotuning_instability_alert` if proposed changes degrade FPR/FNR metrics.
7
+ - **🧬 Strict Multi-Language Cross-Parity**: Aligned 32-bit single-precision floating-point (IEEE 754) calculations for chaotic map trajectories across WebGPU, WebGL, C++ WASM, and PHP environments. Guaranteed bit-to-bit convergence across 1,000 random seeds.
8
+ - **🧮 Fixed Zero Threshold PoW Shift Error**: Patched a potential bitwise shift crash (`1n << shift` with a negative shift) inside `calculateTarget` when the suspicion score dropped to or below zero. Legitimate requests now resolve directly to the maximum target range.
9
+
1
10
  ## Version 0.5.4
2
11
 
3
12
  - **🔒 JA3/JA4 Handshake Parsing Hardening (PHP/Python)**: Fixed ALPN length constraints and untangled nested loops in the binary TLS Client Hello decoder, ensuring native and highly reliable raw JA4 fingerprint calculations directly at the socket layer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anonympins/fingerprint",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "Advanced anti-bot library for Node.js using multi-layer fingerprinting (JA3, client-side, headers), behavioral analysis, and adaptive Proof-of-Work (PoW) challenges to mitigate scraping, scalping, and automated threats.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,68 +1,68 @@
1
- import {promises as fs} from 'node:fs';
2
- import {dirname, join} from 'node:path';
3
- import {fileURLToPath} from 'node:url';
4
- import {exec} from 'node:child_process';
5
- import JavaScriptObfuscator from 'javascript-obfuscator';
6
-
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = dirname(__filename);
9
-
10
- /**
11
- * Tente d'exécuter la commande de build pour le module WASM.
12
- * Ne bloque pas le build si la commande échoue (ex: em++ non trouvé).
13
- */
14
- function buildWasm() {
15
- return new Promise((resolve) => {
16
- console.log('Attempting to build WASM module (optional)...');
17
- const command = "em++ src/cpp/main.cpp src/cpp/utils.cpp -o public/fp.js -s WASM=1 -s MODULARIZE=1 -s EXPORT_NAME='createFingerprintModule' -s \"EXPORTED_FUNCTIONS=['_hash_string','_solve_cpu_target','_solve_memory_challenge']\" -O3 --no-entry";
18
-
19
- exec(command, (error, stdout, stderr) => {
20
- if (error) {
21
- console.warn('WASM build failed (this is optional and can be ignored):', stderr);
22
- } else {
23
- console.log('WASM module built successfully.');
24
- }
25
- resolve(); // Toujours résoudre la promesse pour ne pas bloquer le build principal.
26
- });
27
- });
28
- }
29
-
30
- async function buildClientScript() {
31
- try {
32
- console.log('Reading client script...');
33
- const clientScriptPath = join(__dirname, 'fingerprint.client.js');
34
- const clientScriptContent = await fs.readFile(clientScriptPath, 'utf-8');
35
-
36
- console.log('Obfuscating client script...');
37
- const obfuscationResult = JavaScriptObfuscator.obfuscate(clientScriptContent, {
38
- compact: true,
39
- controlFlowFlattening: true, // Aplatit le flux de contrôle
40
- deadCodeInjection: true, // Injecte du code mort
41
- stringArray: true,
42
- stringArrayRotate: true, // Fait tourner le tableau de chaînes
43
- stringArrayShuffle: true, // Mélange le tableau de chaînes
44
- // L'utilisation d'une graine (seed) de 0 signifie que l'obfuscation sera déterministe
45
- // pour une même entrée. Pour une obfuscation unique à chaque build, on peut utiliser
46
- // une graine aléatoire, par exemple : seed: Math.random()
47
- seed: Math.random(),
48
- selfDefending: true,
49
- });
50
-
51
- const obfuscatedCode = obfuscationResult.getObfuscatedCode();
52
-
53
- console.log('Writing obfuscated script to fingerprint.client.obfuscated.js...');
54
- await fs.writeFile(join(__dirname, './fingerprint.client.obfuscated.js'), obfuscatedCode);
55
-
56
- console.log('Client script build process completed successfully.');
57
- } catch (error) {
58
- console.error('Error during client script build:', error);
59
- process.exit(1);
60
- }
61
- }
62
-
63
- async function main() {
64
- await buildClientScript();
65
- await buildWasm();
66
- }
67
-
1
+ import {promises as fs} from 'node:fs';
2
+ import {dirname, join} from 'node:path';
3
+ import {fileURLToPath} from 'node:url';
4
+ import {exec} from 'node:child_process';
5
+ import JavaScriptObfuscator from 'javascript-obfuscator';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+
10
+ /**
11
+ * Tente d'exécuter la commande de build pour le module WASM.
12
+ * Ne bloque pas le build si la commande échoue (ex: em++ non trouvé).
13
+ */
14
+ function buildWasm() {
15
+ return new Promise((resolve) => {
16
+ console.log('Attempting to build WASM module (optional)...');
17
+ const command = "em++ src/cpp/main.cpp src/cpp/utils.cpp -o public/fp.js -s WASM=1 -s MODULARIZE=1 -s EXPORT_NAME='createFingerprintModule' -s \"EXPORTED_FUNCTIONS=['_hash_string','_solve_cpu_target','_solve_memory_challenge','_generate_gpu_pow_trajectory']\" -O3 --no-entry";
18
+
19
+ exec(command, (error, stdout, stderr) => {
20
+ if (error) {
21
+ console.warn('WASM build failed (this is optional and can be ignored):', stderr);
22
+ } else {
23
+ console.log('WASM module built successfully.');
24
+ }
25
+ resolve(); // Toujours résoudre la promesse pour ne pas bloquer le build principal.
26
+ });
27
+ });
28
+ }
29
+
30
+ async function buildClientScript() {
31
+ try {
32
+ console.log('Reading client script...');
33
+ const clientScriptPath = join(__dirname, 'fingerprint.client.js');
34
+ const clientScriptContent = await fs.readFile(clientScriptPath, 'utf-8');
35
+
36
+ console.log('Obfuscating client script...');
37
+ const obfuscationResult = JavaScriptObfuscator.obfuscate(clientScriptContent, {
38
+ compact: true,
39
+ controlFlowFlattening: true, // Aplatit le flux de contrôle
40
+ deadCodeInjection: true, // Injecte du code mort
41
+ stringArray: true,
42
+ stringArrayRotate: true, // Fait tourner le tableau de chaînes
43
+ stringArrayShuffle: true, // Mélange le tableau de chaînes
44
+ // L'utilisation d'une graine (seed) de 0 signifie que l'obfuscation sera déterministe
45
+ // pour une même entrée. Pour une obfuscation unique à chaque build, on peut utiliser
46
+ // une graine aléatoire, par exemple : seed: Math.random()
47
+ seed: Math.random(),
48
+ selfDefending: true,
49
+ });
50
+
51
+ const obfuscatedCode = obfuscationResult.getObfuscatedCode();
52
+
53
+ console.log('Writing obfuscated script to fingerprint.client.obfuscated.js...');
54
+ await fs.writeFile(join(__dirname, './fingerprint.client.obfuscated.js'), obfuscatedCode);
55
+
56
+ console.log('Client script build process completed successfully.');
57
+ } catch (error) {
58
+ console.error('Error during client script build:', error);
59
+ process.exit(1);
60
+ }
61
+ }
62
+
63
+ async function main() {
64
+ await buildClientScript();
65
+ await buildWasm();
66
+ }
67
+
68
68
  main();