@anonympins/fingerprint 0.7.3 → 0.7.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.
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Service Worker for transparent network interception and credential enrichment.
3
+ * Leaves global window.fetch native and untouched to prevent tampering detection.
4
+ */
5
+
6
+ let clientCredentials = {
7
+ fp: '',
8
+ behavior: 1,
9
+ targetDomains: []
10
+ };
11
+
12
+ self.addEventListener('install', () => {
13
+ self.skipWaiting();
14
+ });
15
+
16
+ self.addEventListener('activate', (event) => {
17
+ event.waitUntil(self.clients.claim());
18
+ });
19
+
20
+ self.addEventListener('message', (event) => {
21
+ if (event.data && event.data.type === 'UPDATE_CREDENTIALS') {
22
+ if (typeof event.data.fp !== 'undefined') {
23
+ clientCredentials.fp = event.data.fp;
24
+ }
25
+ if (typeof event.data.behavior !== 'undefined') {
26
+ clientCredentials.behavior = event.data.behavior;
27
+ }
28
+ if (Array.isArray(event.data.targetDomains)) {
29
+ clientCredentials.targetDomains = event.data.targetDomains;
30
+ }
31
+ }
32
+ });
33
+
34
+ self.addEventListener('fetch', (event) => {
35
+ const url = new URL(event.request.url);
36
+
37
+ // Only process HTTP and HTTPS requests
38
+ if (!url.protocol.startsWith('http')) return;
39
+
40
+ // Scope filtering: same-origin or configured domains
41
+ const targets = clientCredentials.targetDomains;
42
+ const shouldProtect = (targets.length === 0 && url.origin === self.location.origin) ||
43
+ (targets.length > 0 && targets.includes(url.hostname));
44
+
45
+ if (!shouldProtect) return;
46
+
47
+ event.respondWith((async () => {
48
+ const newHeaders = new Headers(event.request.headers);
49
+
50
+ if (clientCredentials.fp) {
51
+ newHeaders.set('X-Device-Fingerprint', clientCredentials.fp);
52
+ }
53
+ if (typeof clientCredentials.behavior !== 'undefined') {
54
+ newHeaders.set('X-Behavior-Metrics', String(clientCredentials.behavior));
55
+ }
56
+
57
+ const requestInit = {
58
+ method: event.request.method,
59
+ headers: newHeaders,
60
+ credentials: event.request.credentials,
61
+ cache: event.request.cache,
62
+ redirect: event.request.redirect,
63
+ referrer: event.request.referrer,
64
+ integrity: event.request.integrity
65
+ };
66
+
67
+ if (event.request.mode !== 'navigate') {
68
+ requestInit.mode = event.request.mode;
69
+ }
70
+
71
+ if (event.request.method !== 'GET' && event.request.method !== 'HEAD') {
72
+ try {
73
+ const bodyBlob = await event.request.clone().blob();
74
+ if (bodyBlob.size > 0) requestInit.body = bodyBlob;
75
+ } catch (e) {}
76
+ }
77
+
78
+ const modifiedRequest = new Request(event.request.url, requestInit);
79
+ return fetch(modifiedRequest);
80
+ })());
81
+ });
package/src/js/library.js CHANGED
@@ -1774,18 +1774,22 @@ Optimization.Operators.solveFullSecurityTuning = (context, options = {}) => {
1774
1774
  inconsistencyScore: 0.8,
1775
1775
  honeypotScore: 1.0,
1776
1776
  behaviorScore: 0.7,
1777
+ botScore: 1.0,
1778
+ cookieDroppingScore: 0.9,
1777
1779
  crossLayerInconsistencyScore: 0.4,
1778
1780
  timeInconsistencyScore: 0.9,
1779
1781
  tlsSpoofingScore: 0.8,
1780
- botScore: 1.0,
1782
+ clientHintsInconsistencyScore: 0.7,
1783
+ clickVarianceScore: 0.6,
1781
1784
  subnetScore: 0.4,
1782
1785
  ipReputationScore: 0.5,
1783
1786
  botnetClusterScore: 0.6,
1784
1787
  tcpAnomalyScore: 0.8,
1785
1788
  quicAnomalyScore: 0.8,
1789
+ protocolAnomalyScore: 0.8,
1786
1790
  renderingAnomalyScore: 0.8,
1787
1791
  threatIntelScore: 1.0,
1788
- virtualizationScore: 0.8
1792
+ virtualizationScore: 0.8,
1789
1793
  };
1790
1794
 
1791
1795
  // An "individual" is a complete security configuration object
@@ -398,7 +398,7 @@ export async function solveCpuTargetInline(baseBlock, target, progressCallback)
398
398
  * @returns {Promise<number>} Solution integer.
399
399
  */
400
400
  export async function solveCpuTarget(message, target) {
401
- // Vérifie si les Web Workers sont supportés par le navigateur.
401
+ // Check if Web Workers are supported by the browser.
402
402
  if (typeof(Worker) === "undefined") {
403
403
  console.warn("Web Workers not supported. Falling back to main thread calculation (UI may freeze).");
404
404
  // An inline fallback implementation could be placed here if needed.
@@ -555,7 +555,7 @@ export async function solveTsp(cities, targetMaxDistance) {
555
555
  return totalDistance;
556
556
  }
557
557
 
558
- // Solveur simple du TSP (heuristique du plus proche voisin)
558
+ // Simple TSP solver (nearest-neighbor heuristic)
559
559
  function solveTspNearestNeighbor(cities) {
560
560
  const numCities = cities.length;
561
561
  if (numCities === 0) return [];
@@ -1046,7 +1046,6 @@ async function solveUsefulWorkTask(task) {
1046
1046
  if (!solverFunction) {
1047
1047
  throw new Error(`Solver '${task.solverName}' not found on client.`);
1048
1048
  }
1049
- // On appelle le solveur en lui passant le payload et les options.
1050
1049
  // Invoke solver with payload and options.
1051
1050
  return solverFunction(task.payload, { generations: task.generations, initialFront: task.initialFront });
1052
1051
  }