@anonympins/fingerprint 0.4.3 → 0.4.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,46 @@
1
+ ## Version 0.4.5
2
+
3
+ ### ✨ New Features
4
+
5
+ - **Stateless PoW Ticket Validation**: Introduced cryptographically secure stateless Proof-of-Work (PoW) tickets. These tickets are encrypted and signed, allowing for tamper-proof validation without requiring server-side storage, improving scalability and resilience.
6
+ - **TCP Anomaly Score**: Implemented a new `tcpAnomalyScore` based on passive TCP/IP fingerprinting (p0f-like analysis). This score detects inconsistencies between the client's TCP stack (TTL, window size, options) and its User-Agent, indicating potential spoofing or bot activity.
7
+ - **Dynamic WebAssembly (WASM) Modules**: Introduced polymorphic WASM module generation. The client-side WASM solver now generates unique, randomized code for each request or session, significantly increasing the cost and difficulty for bots to fingerprint, reverse-engineer, and bypass.
8
+
9
+ ### 🚀 Improvements
10
+
11
+ - **Enhanced Client Hints Inconsistency Detection**: Improved the `clientHintsInconsistencyScore` calculation for more precise detection of discrepancies between User-Agent and Client Hints headers, leading to more accurate bot identification.
12
+
13
+ ### 🛡️ Security Enhancements
14
+
15
+ - **PHP DoS Prevention**: Implemented specific measures in the PHP engine to prevent Denial-of-Service (DoS) attacks, ensuring stability and resource protection under high load or malicious activity.
16
+
17
+ ### 📚 Documentation
18
+
19
+ - **README Update**: Updated `README.md` to reflect the latest features and changes in the library.
20
+
21
+ ---
22
+
23
+ ## Version 0.4.4
24
+
25
+ ### 🧮 Pattern Score Ratios & Weighted Subscores
26
+ - **Linear Weighted Pattern Scores**: Introduced configurable ratios (`regularityRatio`, `benfordRatio`, `enumerationRatio`) to dynamically adjust the influence of timing regularity, Benford's law deviation, and sequential path enumeration on the final `requestPatternScore`.
27
+
28
+ ### 🕸️ Advanced Client Tracking & Touch Analysis
29
+ - **Mobile Client Touch Analysis**: Implemented detailed analysis of mobile touch events, extracting advanced behavioral metrics such as average pressure, touch radius size, coordinate variance, and multi-touch count to effectively detect automated touch emulation.
30
+ - **WASM Client Caching with IndexedDB**: Added client-side persistent storage of compiled WebAssembly modules in IndexedDB (`wasm-cache-db`) to drastically reduce initialization times, skipping compilation overhead on subsequent visits.
31
+ - **Phantom Interactive Traps**: Added invisible phantom interactive link traps to hook headlessly automated clients via hover/focus events.
32
+
33
+ ### 🛡️ Enhanced Honeypot Protections & Extensibility
34
+ - **External Analyzers Support**: Extended the honeypot subsystem to allow plugging in external analyzers (e.g., custom regex matching or WAF frameworks like ModSecurity) to evaluate request payloads.
35
+ - **Optimized Injection Filters**: Refined input inspection to recursively search deeply nested NoSQL/SQL structures using centralized security algorithms.
36
+
37
+ ### 📶 Stable Subnet Reputation & Rate Limiting
38
+ - **Hardware-Anchored Subnet Metrics**: Refactored subnet score aggregations to anchor suspicious activities to hardware-based device hashes (`deviceHash`) rather than easily cleared tracking cookies, preventing proxy rotation masking.
39
+ - **Subnet Challenge Rate Limiting**: Integrated a Token Bucket rate limiter (`checkChallengeRateLimit`) that throttles challenge requests per IPv4/IPv6 subnet to prevent denial of service (DoS) attacks on verification systems.
40
+
41
+ ### 🤖 Botnet Clustering & Similarity Scores
42
+ - **Botnet Cluster Score**: Implemented network-wide botnet detection (`botnetClusterScore`) using exponential mathematical decay. It groups volatile client requests that share identical stable hardware profiles across distinct IP addresses within a rolling 10-minute window.
43
+
1
44
  ## Version 0.4.3
2
45
 
3
46
  ### 🔒 Rotation Score Hardening (Anti-Spoofing & No-JS Parity)
package/README.md CHANGED
@@ -6,10 +6,14 @@ NodeJS tests : [![Test NodeJS](https://img.shields.io/github/actions/workflow/st
6
6
  [![License](https://img.shields.io/github/license/anonympins/fingerprint)](https://github.com/anonympins/fingerprint/blob/main/LICENSE)
7
7
  ![GitHub commit activity](https://img.shields.io/github/commit-activity/w/anonympins/fingerprint)
8
8
 
9
- A multi-layered behavioral, cryptographic, and network analysis engine designed to identify and mitigate malicious requests (bots, scrapers, session hijacking) in real-time. Supports both **Node.js** and **PHP** environments.
9
+ A multi-layered behavioral, cryptographic, and network analysis engine designed to identify and mitigate malicious requests (bots, scrapers, session hijacking, bot farms) in real-time. Supports **Node.js**, **Python** and **PHP** environments.
10
10
 
11
11
  ![illustration](https://i.ibb.co/fV1QT6Mf/image-c6e10859baae53bb595112ec08fc9e27.png)
12
12
 
13
+ ### Presentation video
14
+
15
+ [![Presentation](https://i.ibb.co/1tkPS01C/Capture-d-cran-2026-09-07-194728.png)](https://www.youtube.com/watch?v=Ujeznl0JAl4)
16
+
13
17
  ## Key Features
14
18
 
15
19
  - **Multi-Layered Detection**: Combines TLS/JA3/JA4 analysis, HTTP header consistency checks, IP reputation, and behavioral tracking (mouse movements, keystrokes).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anonympins/fingerprint",
3
- "version": "0.4.3",
3
+ "version": "0.4.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",
@@ -0,0 +1,158 @@
1
+ import crypto from "node:crypto";
2
+
3
+ function encodeULEB128(val) {
4
+ const bytes = [];
5
+ let num = val >>> 0;
6
+ do {
7
+ let byte = num & 0x7f;
8
+ num >>>= 7;
9
+ if (num !== 0) byte |= 0x80;
10
+ bytes.push(byte);
11
+ } while (num !== 0);
12
+ return bytes;
13
+ }
14
+
15
+ function encodeSLEB128(val) {
16
+ const bytes = [];
17
+ let num = val | 0;
18
+ while (true) {
19
+ let byte = num & 0x7f;
20
+ num >>= 7;
21
+ if ((num === 0 && (byte & 0x40) === 0) || (num === -1 && (byte & 0x40) !== 0)) {
22
+ bytes.push(byte);
23
+ break;
24
+ }
25
+ bytes.push(byte | 0x80);
26
+ }
27
+ return bytes;
28
+ }
29
+
30
+ export class DynamicWasmGenerator {
31
+ /**
32
+ * Generates a unique polymorphic WebAssembly module containing a custom hash function
33
+ * with randomized constants and control flow variables.
34
+ * @param {object} constants - Custom seed, multiplier and adder.
35
+ * @returns {Buffer} Valid WebAssembly binary buffer.
36
+ */
37
+ static generate(constants) {
38
+ const { seed, multiplier, adder } = constants;
39
+
40
+ const inst = [
41
+ 0x01, 0x02, 0x7f, // Locals: 1 entry of 2 locals of type i32
42
+ // h = seed
43
+ 0x41, ...encodeSLEB128(seed),
44
+ 0x21, 0x03,
45
+ // i = 0
46
+ 0x41, 0x00,
47
+ 0x21, 0x02,
48
+
49
+ // block
50
+ 0x02, 0x40,
51
+ // loop
52
+ 0x03, 0x40,
53
+
54
+ // if i >= len break
55
+ 0x20, 0x02,
56
+ 0x20, 0x01,
57
+ 0x4f,
58
+ 0x0d, 0x01,
59
+
60
+ // byte = load8_u(ptr + i)
61
+ 0x20, 0x00,
62
+ 0x20, 0x02,
63
+ 0x6a,
64
+ 0x2d, 0x00, 0x00,
65
+
66
+ // h = h ^ byte
67
+ 0x20, 0x03,
68
+ 0x73,
69
+
70
+ // h = h * multiplier
71
+ 0x41, ...encodeSLEB128(multiplier),
72
+ 0x6c,
73
+
74
+ // h = h + adder
75
+ 0x41, ...encodeSLEB128(adder),
76
+ 0x6a,
77
+
78
+ // local.set 3
79
+ 0x21, 0x03,
80
+
81
+ // i = i + 1
82
+ 0x20, 0x02,
83
+ 0x41, 0x01,
84
+ 0x6a,
85
+ 0x21, 0x02,
86
+
87
+ // br 0
88
+ 0x0c, 0x00,
89
+
90
+ 0x0b, // end loop
91
+ 0x0b, // end block
92
+
93
+ // return h
94
+ 0x20, 0x03,
95
+ 0x0b // end function
96
+ ];
97
+
98
+ const funcBody = [
99
+ ...encodeULEB128(inst.length),
100
+ ...inst
101
+ ];
102
+
103
+ const codeSectionPayload = [
104
+ ...encodeULEB128(1),
105
+ ...funcBody
106
+ ];
107
+
108
+ const codeSection = [
109
+ 0x0a,
110
+ ...encodeULEB128(codeSectionPayload.length),
111
+ ...codeSectionPayload
112
+ ];
113
+
114
+ const typeSection = [
115
+ 0x01, 0x07, 0x01, 0x60, 0x02, 0x7f, 0x7f, 0x01, 0x7f
116
+ ];
117
+
118
+ const funcSection = [
119
+ 0x03, 0x02, 0x01, 0x00
120
+ ];
121
+
122
+ const memSection = [
123
+ 0x05, 0x03, 0x01, 0x00, 0x01
124
+ ];
125
+
126
+ const exportSection = [
127
+ 0x07, 0x11, 0x02, 0x04, 0x68, 0x61, 0x73, 0x68, 0x00, 0x00, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x02, 0x00
128
+ ];
129
+
130
+ const wasm = [
131
+ 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00,
132
+ ...typeSection,
133
+ ...funcSection,
134
+ ...memSection,
135
+ ...exportSection,
136
+ ...codeSection
137
+ ];
138
+
139
+ return Buffer.from(wasm);
140
+ }
141
+
142
+ /**
143
+ * Pure JavaScript fallback equivalent of the custom polymorphic hash.
144
+ * @param {string} str Input string.
145
+ * @param {object} constants Parameters.
146
+ * @returns {number} 32-bit unsigned integer hash.
147
+ */
148
+ static hashJs(str, constants) {
149
+ const { seed, multiplier, adder } = constants;
150
+ let h = seed | 0;
151
+ for (let i = 0; i < str.length; i++) {
152
+ const byte = str.charCodeAt(i) & 0xff;
153
+ h = h ^ byte;
154
+ h = Math.imul(h, multiplier) + adder;
155
+ }
156
+ return h >>> 0;
157
+ }
158
+ }