@anonympins/fingerprint 0.4.2 β 0.4.3
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 +17 -0
- package/README.md +66 -60
- package/package.json +1 -1
- package/src/js/fingerprint.js +10 -2
- package/src/js/pow.solver.js +531 -497
- package/src/js/problem-manager.js +24 -0
- package/src/js/tests/fingerprint.test.js +2351 -2319
- package/src/js/tests/pow.solver.test.js +233 -197
- package/src/js/tests/problem-manager.test.js +358 -322
- package/src/php/FingerprintEngine.php +10 -2
- package/src/php/Optimization/FunctionRegistry.php +63 -62
- package/src/php/Optimization/OptimizationOperators.php +401 -304
- package/src/php/ProblemManager.php +29 -0
- package/src/php/Tests/FingerprintEngineTest.php +330 -299
- package/src/php/Tests/ProblemManagerTest.php +376 -296
- package/src/php/Tests/RequestUtilsTest.php +256 -253
- package/src/php/Tests/problems.config.json +3 -3
- package/src/php/Utils/RequestUtils.php +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## Version 0.4.3
|
|
2
|
+
|
|
3
|
+
### π Rotation Score Hardening (Anti-Spoofing & No-JS Parity)
|
|
4
|
+
- **Server-Only Rotation Analysis**: Completely removed all client-side telemetry (`X-Device-Fingerprint`, canvas, gpu, hardware concurrency) from the `rotationScore` computation across all engines (Node.js, PHP, Python).
|
|
5
|
+
- **Zero-Trust Client Inputs**: Fixed a vulnerability where client-side fingerprint spoofing or the absence of JS headers on static/API requests could trick the engines into triggering false-positive rotation alerts. The stable part analysis now relies exclusively on server-side signatures (`ua`, `ja3`, `ja4`, `h2`, `tcp`).
|
|
6
|
+
|
|
7
|
+
### π Python Engine Parity & uPoW
|
|
8
|
+
- **Useful Proof-of-Work (uPoW) in Python**: Fully implemented uPoW support in Python, bringing complete parity to task dispatching and solution integration with the Node.js and PHP versions.
|
|
9
|
+
- **Dry Run & Score Matching**: Added robust Dry Run mode and suspicion score calculations in the Python engine, allowing passive security evaluation without request interruption.
|
|
10
|
+
|
|
11
|
+
### π PHP Engine Enhancements
|
|
12
|
+
- **PHP uPoW Coverage**: Greatly expanded test coverage for the PHP `ProblemManager` and useful work integrations, ensuring reliability under heavy workloads.
|
|
13
|
+
|
|
14
|
+
### π‘οΈ Challenge Routing & Better Re-challenge
|
|
15
|
+
- **Refined Challenge Router**: Restructured challenge routing and solution validation pipelines for direct, consistent handling of cryptographic results.
|
|
16
|
+
- **Smarter Re-challenging**: Improved re-challenge behavior across all engines. If an already cleared device's score spikes above the high threshold again, the existing clearance ticket is bypassed, instantly prompting a fresh security challenge.
|
|
17
|
+
|
|
1
18
|
## Version 0.4.2 (Hotfix)
|
|
2
19
|
|
|
3
20
|
### 𧬠Auto-Tuner Rework & Sanity Guardrails
|
package/README.md
CHANGED
|
@@ -1,61 +1,67 @@
|
|
|
1
|
-
# Fingerprint anti-bot protection
|
|
2
|
-
|
|
3
|
-
NodeJS tests : [](https://github.com/anonympins/fingerprint/actions/workflows/ci.yml) / PHP tests : [](https://github.com/anonympins/fingerprint/actions/workflows/ci-php.yml) / Python tests : [](https://github.com/anonympins/fingerprint/actions/workflows/ci-python.yml)
|
|
4
|
-
|
|
5
|
-
[](https://github.com/anonympins/fingerprint/releases)
|
|
6
|
-
[](https://github.com/anonympins/fingerprint/blob/main/LICENSE)
|
|
7
|
-

|
|
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.
|
|
10
|
-
|
|
11
|
-

|
|
12
|
-
|
|
13
|
-
## Key Features
|
|
14
|
-
|
|
15
|
-
- **Multi-Layered Detection**: Combines TLS/JA3/JA4 analysis, HTTP header consistency checks, IP reputation, and behavioral tracking (mouse movements, keystrokes).
|
|
16
|
-
- **Adaptive Mitigation**: Imposes progressive cryptographic Proof-of-Work (PoW) challenges to block automated clients without impacting legitimate human users.
|
|
17
|
-
- **Predefined Profiles**: Ready-to-use security profiles (`balanced`, `strict`, `api`, `blog`, `ecommerce`) tailored to your specific use case.
|
|
18
|
-
|
|
19
|
-
## Quick Start
|
|
20
|
-
|
|
21
|
-
### Node.js
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npm install @anonympins/fingerprint
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### PHP
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
composer require anonympins/fingerprint
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
# Fingerprint anti-bot protection
|
|
2
|
+
|
|
3
|
+
NodeJS tests : [](https://github.com/anonympins/fingerprint/actions/workflows/ci.yml) / PHP tests : [](https://github.com/anonympins/fingerprint/actions/workflows/ci-php.yml) / Python tests : [](https://github.com/anonympins/fingerprint/actions/workflows/ci-python.yml)
|
|
4
|
+
|
|
5
|
+
[](https://github.com/anonympins/fingerprint/releases)
|
|
6
|
+
[](https://github.com/anonympins/fingerprint/blob/main/LICENSE)
|
|
7
|
+

|
|
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.
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## Key Features
|
|
14
|
+
|
|
15
|
+
- **Multi-Layered Detection**: Combines TLS/JA3/JA4 analysis, HTTP header consistency checks, IP reputation, and behavioral tracking (mouse movements, keystrokes).
|
|
16
|
+
- **Adaptive Mitigation**: Imposes progressive cryptographic Proof-of-Work (PoW) challenges to block automated clients without impacting legitimate human users.
|
|
17
|
+
- **Predefined Profiles**: Ready-to-use security profiles (`balanced`, `strict`, `api`, `blog`, `ecommerce`) tailored to your specific use case.
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
### Node.js
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @anonympins/fingerprint
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### PHP
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
composer require anonympins/fingerprint
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Python
|
|
34
|
+
```bash
|
|
35
|
+
pip install fingerprint-engine
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
To prevent documentation drift, all detailed guides and reference materials are maintained in the `doc/` directory. Please refer to [these resources](https://github.com/anonympins/fingerprint/wiki/home) to configure and integrate the engine:
|
|
41
|
+
|
|
42
|
+
1. **[Key Concepts & Suspicion Vectors](https://github.com/anonympins/fingerprint/wiki/concepts)**: Learn how the engine calculates suspicion scores across the 15 distinct vectors and manages the Proof-of-Work mitigation layers.
|
|
43
|
+
2. **[Node.js Integration Guide](https://github.com/anonympins/fingerprint/wiki/nodejs_integration)**: Step-by-step instructions for Express.js middleware and raw HTTP server integrations.
|
|
44
|
+
3. **[PHP Integration Guide](https://github.com/anonympins/fingerprint/wiki/php_integration)**: Configuration details for direct PHP integration, TLS fingerprinting forwarding via Nginx/Apache, and securing Prometheus metrics.
|
|
45
|
+
3. **[Python Integration Guide](https://github.com/anonympins/fingerprint/wiki/python_integration)**: Python middleware for ASGI and WSGI integration.
|
|
46
|
+
4. **[Full Configuration Options](https://github.com/anonympins/fingerprint/wiki/full_options)**: Complete parameter list for fine-tuning weights, custom honeypots, and security profile overrides.
|
|
47
|
+
5. **[API Reference](https://github.com/anonympins/fingerprint/wiki/api_reference)**: Public API signatures and guides on substituting the in-memory datastore with Redis or MongoDB.
|
|
48
|
+
|
|
49
|
+
Start with the **[Documentation Portal](https://github.com/anonympins/fingerprint/wiki/home)** for a complete index.
|
|
50
|
+
|
|
51
|
+
## Contributing
|
|
52
|
+
|
|
53
|
+
We welcome community contributions! Please read our **[Contributing Guidelines](https://github.com/anonympins/fingerprint/blob/main/CONTRIBUTING.md)** for information on:
|
|
54
|
+
- Setting up your local environment (Node.js and PHP).
|
|
55
|
+
- Running the test suites (`Vitest` and `PHPUnit`).
|
|
56
|
+
- Coding and pull request standards.
|
|
57
|
+
|
|
58
|
+
Thanks to our contributors :
|
|
59
|
+
- [anonympins](https://github.com/anonympins)
|
|
60
|
+
|
|
61
|
+
## Used actively on
|
|
62
|
+
|
|
63
|
+
- https://primals.net and sub-sites
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
61
67
|
This project is licensed under the MIT License.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anonympins/fingerprint",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
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",
|
package/src/js/fingerprint.js
CHANGED
|
@@ -263,7 +263,7 @@ function extractStablePart(fpString) {
|
|
|
263
263
|
if (!fpString) {
|
|
264
264
|
return '';
|
|
265
265
|
}
|
|
266
|
-
const stableKeys = ['
|
|
266
|
+
const stableKeys = ['ua', 'ja3', 'ja4', 'h2', 'tcp'];
|
|
267
267
|
const parts = fpString.split('|');
|
|
268
268
|
const stableParts = [];
|
|
269
269
|
for (const part of parts) {
|
|
@@ -3421,7 +3421,15 @@ export class FingerprintEngine {
|
|
|
3421
3421
|
}
|
|
3422
3422
|
|
|
3423
3423
|
if (isSuspicious && usefulWorkDispatched) {
|
|
3424
|
-
|
|
3424
|
+
const isApi = requestContext.rawReq && this.securityConfig?.isApiRequest?.(requestContext.rawReq);
|
|
3425
|
+
if (isApi) {
|
|
3426
|
+
return { action: 'challenge', score: finalScore, vector: suspicionVector, status: 404, body: challengePayload };
|
|
3427
|
+
} else {
|
|
3428
|
+
const html = `<html><body><script>
|
|
3429
|
+
window.location.href = "${path}?pow_type=useful_work_task&pow_nonce=${nonce}&pow_problem_id=${challengePayload.challenge.usefulWorkTask.problemId}&pow_solution_work_result=" + encodeURIComponent(JSON.stringify({ solution: [], energy: 0 }));
|
|
3430
|
+
</script></body></html>`;
|
|
3431
|
+
return { action: 'challenge', score: finalScore, vector: suspicionVector, status: 404, body: html };
|
|
3432
|
+
}
|
|
3425
3433
|
} else if (isSuspicious) { // Pour les scores bas/moyens ou si le travail utile n'est pas choisi / a Γ©chouΓ©
|
|
3426
3434
|
const decision = { action: 'challenge', score: finalScore, vector: suspicionVector, status: 404 };
|
|
3427
3435
|
if (this.dryRun) {
|