@prosopo/provider-mock 2.6.12 → 2.7.13
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 +100 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +15 -73
- package/dist/api.js.map +1 -1
- package/dist/bundle/i18nBackend-CuerCtMs.js +5290 -0
- package/dist/bundle/provider-mock.start.bundle.js +113792 -0
- package/dist/db.d.ts +38 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +79 -0
- package/dist/db.js.map +1 -0
- package/dist/start.js +4 -2
- package/dist/start.js.map +1 -1
- package/package.json +18 -10
- package/vite.config.ts +59 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,105 @@
|
|
|
1
1
|
# @prosopo/provider-mock
|
|
2
2
|
|
|
3
|
+
## 2.7.13
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- Updated dependencies [9671152]
|
|
7
|
+
- @prosopo/api-express-router@3.0.3
|
|
8
|
+
- @prosopo/provider@3.0.6
|
|
9
|
+
|
|
10
|
+
## 2.7.12
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- @prosopo/provider@3.0.5
|
|
14
|
+
|
|
15
|
+
## 2.7.11
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- @prosopo/provider@3.0.4
|
|
19
|
+
|
|
20
|
+
## 2.7.10
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [f682f0c]
|
|
24
|
+
- @prosopo/types@3.0.2
|
|
25
|
+
- @prosopo/provider@3.0.3
|
|
26
|
+
- @prosopo/common@3.0.2
|
|
27
|
+
- @prosopo/api-express-router@3.0.2
|
|
28
|
+
|
|
29
|
+
## 2.7.9
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- @prosopo/common@3.0.1
|
|
33
|
+
- @prosopo/types@3.0.1
|
|
34
|
+
- @prosopo/api-express-router@3.0.1
|
|
35
|
+
- @prosopo/provider@3.0.2
|
|
36
|
+
|
|
37
|
+
## 2.7.8
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- @prosopo/provider@3.0.1
|
|
41
|
+
|
|
42
|
+
## 2.7.7
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- Updated dependencies [64b5bcd]
|
|
46
|
+
- @prosopo/api-express-router@3.0.0
|
|
47
|
+
- @prosopo/provider@3.0.0
|
|
48
|
+
- @prosopo/common@3.0.0
|
|
49
|
+
- @prosopo/types@3.0.0
|
|
50
|
+
|
|
51
|
+
## 2.7.6
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- Updated dependencies [aee3efe]
|
|
55
|
+
- @prosopo/provider@2.14.0
|
|
56
|
+
- @prosopo/types@2.10.0
|
|
57
|
+
|
|
58
|
+
## 2.7.5
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Updated dependencies [d5f2e95]
|
|
62
|
+
- @prosopo/provider@2.13.0
|
|
63
|
+
|
|
64
|
+
## 2.7.4
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- 86c22b8: structured logging
|
|
68
|
+
- Updated dependencies [86c22b8]
|
|
69
|
+
- @prosopo/api-express-router@2.6.4
|
|
70
|
+
- @prosopo/provider@2.12.1
|
|
71
|
+
- @prosopo/common@2.7.2
|
|
72
|
+
- @prosopo/types@2.9.1
|
|
73
|
+
|
|
74
|
+
## 2.7.3
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- Updated dependencies [d6de900]
|
|
78
|
+
- @prosopo/provider@2.12.0
|
|
79
|
+
|
|
80
|
+
## 2.7.2
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- Updated dependencies [30bb383]
|
|
84
|
+
- @prosopo/provider@2.11.0
|
|
85
|
+
- @prosopo/types@2.9.0
|
|
86
|
+
- @prosopo/common@2.7.1
|
|
87
|
+
- @prosopo/api-express-router@2.6.3
|
|
88
|
+
|
|
89
|
+
## 2.7.1
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- Updated dependencies [8f0644a]
|
|
93
|
+
- @prosopo/provider@2.10.0
|
|
94
|
+
- @prosopo/common@2.7.0
|
|
95
|
+
- @prosopo/types@2.8.0
|
|
96
|
+
- @prosopo/api-express-router@2.6.2
|
|
97
|
+
|
|
98
|
+
## 2.7.0
|
|
99
|
+
### Minor Changes
|
|
100
|
+
|
|
101
|
+
- 6f3d993: Add docker packages to workspace. Release 2.6.8
|
|
102
|
+
|
|
3
103
|
## 2.6.12
|
|
4
104
|
|
|
5
105
|
### Patch Changes
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAsBA,OAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAQ/C,wBAAgB,aAAa,IAAI,MAAM,CAqFtC"}
|
package/dist/api.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ProsopoApiError } from "@prosopo/common";
|
|
1
|
+
import { ProsopoApiError, getLogger } from "@prosopo/common";
|
|
2
|
+
import { getJA4 } from "@prosopo/provider";
|
|
4
3
|
import { ClientApiPaths, VerifySolutionBody, decodeProcaptchaOutput, } from "@prosopo/types";
|
|
5
4
|
import express from "express";
|
|
6
|
-
import {
|
|
5
|
+
import { JA4Database } from "./db.js";
|
|
7
6
|
export function prosopoRouter() {
|
|
8
7
|
const router = express.Router();
|
|
8
|
+
const db = new JA4Database(process.env.MONGO_URL || "mongodb://localhost:27017", process.env.MONGO_DBNAME || "client", process.env.MONGO_AUTH_SOURCE || "admin");
|
|
9
9
|
router.post(ClientApiPaths.VerifyImageCaptchaSolutionDapp, async (req, res, next) => {
|
|
10
10
|
let body;
|
|
11
11
|
try {
|
|
@@ -48,77 +48,19 @@ export function prosopoRouter() {
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
router.get("/test", async (req, res) => {
|
|
51
|
-
console.log(req.headers);
|
|
52
|
-
console.log(req.rawHeaders);
|
|
53
|
-
const headers = req.headers;
|
|
54
|
-
if (!headers["x-tls-clienthello"] ||
|
|
55
|
-
!headers["x-tls-version"] ||
|
|
56
|
-
!headers["x-tls-server-name"]) {
|
|
57
|
-
console.error("Missing required headers.");
|
|
58
|
-
return res.status(400).send("Missing required headers.");
|
|
59
|
-
}
|
|
60
|
-
if (typeof headers["x-tls-clienthello"] !== "string" ||
|
|
61
|
-
typeof headers["x-tls-version"] !== "string" ||
|
|
62
|
-
typeof headers["x-tls-server-name"] !== "string") {
|
|
63
|
-
console.error("Client Hello message is not a string.");
|
|
64
|
-
return res.status(400).send("Client Hello message is not a string.");
|
|
65
|
-
}
|
|
66
51
|
try {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
console.log("Headers TLS Version:", headers["x-tls-version"].toLowerCase());
|
|
79
|
-
const tlsVersion = tlsVersionMap[headers["x-tls-version"].toLowerCase()] ||
|
|
80
|
-
Buffer.from([0x03, 0x03]);
|
|
81
|
-
const readableStream = new Readable({
|
|
82
|
-
read() {
|
|
83
|
-
this.push(clientHelloBuffer);
|
|
84
|
-
},
|
|
52
|
+
const logger = getLogger("info", import.meta.url);
|
|
53
|
+
const ja4PlusFingerprint = await getJA4(req.headers, logger);
|
|
54
|
+
await db.connect();
|
|
55
|
+
await db.addOrUpdateJA4Record({
|
|
56
|
+
ja4_fingerprint: ja4PlusFingerprint.ja4PlusFingerprint,
|
|
57
|
+
user_agent_string: req.headers["user-agent"] || "",
|
|
58
|
+
});
|
|
59
|
+
await db.close();
|
|
60
|
+
return res.json({
|
|
61
|
+
ja4: ja4PlusFingerprint.ja4PlusFingerprint,
|
|
62
|
+
ua: req.headers["user-agent"],
|
|
85
63
|
});
|
|
86
|
-
const clientHello = await readTlsClientHello(readableStream);
|
|
87
|
-
console.log("Parsed TLS Client Hello:", clientHello);
|
|
88
|
-
const { alpnProtocols } = clientHello;
|
|
89
|
-
const [_tlsVersion, cipherSuites, extensions] = clientHello.fingerprintData;
|
|
90
|
-
console.log("TLS Version:", _tlsVersion);
|
|
91
|
-
console.log("Cipher Suites:", cipherSuites);
|
|
92
|
-
console.log("Extensions:", extensions);
|
|
93
|
-
const transport = "t";
|
|
94
|
-
if (tlsVersion.readUInt16BE(0) !== _tlsVersion) {
|
|
95
|
-
console.warn("TLS version mismatch.", tlsVersion.readUInt16BE(0), _tlsVersion);
|
|
96
|
-
}
|
|
97
|
-
const sniIndicator = headers["x-tls-server-name"] ? "d" : "i";
|
|
98
|
-
const validCipherSuites = cipherSuites.filter((cs) => (cs & 0x0f0f) !== 0x0a0a);
|
|
99
|
-
const cipherCount = validCipherSuites.length;
|
|
100
|
-
const validExtensions = extensions.filter((ext) => (ext & 0x0f0f) !== 0x0a0a);
|
|
101
|
-
const extensionCount = validExtensions.length;
|
|
102
|
-
const alpn = alpnProtocols?.length ? alpnProtocols[0] : "";
|
|
103
|
-
const alpnLabel = alpn ? `${alpn[0]}${alpn[alpn.length - 1]}` : "00";
|
|
104
|
-
const sortedCiphers = validCipherSuites
|
|
105
|
-
.map((cs) => cs.toString(16).padStart(4, "0"))
|
|
106
|
-
.sort()
|
|
107
|
-
.join(",");
|
|
108
|
-
const cipherHash = createHash("sha256")
|
|
109
|
-
.update(sortedCiphers)
|
|
110
|
-
.digest("hex")
|
|
111
|
-
.slice(0, 12);
|
|
112
|
-
const sortedExtensions = extensions
|
|
113
|
-
.map((ext) => ext.toString(16).padStart(4, "0"))
|
|
114
|
-
.sort()
|
|
115
|
-
.join(",");
|
|
116
|
-
const extensionHash = createHash("sha256")
|
|
117
|
-
.update(sortedExtensions)
|
|
118
|
-
.digest("hex")
|
|
119
|
-
.slice(0, 12);
|
|
120
|
-
const ja4PlusFingerprint = `${transport}${tlsVersion}${sniIndicator}${cipherCount}${extensionCount}${alpnLabel}_${cipherHash}_${extensionHash}`;
|
|
121
|
-
return res.json({ ja4PlusFingerprint });
|
|
122
64
|
}
|
|
123
65
|
catch (e) {
|
|
124
66
|
console.error("Error parsing ClientHello:", e);
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EACN,cAAc,EACd,kBAAkB,EAClB,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,OAAwB,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAOtC,MAAM,UAAU,aAAa;IAC5B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAChC,MAAM,EAAE,GAAG,IAAI,WAAW,CACzB,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,2BAA2B,EACpD,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,QAAQ,EACpC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,OAAO,CACxC,CAAC;IAQF,MAAM,CAAC,IAAI,CACV,cAAc,CAAC,8BAA8B,EAC7C,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACxB,IAAI,IAAkC,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