@anonympins/fingerprint 0.7.0 → 0.7.2
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 +29 -0
- package/README.md +1 -1
- package/composer.json +8 -1
- package/package.json +1 -1
- package/public/fingerprint-wordpress.zip +0 -0
- package/src/js/build-client.js +8 -10
- package/src/js/fingerprint.builder.js +37 -38
- package/src/js/fingerprint.client.js +1531 -1463
- package/src/js/fingerprint.client.obfuscated.js +1 -0
- package/src/js/fingerprint.js +190 -16
- package/src/js/fingerprint.utils.js +213 -213
- package/src/js/library.js +340 -376
- package/src/js/mongodb-store.js +1 -1
- package/src/js/optimization.worker.js +27 -27
- package/src/js/pow.solver.inline.js +154 -56
- package/src/js/pow.solver.js +180 -92
- package/src/js/pow.worker.js +48 -48
- package/src/js/redis-store.js +1 -1
- package/src/js/tests/fingerprint.client.init.test.js +146 -143
- package/src/js/tests/fingerprint.test.js +124 -10
- package/src/js/tests/ip-reputation.test.js +1 -0
- package/src/js/upow-model-task.js +14 -15
- package/src/php/AutoTuner.php +34 -34
- package/src/php/Challenge/ChallengeUtils.php +57 -11
- package/src/php/Config/SecurityProfiles.php +20 -0
- package/src/php/DirectFingerprint.php +190 -145
- package/src/php/FingerprintBuilder.php +29 -30
- package/src/php/FingerprintClient.php +147 -148
- package/src/php/FingerprintEngine.php +44 -17
- package/src/php/Ja3AnomalyDetector.php +33 -32
- package/src/php/Optimization/FunctionRegistry.php +7 -7
- package/src/php/Optimization/Optimization.php +24 -24
- package/src/php/Optimization/OptimizationOperators.php +26 -25
- package/src/php/Optimization/ProblemInitializers.php +52 -52
- package/src/php/ProblemManager.php +31 -34
- package/src/php/RequestContext.php +8 -1
- package/src/php/Store/IStore.php +7 -8
- package/src/php/Store/InMemoryStore.php +66 -66
- package/src/php/Store/MongoDbStore.php +5 -5
- package/src/php/Store/RedisStore.php +5 -5
- package/src/php/Store/StoreManager.php +35 -35
- package/src/php/Tests/ChallengeUtilsTest.php +453 -453
- package/src/php/Tests/DnsCircuitBreakerTest.php +105 -105
- package/src/php/Tests/FingerprintEngineTest.php +38 -0
- package/src/php/Tests/IpReputationTest.php +10 -0
- package/src/php/Tests/MaliciousPatternsTest.php +103 -103
- package/src/php/Tests/MetricsTest.php +97 -97
- package/src/php/Tests/ProblemManagerTest.php +376 -376
- package/src/php/Tests/QuicFingerprintTest.php +53 -53
- package/src/php/Tests/RequestUtilsTest.php +471 -471
- package/src/php/Tests/TLSClientHelloParserTest.php +177 -177
- package/src/php/Tests/config/ed25519_key.json +3 -3
- package/src/php/Utils/BlockList.php +99 -99
- package/src/php/Utils/Env.php +49 -49
- package/src/php/Utils/MaliciousPatterns.php +74 -74
- package/src/php/Utils/MetricsManager.php +209 -209
- package/src/php/Utils/RequestUtils.php +129 -7
- package/src/php/Utils/TLSClientHelloParser.php +369 -369
- package/src/php/WordPress/WpDbStore.php +155 -0
- package/src/php/WordPress/fingerprint-wordpress.php +554 -0
- package/src/php/WordPress/languages/fingerprint-wordpress-de_DE.mo +0 -0
- package/src/php/WordPress/languages/fingerprint-wordpress-de_DE.po +262 -0
- package/src/php/WordPress/languages/fingerprint-wordpress-fr_FR.mo +0 -0
- package/src/php/WordPress/languages/fingerprint-wordpress-fr_FR.po +268 -0
- package/src/php/WordPress/package.php +218 -0
- package/src/php/bin/auto-tune.php +118 -118
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
declare(strict_types=1);
|
|
4
|
-
|
|
5
|
-
namespace Anonympins\Fingerprint\Tests;
|
|
6
|
-
|
|
7
|
-
use Anonympins\Fingerprint\RequestContext;
|
|
8
|
-
use Anonympins\Fingerprint\Utils\RequestUtils;
|
|
9
|
-
use PHPUnit\Framework\TestCase;
|
|
10
|
-
|
|
11
|
-
class QuicFingerprintTest extends TestCase
|
|
12
|
-
{
|
|
13
|
-
public function testGetProtocolAnomalyScoreReturnsZeroIfNoFp(): void
|
|
14
|
-
{
|
|
15
|
-
$context = $this->createMock(RequestContext::class);
|
|
16
|
-
$context->method('getHeader')->willReturn(null);
|
|
17
|
-
$res = RequestUtils::getProtocolAnomalyScore($context);
|
|
18
|
-
$this->assertEquals(0.0, $res['protocolAnomalyScore']);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public function testGetProtocolAnomalyScoreDetectsSpoofedChrome(): void
|
|
22
|
-
{
|
|
23
|
-
$context = $this->createMock(RequestContext::class);
|
|
24
|
-
$context->method('getHeader')->willReturnCallback(function($name) {
|
|
25
|
-
if ($name === 'user-agent') {
|
|
26
|
-
return 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
|
|
27
|
-
}
|
|
28
|
-
if ($name === 'x-quic-fp') {
|
|
29
|
-
return '1;1=65536,4=50;i=0';
|
|
30
|
-
}
|
|
31
|
-
return null;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
$res = RequestUtils::getProtocolAnomalyScore($context);
|
|
35
|
-
$this->assertEquals(100.0, $res['protocolAnomalyScore']);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public function testGetProtocolAnomalyScoreAllowsLegitChrome(): void
|
|
39
|
-
{
|
|
40
|
-
$context = $this->createMock(RequestContext::class);
|
|
41
|
-
$context->method('getHeader')->willReturnCallback(function($name) {
|
|
42
|
-
if ($name === 'user-agent') {
|
|
43
|
-
return 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
|
|
44
|
-
}
|
|
45
|
-
if ($name === 'x-quic-fp') {
|
|
46
|
-
return '1;1=1572864,4=100;u=2,i';
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
$res = RequestUtils::getProtocolAnomalyScore($context);
|
|
52
|
-
$this->assertEquals(0.0, $res['protocolAnomalyScore']);
|
|
53
|
-
}
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
declare(strict_types=1);
|
|
4
|
+
|
|
5
|
+
namespace Anonympins\Fingerprint\Tests;
|
|
6
|
+
|
|
7
|
+
use Anonympins\Fingerprint\RequestContext;
|
|
8
|
+
use Anonympins\Fingerprint\Utils\RequestUtils;
|
|
9
|
+
use PHPUnit\Framework\TestCase;
|
|
10
|
+
|
|
11
|
+
class QuicFingerprintTest extends TestCase
|
|
12
|
+
{
|
|
13
|
+
public function testGetProtocolAnomalyScoreReturnsZeroIfNoFp(): void
|
|
14
|
+
{
|
|
15
|
+
$context = $this->createMock(RequestContext::class);
|
|
16
|
+
$context->method('getHeader')->willReturn(null);
|
|
17
|
+
$res = RequestUtils::getProtocolAnomalyScore($context);
|
|
18
|
+
$this->assertEquals(0.0, $res['protocolAnomalyScore']);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public function testGetProtocolAnomalyScoreDetectsSpoofedChrome(): void
|
|
22
|
+
{
|
|
23
|
+
$context = $this->createMock(RequestContext::class);
|
|
24
|
+
$context->method('getHeader')->willReturnCallback(function($name) {
|
|
25
|
+
if ($name === 'user-agent') {
|
|
26
|
+
return 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
|
|
27
|
+
}
|
|
28
|
+
if ($name === 'x-quic-fp') {
|
|
29
|
+
return '1;1=65536,4=50;i=0';
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
$res = RequestUtils::getProtocolAnomalyScore($context);
|
|
35
|
+
$this->assertEquals(100.0, $res['protocolAnomalyScore']);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public function testGetProtocolAnomalyScoreAllowsLegitChrome(): void
|
|
39
|
+
{
|
|
40
|
+
$context = $this->createMock(RequestContext::class);
|
|
41
|
+
$context->method('getHeader')->willReturnCallback(function($name) {
|
|
42
|
+
if ($name === 'user-agent') {
|
|
43
|
+
return 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
|
|
44
|
+
}
|
|
45
|
+
if ($name === 'x-quic-fp') {
|
|
46
|
+
return '1;1=1572864,4=100;u=2,i';
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
$res = RequestUtils::getProtocolAnomalyScore($context);
|
|
52
|
+
$this->assertEquals(0.0, $res['protocolAnomalyScore']);
|
|
53
|
+
}
|
|
54
54
|
}
|