@mherod/get-cookie 2.1.0 → 2.1.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/.parcelrc +2 -7
- package/bun.lockb +0 -0
- package/dist/cli.js +18319 -2
- package/dist/index.js +24914 -1
- package/dist/types.d.ts +361 -30
- package/package-lock.json +3997 -6448
- package/package.json +8 -54
- package/src/CookieRow.ts +35 -7
- package/src/CookieSpec.ts +32 -14
- package/src/SpecialCases.ts +6 -5
- package/src/StringToRegex.ts +4 -4
- package/src/browsers/CompositeCookieQueryStrategy.ts +34 -28
- package/src/browsers/CookieQueryStrategy.ts +1 -1
- package/src/browsers/CookieStoreQueryStrategy.ts +71 -55
- package/src/browsers/QuerySqliteThenTransform.ts +27 -64
- package/src/browsers/chrome/ChromeApplicationSupport.ts +4 -0
- package/src/browsers/chrome/ChromeCookieQueryStrategy.ts +118 -91
- package/src/browsers/chrome/decrypt.ts +133 -97
- package/src/browsers/chrome/getChromePassword.ts +22 -5
- package/src/browsers/firefox/FirefoxCookieQueryStrategy.ts +19 -13
- package/src/browsers/getEncryptedChromeCookie.ts +101 -66
- package/src/browsers/mock/MockCookieQueryStrategy.ts +8 -4
- package/src/browsers/safari/SafariCookieQueryStrategy.ts +34 -3
- package/src/cli.ts +36 -29
- package/src/cliQueryCookies.ts +14 -4
- package/src/comboQueryCookieSpec.ts +7 -10
- package/src/cookieQueryOptions.ts +8 -1
- package/src/cookieSpecsFromUrl.ts +53 -7
- package/src/decodeBinaryCookies.ts +72 -0
- package/src/execSimple.ts +1 -2
- package/src/fetchWithCookies.ts +172 -144
- package/src/findAllFiles.ts +10 -0
- package/src/getChromeCookie.ts +6 -8
- package/src/getCookie.ts +8 -8
- package/src/getFirefoxCookie.ts +13 -9
- package/src/getGroupedRenderedCookies.ts +29 -6
- package/src/getMergedRenderedCookies.ts +4 -2
- package/src/global.ts +2 -2
- package/src/index.ts +16 -6
- package/src/isValidJwt.ts +6 -4
- package/src/listChromeProfiles.ts +18 -10
- package/src/logger.ts +0 -1
- package/src/processBeforeReturn.ts +15 -12
- package/src/queryCookies.ts +22 -17
- package/src/resultsRendered.ts +20 -7
- package/src/unpackHeaders.ts +10 -8
- package/src/util/flatMapAsync.ts +20 -16
- package/tsconfig.json +4 -4
- package/dist/index.js.map +0 -1
- package/dist/module.js +0 -1446
- package/dist/module.js.map +0 -1
- package/dist/prompt.2b8c61c0.js +0 -40
- package/dist/prompt.536a2c51.js +0 -40
- package/dist/prompt.fb2c7dad.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/src/CookieStore.ts +0 -27
- package/src/FileCookieStore.ts +0 -178
package/dist/module.js
DELETED
|
@@ -1,1446 +0,0 @@
|
|
|
1
|
-
import {uniqBy as $6B8p2$uniqBy, merge as $6B8p2$merge, groupBy as $6B8p2$groupBy, orderBy as $6B8p2$orderBy} from "lodash";
|
|
2
|
-
import $6B8p2$minimist from "minimist";
|
|
3
|
-
import $6B8p2$lrucache from "lru-cache";
|
|
4
|
-
import $6B8p2$consola, {createConsola as $6B8p2$createConsola} from "consola";
|
|
5
|
-
import {join as $6B8p2$join} from "path";
|
|
6
|
-
import {pbkdf2 as $6B8p2$pbkdf2, createDecipheriv as $6B8p2$createDecipheriv} from "crypto";
|
|
7
|
-
import $6B8p2$fs, {existsSync as $6B8p2$existsSync} from "fs";
|
|
8
|
-
import {sync as $6B8p2$sync} from "fast-glob";
|
|
9
|
-
import {execSync as $6B8p2$execSync} from "child_process";
|
|
10
|
-
import {Database as $6B8p2$Database} from "sqlite3";
|
|
11
|
-
import $6B8p2$jsonwebtoken from "jsonwebtoken";
|
|
12
|
-
import {fetch as $6B8p2$fetch} from "cross-fetch";
|
|
13
|
-
import $6B8p2$destr from "destr";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var $01f4cf98d50740c6$var$_a;
|
|
19
|
-
const $01f4cf98d50740c6$export$6f4ae1207c703045 = ($01f4cf98d50740c6$var$_a = process.argv) !== null && $01f4cf98d50740c6$var$_a !== void 0 ? $01f4cf98d50740c6$var$_a : [];
|
|
20
|
-
const $01f4cf98d50740c6$var$minimistArgs = (0, $6B8p2$minimist)($01f4cf98d50740c6$export$6f4ae1207c703045.slice(2));
|
|
21
|
-
const $01f4cf98d50740c6$var$defaultOptions = {
|
|
22
|
-
verbose: false
|
|
23
|
-
};
|
|
24
|
-
const $01f4cf98d50740c6$export$c348dfaf65040d9b = (0, $6B8p2$merge)($01f4cf98d50740c6$var$defaultOptions, $01f4cf98d50740c6$var$minimistArgs);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
function $9c57dc37c2aae288$export$bc926c43858bd3cb(obj) {
|
|
28
|
-
return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var $ebc8f9a71f429261$var$_a;
|
|
35
|
-
const $ebc8f9a71f429261$export$a7b6bc01c63cdfc3 = {};
|
|
36
|
-
(0, $6B8p2$merge)($ebc8f9a71f429261$export$a7b6bc01c63cdfc3, ($ebc8f9a71f429261$var$_a = process === null || process === void 0 ? void 0 : process.env) !== null && $ebc8f9a71f429261$var$_a !== void 0 ? $ebc8f9a71f429261$var$_a : {});
|
|
37
|
-
const $ebc8f9a71f429261$export$a7c5707626fc90f = $ebc8f9a71f429261$export$a7b6bc01c63cdfc3["HOME"];
|
|
38
|
-
if (!$ebc8f9a71f429261$export$a7c5707626fc90f) throw new Error("HOME environment variable is not set");
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const $4839429d5d56f308$export$6c123efa52771cfa = (0, $6B8p2$join)((0, $ebc8f9a71f429261$export$a7c5707626fc90f), "Library", "Application Support", "Google", "Chrome");
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const $848ef80fb85ef266$var$consola = (0, $6B8p2$createConsola)({
|
|
48
|
-
fancy: true,
|
|
49
|
-
formatOptions: {
|
|
50
|
-
showLogLevel: true,
|
|
51
|
-
colors: true,
|
|
52
|
-
date: false
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
$848ef80fb85ef266$var$consola.wrapConsole();
|
|
56
|
-
var $848ef80fb85ef266$export$2e2bcd8739ae039 = $848ef80fb85ef266$var$consola;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var $14449851c7a33b81$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
60
|
-
function adopt(value) {
|
|
61
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
62
|
-
resolve(value);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
66
|
-
function fulfilled(value) {
|
|
67
|
-
try {
|
|
68
|
-
step(generator.next(value));
|
|
69
|
-
} catch (e) {
|
|
70
|
-
reject(e);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function rejected(value) {
|
|
74
|
-
try {
|
|
75
|
-
step(generator["throw"](value));
|
|
76
|
-
} catch (e) {
|
|
77
|
-
reject(e);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function step(result) {
|
|
81
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
82
|
-
}
|
|
83
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
function $14449851c7a33b81$export$e85a0c9a1067c5d3(password, encryptedData) {
|
|
87
|
-
return $14449851c7a33b81$var$__awaiter(this, void 0, void 0, function*() {
|
|
88
|
-
// Returns a promise that resolves with the decrypted string
|
|
89
|
-
// Check if password is a string
|
|
90
|
-
if (typeof password !== "string") throw new Error("password must be a string: " + password);
|
|
91
|
-
let encryptedData1;
|
|
92
|
-
encryptedData1 = encryptedData;
|
|
93
|
-
// Check if encryptedData is an object
|
|
94
|
-
if (encryptedData1 == null || typeof encryptedData1 !== "object") throw new Error("encryptedData must be a object: " + encryptedData1);
|
|
95
|
-
// Check if encryptedData is a Buffer or an array of Buffers
|
|
96
|
-
if (!(encryptedData1 instanceof Buffer)) {
|
|
97
|
-
if (Array.isArray(encryptedData1) && encryptedData1[0] instanceof Buffer) {
|
|
98
|
-
[encryptedData1] = encryptedData1;
|
|
99
|
-
// Log if encryptedData is an array of buffers
|
|
100
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log(`encryptedData is an array of buffers, selected first: ${encryptedData1}`);
|
|
101
|
-
} else throw new Error("encryptedData must be a Buffer: " + encryptedData1);
|
|
102
|
-
encryptedData1 = Buffer.from(encryptedData1);
|
|
103
|
-
}
|
|
104
|
-
// Log the password being used for decryption
|
|
105
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) (0, $848ef80fb85ef266$export$2e2bcd8739ae039).start(`Trying to decrypt with password: ${password}`);
|
|
106
|
-
// Return a promise that resolves with the decrypted string
|
|
107
|
-
return new Promise((resolve, reject)=>{
|
|
108
|
-
// Use pbkdf2 to derive a key from the password
|
|
109
|
-
(0, $6B8p2$pbkdf2)(password, "saltysalt", 1003, 16, "sha1", (error, buffer)=>{
|
|
110
|
-
try {
|
|
111
|
-
// Handle any errors from pbkdf2
|
|
112
|
-
if (error) {
|
|
113
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2", error);
|
|
114
|
-
reject(error);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
// Check if the buffer length is 16
|
|
118
|
-
if (buffer.length !== 16) {
|
|
119
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2, buffer length is not 16", buffer.length);
|
|
120
|
-
reject(new Error("Buffer length is not 16"));
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
// Create an initialization vector
|
|
124
|
-
const str = new Array(17).join(" ");
|
|
125
|
-
const iv = Buffer.from(str, "binary");
|
|
126
|
-
// Create a decipher using the derived key and initialization vector
|
|
127
|
-
const decipher = (0, $6B8p2$createDecipheriv)("aes-128-cbc", buffer, iv);
|
|
128
|
-
decipher.setAutoPadding(false);
|
|
129
|
-
// Remove the first 3 bytes from the encrypted data
|
|
130
|
-
if (encryptedData1 && encryptedData1.slice) encryptedData1 = encryptedData1.slice(3);
|
|
131
|
-
// Check if the encrypted data length is a multiple of 16
|
|
132
|
-
if (encryptedData1.length % 16 !== 0) {
|
|
133
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2, encryptedData length is not a multiple of 16", encryptedData1.length);
|
|
134
|
-
reject(new Error("encryptedData length is not a multiple of 16"));
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
// Update the decipher with the encrypted data
|
|
138
|
-
let decoded = decipher.update(encryptedData1);
|
|
139
|
-
try {
|
|
140
|
-
// Finalize the decipher
|
|
141
|
-
decipher.final("utf-8");
|
|
142
|
-
} catch (e) {
|
|
143
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("Error doing decipher.final()", e);
|
|
144
|
-
reject(e);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
// Remove padding from the decoded data
|
|
148
|
-
const padding = decoded[decoded.length - 1];
|
|
149
|
-
if (padding) decoded = decoded.slice(0, 0 - padding);
|
|
150
|
-
// Convert the decoded data to a string
|
|
151
|
-
const decodedString = decoded.toString("utf8");
|
|
152
|
-
// Resolve the promise with the decrypted string
|
|
153
|
-
resolve(decodedString);
|
|
154
|
-
} catch (e) {
|
|
155
|
-
// Reject the promise if there is an error
|
|
156
|
-
reject(e);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
function $a6c1a5673fde1c2b$export$2c9faf86071156ae({ path: path, name: name, maxDepth: maxDepth = 2 }) {
|
|
170
|
-
if (!(0, $6B8p2$existsSync)(path)) throw new Error(`Path ${path} does not exist`);
|
|
171
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) (0, $6B8p2$consola).start(`Searching for ${name} files in ${path}`);
|
|
172
|
-
const files = (0, $6B8p2$sync)(`${path}/**/${name}`, {
|
|
173
|
-
onlyFiles: true,
|
|
174
|
-
deep: maxDepth
|
|
175
|
-
});
|
|
176
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) {
|
|
177
|
-
if (files.length > 0) {
|
|
178
|
-
(0, $6B8p2$consola).success(`Found ${files.length} ${name} files`);
|
|
179
|
-
(0, $6B8p2$consola).info(files);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return files;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
var $9854e148a157cf4f$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
188
|
-
function adopt(value) {
|
|
189
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
190
|
-
resolve(value);
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
194
|
-
function fulfilled(value) {
|
|
195
|
-
try {
|
|
196
|
-
step(generator.next(value));
|
|
197
|
-
} catch (e) {
|
|
198
|
-
reject(e);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function rejected(value) {
|
|
202
|
-
try {
|
|
203
|
-
step(generator["throw"](value));
|
|
204
|
-
} catch (e) {
|
|
205
|
-
reject(e);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
function step(result) {
|
|
209
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
210
|
-
}
|
|
211
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
212
|
-
});
|
|
213
|
-
};
|
|
214
|
-
function $9854e148a157cf4f$export$8d71c74f97c0202e(command) {
|
|
215
|
-
return $9854e148a157cf4f$var$__awaiter(this, void 0, void 0, function*() {
|
|
216
|
-
try {
|
|
217
|
-
const stdout = (0, $6B8p2$execSync)(command, {
|
|
218
|
-
encoding: "binary",
|
|
219
|
-
maxBuffer: 5120
|
|
220
|
-
});
|
|
221
|
-
return stdout.trim();
|
|
222
|
-
} catch (error) {
|
|
223
|
-
throw error;
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
var $7bfcb442b63e5099$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
230
|
-
function adopt(value) {
|
|
231
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
232
|
-
resolve(value);
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
236
|
-
function fulfilled(value) {
|
|
237
|
-
try {
|
|
238
|
-
step(generator.next(value));
|
|
239
|
-
} catch (e) {
|
|
240
|
-
reject(e);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
function rejected(value) {
|
|
244
|
-
try {
|
|
245
|
-
step(generator["throw"](value));
|
|
246
|
-
} catch (e) {
|
|
247
|
-
reject(e);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
function step(result) {
|
|
251
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
252
|
-
}
|
|
253
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
254
|
-
});
|
|
255
|
-
};
|
|
256
|
-
// top level so it's only called once and cached
|
|
257
|
-
const $7bfcb442b63e5099$var$chromePassword = process.platform == "darwin" ? (0, $9854e148a157cf4f$export$8d71c74f97c0202e)('security find-generic-password -w -s "Chrome Safe Storage"') : Promise.reject(new Error("This only works on macOS"));
|
|
258
|
-
function $7bfcb442b63e5099$export$91552cff7edf316() {
|
|
259
|
-
return $7bfcb442b63e5099$var$__awaiter(this, void 0, void 0, function*() {
|
|
260
|
-
return yield $7bfcb442b63e5099$var$chromePassword;
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
function $cf39947f238e32e1$export$963c8d651337e4a4(obj) {
|
|
266
|
-
return typeof obj.domain === "string" && typeof obj.name === "string" && typeof obj.value === "string" && (obj.expiry === undefined || obj.expiry instanceof Date || obj.expiry === "Infinity") && (obj.meta === undefined || typeof obj.meta === "object");
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
// This utility function applies an async callback to each element of the input array (just like Array.prototype.map),
|
|
273
|
-
// waits for all resulting promises to fulfill (similar to Promise.all), and then flattens the resulting array (like Array.prototype.flat).
|
|
274
|
-
var $e5ab09e9bcce5243$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
275
|
-
function adopt(value) {
|
|
276
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
277
|
-
resolve(value);
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
281
|
-
function fulfilled(value) {
|
|
282
|
-
try {
|
|
283
|
-
step(generator.next(value));
|
|
284
|
-
} catch (e) {
|
|
285
|
-
reject(e);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
function rejected(value) {
|
|
289
|
-
try {
|
|
290
|
-
step(generator["throw"](value));
|
|
291
|
-
} catch (e) {
|
|
292
|
-
reject(e);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
function step(result) {
|
|
296
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
297
|
-
}
|
|
298
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
299
|
-
});
|
|
300
|
-
};
|
|
301
|
-
function $e5ab09e9bcce5243$export$4c17d5aa5c0915ca(array, callback, or) {
|
|
302
|
-
return $e5ab09e9bcce5243$var$__awaiter(this, void 0, void 0, function*() {
|
|
303
|
-
if (or) return $e5ab09e9bcce5243$export$4c17d5aa5c0915ca(array, (value, index, array)=>$e5ab09e9bcce5243$var$__awaiter(this, void 0, void 0, function*() {
|
|
304
|
-
try {
|
|
305
|
-
return yield callback(value, index, array);
|
|
306
|
-
} catch (error) {
|
|
307
|
-
return typeof or == "function" ? or(error) : or;
|
|
308
|
-
}
|
|
309
|
-
}));
|
|
310
|
-
// Step 1: Use Array.prototype.map to transform each element of the input array with the provided callback.
|
|
311
|
-
// This will result in an array of promises.
|
|
312
|
-
const ps = array.map(callback);
|
|
313
|
-
// Step 2: Use Promise.all to wait for all promises in the array to fulfill.
|
|
314
|
-
// This will give us an array of fulfilled promise values.
|
|
315
|
-
const awaitedAll = yield Promise.all(ps);
|
|
316
|
-
// Step 3: Flatten the array of fulfilled promise values into a single array.
|
|
317
|
-
// Note: The '@ts-ignore' comment is used to suppress TypeScript compiler warnings, as .flat() method might not be recognized
|
|
318
|
-
// as a valid method for an array of Awaited<O> instances. However, this code assumes that the result of Promise.all
|
|
319
|
-
// is indeed an array that can be flattened.
|
|
320
|
-
// @ts-ignore
|
|
321
|
-
return awaitedAll.flat();
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
var $8a6592be4e3863c1$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
333
|
-
function adopt(value) {
|
|
334
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
335
|
-
resolve(value);
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
339
|
-
function fulfilled(value) {
|
|
340
|
-
try {
|
|
341
|
-
step(generator.next(value));
|
|
342
|
-
} catch (e) {
|
|
343
|
-
reject(e);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
function rejected(value) {
|
|
347
|
-
try {
|
|
348
|
-
step(generator["throw"](value));
|
|
349
|
-
} catch (e) {
|
|
350
|
-
reject(e);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
function step(result) {
|
|
354
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
355
|
-
}
|
|
356
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
357
|
-
});
|
|
358
|
-
};
|
|
359
|
-
function $8a6592be4e3863c1$var$checkFileExistence(file) {
|
|
360
|
-
if (!file || !(0, $6B8p2$fs).existsSync(file)) throw new Error(`File ${file} does not exist`);
|
|
361
|
-
}
|
|
362
|
-
function $8a6592be4e3863c1$var$createDatabase(file) {
|
|
363
|
-
return new (0, $6B8p2$Database)(file);
|
|
364
|
-
}
|
|
365
|
-
function $8a6592be4e3863c1$var$transformRows(//
|
|
366
|
-
rows, rowFilter, rowTransform, file) {
|
|
367
|
-
return rows.filter(rowFilter).map((row)=>{
|
|
368
|
-
const metaData = {
|
|
369
|
-
meta: {
|
|
370
|
-
file: file
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
const cookieRow = rowTransform(row);
|
|
374
|
-
return (0, $6B8p2$merge)(metaData, cookieRow);
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
function $8a6592be4e3863c1$export$f2540d44620bb212(//
|
|
378
|
-
{ file: //
|
|
379
|
-
file, sql: sql, rowFilter: rowFilter = ()=>true, rowTransform: rowTransform }) {
|
|
380
|
-
return $8a6592be4e3863c1$var$__awaiter(this, void 0, void 0, function*() {
|
|
381
|
-
$8a6592be4e3863c1$var$checkFileExistence(file);
|
|
382
|
-
const db = $8a6592be4e3863c1$var$createDatabase(file);
|
|
383
|
-
return new Promise((resolve, reject)=>{
|
|
384
|
-
db.all(sql, (err, rows)=>{
|
|
385
|
-
if (err) return reject(err);
|
|
386
|
-
if (!rows || rows.length === 0) return resolve([]);
|
|
387
|
-
const cookieRows = $8a6592be4e3863c1$var$transformRows(rows, rowFilter, rowTransform, file);
|
|
388
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) (0, $848ef80fb85ef266$export$2e2bcd8739ae039).log(`Rows: ${JSON.stringify(rows)}`);
|
|
389
|
-
return resolve(cookieRows);
|
|
390
|
-
});
|
|
391
|
-
});
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
// This function converts a string into a regular expression
|
|
400
|
-
function $78efb18fcf7b6c2c$export$4eadcf0bf35a2ddb(s) {
|
|
401
|
-
// Replace all occurrences of '.' with a literal '.'
|
|
402
|
-
const s1 = s.replaceAll(/\./gi, ".");
|
|
403
|
-
// Replace all occurrences of '%' with '.*' to match any number of any characters
|
|
404
|
-
const s2 = s1.replace(/%/g, ".*");
|
|
405
|
-
// Replace all occurrences of '*' with '.*' to match any number of any characters
|
|
406
|
-
const s3 = s2.replace(/\*/g, ".*");
|
|
407
|
-
// Return the new string as a RegExp object
|
|
408
|
-
return new RegExp(s3);
|
|
409
|
-
} /*
|
|
410
|
-
%.example.com -> .*\.example\.com
|
|
411
|
-
example.com -> example\.com
|
|
412
|
-
*/
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
var $0273548121c94c98$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
417
|
-
function adopt(value) {
|
|
418
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
419
|
-
resolve(value);
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
423
|
-
function fulfilled(value) {
|
|
424
|
-
try {
|
|
425
|
-
step(generator.next(value));
|
|
426
|
-
} catch (e) {
|
|
427
|
-
reject(e);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
function rejected(value) {
|
|
431
|
-
try {
|
|
432
|
-
step(generator["throw"](value));
|
|
433
|
-
} catch (e) {
|
|
434
|
-
reject(e);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
function step(result) {
|
|
438
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
439
|
-
}
|
|
440
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
441
|
-
});
|
|
442
|
-
};
|
|
443
|
-
function $0273548121c94c98$export$16e9dfd2b3be0e1c({ name: name, domain: domain, file: file = (0, $6B8p2$join)((0, $4839429d5d56f308$export$6c123efa52771cfa), "Default", "Cookies") }) {
|
|
444
|
-
return $0273548121c94c98$var$__awaiter(this, void 0, void 0, function*() {
|
|
445
|
-
if (!(0, $6B8p2$existsSync)(file)) throw new Error(`File ${file} does not exist`);
|
|
446
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) {
|
|
447
|
-
const s = file.split("/").slice(-3).join("/");
|
|
448
|
-
(0, $848ef80fb85ef266$export$2e2bcd8739ae039).start(`Trying Chrome (at ${s}) cookie ${name} for domain ${domain}`);
|
|
449
|
-
}
|
|
450
|
-
let sql;
|
|
451
|
-
//language=SQL
|
|
452
|
-
sql = "SELECT encrypted_value, name, host_key, expires_utc FROM cookies";
|
|
453
|
-
// Define a regular expression to match wildcard characters
|
|
454
|
-
const wildcardRegexp = /^([*%])$/i;
|
|
455
|
-
// Check if the name does not contain wildcard characters
|
|
456
|
-
const specifiedName = name.match(wildcardRegexp) == null;
|
|
457
|
-
// Check if the domain does not contain wildcard characters
|
|
458
|
-
const specifiedDomain = domain.match(wildcardRegexp) == null;
|
|
459
|
-
// Check if the domain contains wildcard characters
|
|
460
|
-
const wildcardDomain = domain.match(/[%*]/) != null;
|
|
461
|
-
// Determine if we should query the domain based on the previous checks
|
|
462
|
-
const queryDomain = specifiedDomain && !wildcardDomain;
|
|
463
|
-
// if we have a wildcard domain, we need to use a regexp
|
|
464
|
-
// If the name is specified or we need to query the domain, we add a WHERE clause to the SQL query
|
|
465
|
-
if (specifiedName || queryDomain) {
|
|
466
|
-
sql += ` WHERE `;
|
|
467
|
-
// If the name is specified, we add a condition to the SQL query to match the name
|
|
468
|
-
if (specifiedName) {
|
|
469
|
-
sql += `name = '${name}'`;
|
|
470
|
-
// If we also need to query the domain, we add an AND operator to the SQL query
|
|
471
|
-
if (queryDomain) sql += ` AND `;
|
|
472
|
-
}
|
|
473
|
-
// If we need to query the domain, we add a condition to the SQL query to match the domain
|
|
474
|
-
if (queryDomain) {
|
|
475
|
-
// The leading dot is replaced with % to match subdomains
|
|
476
|
-
const sqlEmbedDomain = domain.replace(/^[.%]?/, "%");
|
|
477
|
-
sql += `host_key LIKE '${sqlEmbedDomain}';`;
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) (0, $848ef80fb85ef266$export$2e2bcd8739ae039).info("Querying:", sql);
|
|
481
|
-
const domainRegexp = (0, $78efb18fcf7b6c2c$export$4eadcf0bf35a2ddb)(domain);
|
|
482
|
-
const sqliteQuery1 = yield (0, $8a6592be4e3863c1$export$f2540d44620bb212)({
|
|
483
|
-
file: file,
|
|
484
|
-
sql: sql,
|
|
485
|
-
rowFilter: (row)=>{
|
|
486
|
-
return row["host_key"].match(domainRegexp) != null;
|
|
487
|
-
},
|
|
488
|
-
rowTransform: (row)=>{
|
|
489
|
-
const cookieRow = {
|
|
490
|
-
expiry: (row["expires_utc"] / 1000000 - 11644473600) * 1000,
|
|
491
|
-
domain: row["host_key"],
|
|
492
|
-
name: row["name"],
|
|
493
|
-
value: row["encrypted_value"]
|
|
494
|
-
};
|
|
495
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) (0, $848ef80fb85ef266$export$2e2bcd8739ae039).info("Found", cookieRow);
|
|
496
|
-
return cookieRow;
|
|
497
|
-
}
|
|
498
|
-
});
|
|
499
|
-
return sqliteQuery1.filter((row)=>{
|
|
500
|
-
// TODO: is this needed?
|
|
501
|
-
return row.domain.match(domainRegexp) != null;
|
|
502
|
-
});
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
var $d1912041e187e924$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
509
|
-
function adopt(value) {
|
|
510
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
511
|
-
resolve(value);
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
515
|
-
function fulfilled(value) {
|
|
516
|
-
try {
|
|
517
|
-
step(generator.next(value));
|
|
518
|
-
} catch (e) {
|
|
519
|
-
reject(e);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
function rejected(value) {
|
|
523
|
-
try {
|
|
524
|
-
step(generator["throw"](value));
|
|
525
|
-
} catch (e) {
|
|
526
|
-
reject(e);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
function step(result) {
|
|
530
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
531
|
-
}
|
|
532
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
533
|
-
});
|
|
534
|
-
};
|
|
535
|
-
const $d1912041e187e924$export$d0e46ecc2d3d1cd9 = (0, $848ef80fb85ef266$export$2e2bcd8739ae039).withTag("ChromeCookieQueryStrategy");
|
|
536
|
-
class $d1912041e187e924$export$2e2bcd8739ae039 {
|
|
537
|
-
constructor(){
|
|
538
|
-
this.browserName = "Chrome";
|
|
539
|
-
}
|
|
540
|
-
queryCookies(name, domain) {
|
|
541
|
-
return $d1912041e187e924$var$__awaiter(this, void 0, void 0, function*() {
|
|
542
|
-
if (process.platform !== "darwin") throw new Error("This only works on macOS");
|
|
543
|
-
if ((0, $ebc8f9a71f429261$export$a7b6bc01c63cdfc3).FIREFOX_ONLY) return [];
|
|
544
|
-
return $d1912041e187e924$var$getChromeCookies({
|
|
545
|
-
requireJwt: false,
|
|
546
|
-
name: name,
|
|
547
|
-
domain: domain
|
|
548
|
-
});
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
function $d1912041e187e924$var$getPromise1(name, domain, file) {
|
|
553
|
-
return $d1912041e187e924$var$__awaiter(this, void 0, void 0, function*() {
|
|
554
|
-
try {
|
|
555
|
-
return yield (0, $0273548121c94c98$export$16e9dfd2b3be0e1c)({
|
|
556
|
-
name: name,
|
|
557
|
-
domain: domain,
|
|
558
|
-
file: file
|
|
559
|
-
});
|
|
560
|
-
} catch (e) {
|
|
561
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("Error getting encrypted cookie", e);
|
|
562
|
-
return [];
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
function $d1912041e187e924$var$getPromise(name, domain) {
|
|
567
|
-
return $d1912041e187e924$var$__awaiter(this, void 0, void 0, function*() {
|
|
568
|
-
try {
|
|
569
|
-
const files = (0, $a6c1a5673fde1c2b$export$2c9faf86071156ae)({
|
|
570
|
-
path: (0, $4839429d5d56f308$export$6c123efa52771cfa),
|
|
571
|
-
name: "Cookies"
|
|
572
|
-
});
|
|
573
|
-
const results1 = yield (0, $e5ab09e9bcce5243$export$4c17d5aa5c0915ca)(files, (file)=>$d1912041e187e924$var$__awaiter(this, void 0, void 0, function*() {
|
|
574
|
-
return yield $d1912041e187e924$var$getPromise1(name, domain, file);
|
|
575
|
-
}));
|
|
576
|
-
return results1.filter((0, $9c57dc37c2aae288$export$bc926c43858bd3cb));
|
|
577
|
-
} catch (error) {
|
|
578
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("error", error);
|
|
579
|
-
return [];
|
|
580
|
-
}
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
function $d1912041e187e924$var$decryptValue(password, encryptedValue) {
|
|
584
|
-
return $d1912041e187e924$var$__awaiter(this, void 0, void 0, function*() {
|
|
585
|
-
let d;
|
|
586
|
-
try {
|
|
587
|
-
d = yield (0, $14449851c7a33b81$export$e85a0c9a1067c5d3)(password, encryptedValue);
|
|
588
|
-
} catch (e) {
|
|
589
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("Error decrypting cookie", e);
|
|
590
|
-
d = null;
|
|
591
|
-
}
|
|
592
|
-
return d !== null && d !== void 0 ? d : encryptedValue.toString("utf-8");
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
function $d1912041e187e924$var$getChromeCookies({ name: name, domain: domain = "%", requireJwt: requireJwt = false }) {
|
|
596
|
-
return $d1912041e187e924$var$__awaiter(this, void 0, void 0, function*() {
|
|
597
|
-
const encryptedDataItems = yield $d1912041e187e924$var$getPromise(name, domain);
|
|
598
|
-
const password = yield (0, $7bfcb442b63e5099$export$91552cff7edf316)();
|
|
599
|
-
const decrypted = encryptedDataItems.filter(({ value: value })=>value != null && value.length > 0).map((cookieRow)=>$d1912041e187e924$var$__awaiter(this, void 0, void 0, function*() {
|
|
600
|
-
var _a;
|
|
601
|
-
const encryptedValue = cookieRow.value;
|
|
602
|
-
const decryptedValue = yield $d1912041e187e924$var$decryptValue(password, encryptedValue);
|
|
603
|
-
const meta = {};
|
|
604
|
-
(0, $6B8p2$merge)(meta, (_a = cookieRow.meta) !== null && _a !== void 0 ? _a : {});
|
|
605
|
-
const exportedCookie = {
|
|
606
|
-
domain: cookieRow.domain,
|
|
607
|
-
name: cookieRow.name,
|
|
608
|
-
value: decryptedValue,
|
|
609
|
-
meta: meta
|
|
610
|
-
};
|
|
611
|
-
const expiry = cookieRow.expiry;
|
|
612
|
-
const mergeExpiry = expiry != null && expiry > 0 ? {
|
|
613
|
-
expiry: new Date(expiry)
|
|
614
|
-
} : {
|
|
615
|
-
expiry: "Infinity"
|
|
616
|
-
};
|
|
617
|
-
(0, $6B8p2$merge)(exportedCookie, mergeExpiry);
|
|
618
|
-
return exportedCookie;
|
|
619
|
-
}));
|
|
620
|
-
const results = (yield Promise.all(decrypted)).filter((0, $cf39947f238e32e1$export$963c8d651337e4a4));
|
|
621
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("results", results);
|
|
622
|
-
return results;
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
function $81d2f9cb974d13de$export$da22813e5a2ec500({ name: name, domain: domain }) {
|
|
632
|
-
const wildcardRegexp = /^([*%])$/i;
|
|
633
|
-
return {
|
|
634
|
-
specifiedName: name.match(wildcardRegexp) == null,
|
|
635
|
-
specifiedDomain: domain.match(wildcardRegexp) == null
|
|
636
|
-
};
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
var $4d5669fbe05c523e$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
643
|
-
function adopt(value) {
|
|
644
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
645
|
-
resolve(value);
|
|
646
|
-
});
|
|
647
|
-
}
|
|
648
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
649
|
-
function fulfilled(value) {
|
|
650
|
-
try {
|
|
651
|
-
step(generator.next(value));
|
|
652
|
-
} catch (e) {
|
|
653
|
-
reject(e);
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
function rejected(value) {
|
|
657
|
-
try {
|
|
658
|
-
step(generator["throw"](value));
|
|
659
|
-
} catch (e) {
|
|
660
|
-
reject(e);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
function step(result) {
|
|
664
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
665
|
-
}
|
|
666
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
667
|
-
});
|
|
668
|
-
};
|
|
669
|
-
var $4d5669fbe05c523e$var$__classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
670
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
671
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
672
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
673
|
-
};
|
|
674
|
-
var $4d5669fbe05c523e$var$_FirefoxCookieQueryStrategy_instances, $4d5669fbe05c523e$var$_FirefoxCookieQueryStrategy_getFirefoxCookie, $4d5669fbe05c523e$var$_FirefoxCookieQueryStrategy_queryCookiesDb;
|
|
675
|
-
class $4d5669fbe05c523e$var$FirefoxCookieQueryStrategy {
|
|
676
|
-
constructor(){
|
|
677
|
-
$4d5669fbe05c523e$var$_FirefoxCookieQueryStrategy_instances.add(this);
|
|
678
|
-
this.browserName = "Firefox";
|
|
679
|
-
}
|
|
680
|
-
queryCookies(name, domain) {
|
|
681
|
-
return $4d5669fbe05c523e$var$__awaiter(this, void 0, void 0, function*() {
|
|
682
|
-
if (process.platform !== "darwin") // TODO: implement
|
|
683
|
-
return [];
|
|
684
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).browser !== "firefox") return [];
|
|
685
|
-
const cookies = yield $4d5669fbe05c523e$var$__classPrivateFieldGet(this, $4d5669fbe05c523e$var$_FirefoxCookieQueryStrategy_instances, "m", $4d5669fbe05c523e$var$_FirefoxCookieQueryStrategy_getFirefoxCookie).call(this, {
|
|
686
|
-
name: name,
|
|
687
|
-
domain: domain
|
|
688
|
-
});
|
|
689
|
-
if (Array.isArray(cookies)) return cookies.map((cookie)=>{
|
|
690
|
-
return {
|
|
691
|
-
domain: cookie.domain,
|
|
692
|
-
name: cookie.name,
|
|
693
|
-
value: cookie.value.toString("utf8")
|
|
694
|
-
};
|
|
695
|
-
});
|
|
696
|
-
else return [];
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
$4d5669fbe05c523e$var$_FirefoxCookieQueryStrategy_instances = new WeakSet(), $4d5669fbe05c523e$var$_FirefoxCookieQueryStrategy_getFirefoxCookie = function _FirefoxCookieQueryStrategy_getFirefoxCookie({ name: name, domain: domain }) {
|
|
701
|
-
return $4d5669fbe05c523e$var$__awaiter(this, void 0, void 0, function*() {
|
|
702
|
-
const files = (0, $a6c1a5673fde1c2b$export$2c9faf86071156ae)({
|
|
703
|
-
path: $6B8p2$join((0, $ebc8f9a71f429261$export$a7c5707626fc90f), "Library", "Application Support", "Firefox", "Profiles"),
|
|
704
|
-
name: "cookies.sqlite"
|
|
705
|
-
});
|
|
706
|
-
const fn = (file)=>$4d5669fbe05c523e$var$__awaiter(this, void 0, void 0, function*() {
|
|
707
|
-
return yield $4d5669fbe05c523e$var$__classPrivateFieldGet(this, $4d5669fbe05c523e$var$_FirefoxCookieQueryStrategy_instances, "m", $4d5669fbe05c523e$var$_FirefoxCookieQueryStrategy_queryCookiesDb).call(this, file, name, domain);
|
|
708
|
-
});
|
|
709
|
-
const all = yield Promise.all(files.map(fn));
|
|
710
|
-
// flatten
|
|
711
|
-
return all.flat();
|
|
712
|
-
});
|
|
713
|
-
}, $4d5669fbe05c523e$var$_FirefoxCookieQueryStrategy_queryCookiesDb = function _FirefoxCookieQueryStrategy_queryCookiesDb(file, name, domain) {
|
|
714
|
-
return $4d5669fbe05c523e$var$__awaiter(this, void 0, void 0, function*() {
|
|
715
|
-
if (file && !(0, $6B8p2$existsSync)(file)) throw new Error(`File ${file} does not exist`);
|
|
716
|
-
let sql;
|
|
717
|
-
//language=SQL
|
|
718
|
-
sql = "SELECT value, name, host FROM moz_cookies";
|
|
719
|
-
const { specifiedName: specifiedName, specifiedDomain: specifiedDomain } = (0, $81d2f9cb974d13de$export$da22813e5a2ec500)({
|
|
720
|
-
name: name,
|
|
721
|
-
domain: domain
|
|
722
|
-
});
|
|
723
|
-
if (specifiedName || specifiedDomain) {
|
|
724
|
-
sql += ` WHERE `;
|
|
725
|
-
if (specifiedName) {
|
|
726
|
-
sql += `name = '${name}'`;
|
|
727
|
-
if (specifiedDomain) sql += ` AND `;
|
|
728
|
-
}
|
|
729
|
-
if (specifiedDomain) sql += `host LIKE '${domain}';`;
|
|
730
|
-
}
|
|
731
|
-
const rowTransform = (row)=>{
|
|
732
|
-
// row is object key by column name
|
|
733
|
-
const value = row.value;
|
|
734
|
-
return {
|
|
735
|
-
domain: row.domain,
|
|
736
|
-
name: row.name,
|
|
737
|
-
value: Buffer.from(value, "utf8")
|
|
738
|
-
};
|
|
739
|
-
};
|
|
740
|
-
try {
|
|
741
|
-
return yield (0, $8a6592be4e3863c1$export$f2540d44620bb212)({
|
|
742
|
-
file: file,
|
|
743
|
-
sql: sql,
|
|
744
|
-
rowTransform: rowTransform
|
|
745
|
-
});
|
|
746
|
-
} catch (e) {
|
|
747
|
-
console.error(`Error querying ${file}`, e);
|
|
748
|
-
return [];
|
|
749
|
-
}
|
|
750
|
-
});
|
|
751
|
-
};
|
|
752
|
-
var $4d5669fbe05c523e$export$2e2bcd8739ae039 = $4d5669fbe05c523e$var$FirefoxCookieQueryStrategy;
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
var $80afa16b1825fa8a$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
756
|
-
function adopt(value) {
|
|
757
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
758
|
-
resolve(value);
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
762
|
-
function fulfilled(value) {
|
|
763
|
-
try {
|
|
764
|
-
step(generator.next(value));
|
|
765
|
-
} catch (e) {
|
|
766
|
-
reject(e);
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
function rejected(value) {
|
|
770
|
-
try {
|
|
771
|
-
step(generator["throw"](value));
|
|
772
|
-
} catch (e) {
|
|
773
|
-
reject(e);
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
function step(result) {
|
|
777
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
778
|
-
}
|
|
779
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
780
|
-
});
|
|
781
|
-
};
|
|
782
|
-
class $80afa16b1825fa8a$export$2e2bcd8739ae039 {
|
|
783
|
-
constructor(){
|
|
784
|
-
this.browserName = "Safari";
|
|
785
|
-
}
|
|
786
|
-
queryCookies(name, domain) {
|
|
787
|
-
return $80afa16b1825fa8a$var$__awaiter(this, void 0, void 0, function*() {
|
|
788
|
-
// TODO: implement
|
|
789
|
-
return [];
|
|
790
|
-
});
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
var $49168e685ea38e19$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
801
|
-
function adopt(value) {
|
|
802
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
803
|
-
resolve(value);
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
807
|
-
function fulfilled(value) {
|
|
808
|
-
try {
|
|
809
|
-
step(generator.next(value));
|
|
810
|
-
} catch (e) {
|
|
811
|
-
reject(e);
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
function rejected(value) {
|
|
815
|
-
try {
|
|
816
|
-
step(generator["throw"](value));
|
|
817
|
-
} catch (e) {
|
|
818
|
-
reject(e);
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
function step(result) {
|
|
822
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
823
|
-
}
|
|
824
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
825
|
-
});
|
|
826
|
-
};
|
|
827
|
-
const $49168e685ea38e19$var$cache = new (0, $6B8p2$lrucache)({
|
|
828
|
-
ttl: 10000,
|
|
829
|
-
max: 10
|
|
830
|
-
});
|
|
831
|
-
class $49168e685ea38e19$export$2e2bcd8739ae039 {
|
|
832
|
-
constructor(){
|
|
833
|
-
this.browserName = "all";
|
|
834
|
-
this.strategies = [
|
|
835
|
-
// CookieStoreQueryStrategy,
|
|
836
|
-
(0, $d1912041e187e924$export$2e2bcd8739ae039),
|
|
837
|
-
(0, $4d5669fbe05c523e$export$2e2bcd8739ae039),
|
|
838
|
-
(0, $80afa16b1825fa8a$export$2e2bcd8739ae039)
|
|
839
|
-
].map((strategy)=>{
|
|
840
|
-
return new strategy();
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
queryCookies(name, domain) {
|
|
844
|
-
return $49168e685ea38e19$var$__awaiter(this, void 0, void 0, function*() {
|
|
845
|
-
// domain = domain.match(/(\w+.+\w+)/gi)?.pop() ?? domain;
|
|
846
|
-
const key = `${name}:${domain}`;
|
|
847
|
-
if ($49168e685ea38e19$var$cache.has(key)) {
|
|
848
|
-
const cached = $49168e685ea38e19$var$cache.get(key);
|
|
849
|
-
if (cached) return cached;
|
|
850
|
-
}
|
|
851
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) (0, $6B8p2$consola).log("Querying cookies:", name, domain);
|
|
852
|
-
const results = yield (0, $e5ab09e9bcce5243$export$4c17d5aa5c0915ca)(this.strategies, (strategy)=>$49168e685ea38e19$var$__awaiter(this, void 0, void 0, function*() {
|
|
853
|
-
return strategy.queryCookies(name, domain).then((cookies)=>{
|
|
854
|
-
return cookies.map((cookie)=>{
|
|
855
|
-
return (0, $6B8p2$merge)(cookie, {
|
|
856
|
-
meta: {
|
|
857
|
-
browser: strategy.browserName
|
|
858
|
-
}
|
|
859
|
-
});
|
|
860
|
-
});
|
|
861
|
-
}).catch((e)=>{
|
|
862
|
-
(0, $6B8p2$consola).error(`Error querying ${strategy.browserName} cookies`, e);
|
|
863
|
-
return [];
|
|
864
|
-
});
|
|
865
|
-
}));
|
|
866
|
-
$49168e685ea38e19$var$cache.set(`${name}:${domain}`, results);
|
|
867
|
-
return results;
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
function $459cd094c935086e$export$2e2bcd8739ae039(token) {
|
|
876
|
-
try {
|
|
877
|
-
const result = (0, $6B8p2$jsonwebtoken).decode(token, {
|
|
878
|
-
complete: true
|
|
879
|
-
});
|
|
880
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose && result) console.debug(result);
|
|
881
|
-
const payload = result === null || result === void 0 ? void 0 : result.payload;
|
|
882
|
-
if (payload) {
|
|
883
|
-
const exp = payload.exp;
|
|
884
|
-
if (exp) {
|
|
885
|
-
const now = new Date().getTime() / 1000;
|
|
886
|
-
if (now > exp) return false;
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
return true;
|
|
890
|
-
} catch (err) {
|
|
891
|
-
return false;
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
var $f382029733f65752$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
897
|
-
function adopt(value) {
|
|
898
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
899
|
-
resolve(value);
|
|
900
|
-
});
|
|
901
|
-
}
|
|
902
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
903
|
-
function fulfilled(value) {
|
|
904
|
-
try {
|
|
905
|
-
step(generator.next(value));
|
|
906
|
-
} catch (e) {
|
|
907
|
-
reject(e);
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
function rejected(value) {
|
|
911
|
-
try {
|
|
912
|
-
step(generator["throw"](value));
|
|
913
|
-
} catch (e) {
|
|
914
|
-
reject(e);
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
function step(result) {
|
|
918
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
919
|
-
}
|
|
920
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
921
|
-
});
|
|
922
|
-
};
|
|
923
|
-
function $f382029733f65752$export$e6d428437cf2cacb({ name: name, domain: domain }, options) {
|
|
924
|
-
return $f382029733f65752$var$__awaiter(this, void 0, void 0, function*() {
|
|
925
|
-
const strategy = (options === null || options === void 0 ? void 0 : options.strategy) || new (0, $49168e685ea38e19$export$2e2bcd8739ae039)();
|
|
926
|
-
//
|
|
927
|
-
const results = yield strategy.queryCookies(name, domain);
|
|
928
|
-
const allCookies = (0, $6B8p2$uniqBy)(results, JSON.stringify);
|
|
929
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b)["require-jwt"]) {
|
|
930
|
-
const jwtCookies = [];
|
|
931
|
-
for (const result of allCookies){
|
|
932
|
-
const value = result.value;
|
|
933
|
-
if ((0, $459cd094c935086e$export$2e2bcd8739ae039)(value)) jwtCookies.push(result);
|
|
934
|
-
}
|
|
935
|
-
return (0, $01f4cf98d50740c6$export$c348dfaf65040d9b)["single"] ? [
|
|
936
|
-
jwtCookies[0]
|
|
937
|
-
] : jwtCookies;
|
|
938
|
-
} else return (0, $01f4cf98d50740c6$export$c348dfaf65040d9b)["single"] ? [
|
|
939
|
-
allCookies[0]
|
|
940
|
-
] : allCookies;
|
|
941
|
-
});
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
var $3a892f71b64103f5$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
947
|
-
function adopt(value) {
|
|
948
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
949
|
-
resolve(value);
|
|
950
|
-
});
|
|
951
|
-
}
|
|
952
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
953
|
-
function fulfilled(value) {
|
|
954
|
-
try {
|
|
955
|
-
step(generator.next(value));
|
|
956
|
-
} catch (e) {
|
|
957
|
-
reject(e);
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
function rejected(value) {
|
|
961
|
-
try {
|
|
962
|
-
step(generator["throw"](value));
|
|
963
|
-
} catch (e) {
|
|
964
|
-
reject(e);
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
function step(result) {
|
|
968
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
969
|
-
}
|
|
970
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
971
|
-
});
|
|
972
|
-
};
|
|
973
|
-
function $3a892f71b64103f5$export$4be65e66cfa2648a(params) {
|
|
974
|
-
return $3a892f71b64103f5$var$__awaiter(this, void 0, void 0, function*() {
|
|
975
|
-
//
|
|
976
|
-
const cookies = yield (0, $f382029733f65752$export$e6d428437cf2cacb)(params, {
|
|
977
|
-
strategy: new (0, $49168e685ea38e19$export$2e2bcd8739ae039)()
|
|
978
|
-
});
|
|
979
|
-
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
980
|
-
else throw new Error("Cookie not found");
|
|
981
|
-
});
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
var $c23eafaef8340cc3$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
989
|
-
function adopt(value) {
|
|
990
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
991
|
-
resolve(value);
|
|
992
|
-
});
|
|
993
|
-
}
|
|
994
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
995
|
-
function fulfilled(value) {
|
|
996
|
-
try {
|
|
997
|
-
step(generator.next(value));
|
|
998
|
-
} catch (e) {
|
|
999
|
-
reject(e);
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
function rejected(value) {
|
|
1003
|
-
try {
|
|
1004
|
-
step(generator["throw"](value));
|
|
1005
|
-
} catch (e) {
|
|
1006
|
-
reject(e);
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
function step(result) {
|
|
1010
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1011
|
-
}
|
|
1012
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1013
|
-
});
|
|
1014
|
-
};
|
|
1015
|
-
function $c23eafaef8340cc3$export$e5637297e9eb6f2e(params) {
|
|
1016
|
-
return $c23eafaef8340cc3$var$__awaiter(this, void 0, void 0, function*() {
|
|
1017
|
-
const cookies = yield (0, $f382029733f65752$export$e6d428437cf2cacb)(params, {
|
|
1018
|
-
strategy: new (0, $d1912041e187e924$export$2e2bcd8739ae039)()
|
|
1019
|
-
});
|
|
1020
|
-
if (cookies.length == 0) throw new Error("Cookie not found");
|
|
1021
|
-
return cookies.find((0, $cf39947f238e32e1$export$963c8d651337e4a4));
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
var $bea34252b8e17f8d$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
1029
|
-
function adopt(value) {
|
|
1030
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
1031
|
-
resolve(value);
|
|
1032
|
-
});
|
|
1033
|
-
}
|
|
1034
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1035
|
-
function fulfilled(value) {
|
|
1036
|
-
try {
|
|
1037
|
-
step(generator.next(value));
|
|
1038
|
-
} catch (e) {
|
|
1039
|
-
reject(e);
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
function rejected(value) {
|
|
1043
|
-
try {
|
|
1044
|
-
step(generator["throw"](value));
|
|
1045
|
-
} catch (e) {
|
|
1046
|
-
reject(e);
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
function step(result) {
|
|
1050
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1051
|
-
}
|
|
1052
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1053
|
-
});
|
|
1054
|
-
};
|
|
1055
|
-
function $bea34252b8e17f8d$export$c44c5fdef43f0941(params) {
|
|
1056
|
-
return $bea34252b8e17f8d$var$__awaiter(this, void 0, void 0, function*() {
|
|
1057
|
-
const cookies = yield (0, $f382029733f65752$export$e6d428437cf2cacb)(params, {
|
|
1058
|
-
strategy: new (0, $4d5669fbe05c523e$export$2e2bcd8739ae039)()
|
|
1059
|
-
});
|
|
1060
|
-
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
1061
|
-
else throw new Error("Cookie not found");
|
|
1062
|
-
});
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
function $8227023f453bcf31$export$9abc0a414b0d8b8f(results) {
|
|
1069
|
-
// sort by name and expiry descending
|
|
1070
|
-
// takes the latest expiry for each name
|
|
1071
|
-
const orderedResults = (0, $6B8p2$orderBy)(results, [
|
|
1072
|
-
"name",
|
|
1073
|
-
"expiry"
|
|
1074
|
-
], [
|
|
1075
|
-
"asc",
|
|
1076
|
-
"desc"
|
|
1077
|
-
]);
|
|
1078
|
-
return (0, $6B8p2$uniqBy)(orderedResults, (r)=>r.name).map((r)=>r.name + "=" + r.value).join("; ");
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
const $1dfc9b487abbf702$export$91893587392f8cd6 = {
|
|
1089
|
-
strategy: new (0, $49168e685ea38e19$export$2e2bcd8739ae039)()
|
|
1090
|
-
};
|
|
1091
|
-
function $1dfc9b487abbf702$export$e2c944565c7d91c0(options) {
|
|
1092
|
-
return (0, $6B8p2$merge)($1dfc9b487abbf702$export$91893587392f8cd6, options);
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
function $a717c13aae7a1d2c$export$dc0c2da7e018aa1(cookies, options) {
|
|
1098
|
-
if (options === null || options === void 0 ? void 0 : options.removeExpired) return cookies.filter((c)=>{
|
|
1099
|
-
const expiry = c.expiry;
|
|
1100
|
-
if (expiry === undefined) return true;
|
|
1101
|
-
else if (expiry === "Infinity") return true;
|
|
1102
|
-
else return expiry.getTime() > Date.now();
|
|
1103
|
-
});
|
|
1104
|
-
if (options === null || options === void 0 ? void 0 : options.limit) return cookies.slice(0, options.limit);
|
|
1105
|
-
return (0, $6B8p2$uniqBy)(cookies, JSON.stringify);
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
var $0f113de605a2ef1d$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
1110
|
-
function adopt(value) {
|
|
1111
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
1112
|
-
resolve(value);
|
|
1113
|
-
});
|
|
1114
|
-
}
|
|
1115
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1116
|
-
function fulfilled(value) {
|
|
1117
|
-
try {
|
|
1118
|
-
step(generator.next(value));
|
|
1119
|
-
} catch (e) {
|
|
1120
|
-
reject(e);
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
function rejected(value) {
|
|
1124
|
-
try {
|
|
1125
|
-
step(generator["throw"](value));
|
|
1126
|
-
} catch (e) {
|
|
1127
|
-
reject(e);
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
function step(result) {
|
|
1131
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1132
|
-
}
|
|
1133
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1134
|
-
});
|
|
1135
|
-
};
|
|
1136
|
-
function $0f113de605a2ef1d$export$a65902517ae87ba8(cookieSpec, options) {
|
|
1137
|
-
return $0f113de605a2ef1d$var$__awaiter(this, void 0, void 0, function*() {
|
|
1138
|
-
const optsWithDefaults = (0, $1dfc9b487abbf702$export$e2c944565c7d91c0)(options);
|
|
1139
|
-
const fn = (cs)=>(0, $f382029733f65752$export$e6d428437cf2cacb)(cs, optsWithDefaults);
|
|
1140
|
-
if (Array.isArray(cookieSpec)) {
|
|
1141
|
-
const cookiesForMultiSpec = yield (0, $e5ab09e9bcce5243$export$4c17d5aa5c0915ca)(cookieSpec, (cs)=>$0f113de605a2ef1d$var$__awaiter(this, void 0, void 0, function*() {
|
|
1142
|
-
return yield fn(cs);
|
|
1143
|
-
}));
|
|
1144
|
-
return (0, $a717c13aae7a1d2c$export$dc0c2da7e018aa1)(cookiesForMultiSpec, options);
|
|
1145
|
-
} else {
|
|
1146
|
-
const cookiesForSingleSpec = yield fn(cookieSpec);
|
|
1147
|
-
return (0, $a717c13aae7a1d2c$export$dc0c2da7e018aa1)(cookiesForSingleSpec, options);
|
|
1148
|
-
}
|
|
1149
|
-
});
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
var $9bb85405e96c1fbc$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
1154
|
-
function adopt(value) {
|
|
1155
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
1156
|
-
resolve(value);
|
|
1157
|
-
});
|
|
1158
|
-
}
|
|
1159
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1160
|
-
function fulfilled(value) {
|
|
1161
|
-
try {
|
|
1162
|
-
step(generator.next(value));
|
|
1163
|
-
} catch (e) {
|
|
1164
|
-
reject(e);
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
function rejected(value) {
|
|
1168
|
-
try {
|
|
1169
|
-
step(generator["throw"](value));
|
|
1170
|
-
} catch (e) {
|
|
1171
|
-
reject(e);
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
function step(result) {
|
|
1175
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1176
|
-
}
|
|
1177
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1178
|
-
});
|
|
1179
|
-
};
|
|
1180
|
-
function $9bb85405e96c1fbc$export$4d2e9997e2c23417(cookieSpec) {
|
|
1181
|
-
return $9bb85405e96c1fbc$var$__awaiter(this, void 0, void 0, function*() {
|
|
1182
|
-
const cookies = yield (0, $0f113de605a2ef1d$export$a65902517ae87ba8)(cookieSpec);
|
|
1183
|
-
if (cookies.length == 0) throw new Error("Cookie not found");
|
|
1184
|
-
const groupedByFile = (0, $6B8p2$groupBy)(cookies, (r)=>{
|
|
1185
|
-
var _a;
|
|
1186
|
-
return (_a = r.meta) === null || _a === void 0 ? void 0 : _a.file;
|
|
1187
|
-
});
|
|
1188
|
-
return Object.keys(groupedByFile).map((file)=>{
|
|
1189
|
-
const results = groupedByFile[file];
|
|
1190
|
-
return (0, $8227023f453bcf31$export$9abc0a414b0d8b8f)(results);
|
|
1191
|
-
});
|
|
1192
|
-
});
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
var $0b27779070651c3e$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
1200
|
-
function adopt(value) {
|
|
1201
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
1202
|
-
resolve(value);
|
|
1203
|
-
});
|
|
1204
|
-
}
|
|
1205
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1206
|
-
function fulfilled(value) {
|
|
1207
|
-
try {
|
|
1208
|
-
step(generator.next(value));
|
|
1209
|
-
} catch (e) {
|
|
1210
|
-
reject(e);
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
function rejected(value) {
|
|
1214
|
-
try {
|
|
1215
|
-
step(generator["throw"](value));
|
|
1216
|
-
} catch (e) {
|
|
1217
|
-
reject(e);
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
function step(result) {
|
|
1221
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1222
|
-
}
|
|
1223
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1224
|
-
});
|
|
1225
|
-
};
|
|
1226
|
-
function $0b27779070651c3e$export$cfc0723de5712e57(cookieSpec, strategy = new (0, $49168e685ea38e19$export$2e2bcd8739ae039)()) {
|
|
1227
|
-
return $0b27779070651c3e$var$__awaiter(this, void 0, void 0, function*() {
|
|
1228
|
-
const cookies = yield (0, $0f113de605a2ef1d$export$a65902517ae87ba8)(cookieSpec, {
|
|
1229
|
-
strategy: strategy
|
|
1230
|
-
});
|
|
1231
|
-
return cookies.length > 0 ? (0, $8227023f453bcf31$export$9abc0a414b0d8b8f)(cookies) : "";
|
|
1232
|
-
});
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
// noinspection JSUnusedGlobalSymbols,ExceptionCaughtLocallyJS
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
function $bd973abb63c1ed35$export$f266452a5050185d(url) {
|
|
1244
|
-
if (!url || url === "") return [];
|
|
1245
|
-
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
1246
|
-
const hostnameParts = urlObj.hostname.split(".");
|
|
1247
|
-
const topLevelDomain = hostnameParts.slice(-2).join(".");
|
|
1248
|
-
const cookieSpecs = [
|
|
1249
|
-
{
|
|
1250
|
-
name: "%",
|
|
1251
|
-
domain: `%.${topLevelDomain}`
|
|
1252
|
-
},
|
|
1253
|
-
{
|
|
1254
|
-
name: "%",
|
|
1255
|
-
domain: urlObj.hostname
|
|
1256
|
-
},
|
|
1257
|
-
{
|
|
1258
|
-
name: "%",
|
|
1259
|
-
domain: topLevelDomain
|
|
1260
|
-
}
|
|
1261
|
-
];
|
|
1262
|
-
return (0, $6B8p2$uniqBy)(cookieSpecs, JSON.stringify);
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
var $7d6c43a28f2485bc$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
1268
|
-
function adopt(value) {
|
|
1269
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
1270
|
-
resolve(value);
|
|
1271
|
-
});
|
|
1272
|
-
}
|
|
1273
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1274
|
-
function fulfilled(value) {
|
|
1275
|
-
try {
|
|
1276
|
-
step(generator.next(value));
|
|
1277
|
-
} catch (e) {
|
|
1278
|
-
reject(e);
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
function rejected(value) {
|
|
1282
|
-
try {
|
|
1283
|
-
step(generator["throw"](value));
|
|
1284
|
-
} catch (e) {
|
|
1285
|
-
reject(e);
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
function step(result) {
|
|
1289
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1290
|
-
}
|
|
1291
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1292
|
-
});
|
|
1293
|
-
};
|
|
1294
|
-
if (typeof (0, $6B8p2$fetch) !== "function") throw new Error("fetch is not a function");
|
|
1295
|
-
function $7d6c43a28f2485bc$var$constructUserAgent(platform = "Macintosh; Intel Mac OS X 10_15_7", engine = "AppleWebKit/537.36 (KHTML, like Gecko)", browser = "Chrome/118.0.0.0", layout = "Safari/537.36") {
|
|
1296
|
-
return [
|
|
1297
|
-
platform,
|
|
1298
|
-
engine,
|
|
1299
|
-
browser,
|
|
1300
|
-
layout
|
|
1301
|
-
].join(" ");
|
|
1302
|
-
}
|
|
1303
|
-
const $7d6c43a28f2485bc$var$userAgent = $7d6c43a28f2485bc$var$constructUserAgent();
|
|
1304
|
-
function $7d6c43a28f2485bc$export$b24a545a0b39f491(url, options = {}, fetch = (0, $6B8p2$fetch), originalRequest) {
|
|
1305
|
-
var _a;
|
|
1306
|
-
return $7d6c43a28f2485bc$var$__awaiter(this, void 0, void 0, function*() {
|
|
1307
|
-
if (typeof fetch !== "function") {
|
|
1308
|
-
const message = "fetch is not a function";
|
|
1309
|
-
(0, $6B8p2$consola).error(message);
|
|
1310
|
-
throw new Error(message);
|
|
1311
|
-
}
|
|
1312
|
-
const originalRequest1 = originalRequest || {
|
|
1313
|
-
url: url,
|
|
1314
|
-
options: options
|
|
1315
|
-
};
|
|
1316
|
-
const headers = {
|
|
1317
|
-
"User-Agent": $7d6c43a28f2485bc$var$userAgent
|
|
1318
|
-
};
|
|
1319
|
-
const defaultOptions = {
|
|
1320
|
-
headers: headers,
|
|
1321
|
-
redirect: "manual"
|
|
1322
|
-
};
|
|
1323
|
-
const url2 = `${url}`;
|
|
1324
|
-
const url1 = new URL(url2);
|
|
1325
|
-
(0, $6B8p2$consola).start("fetchWithCookies", url2);
|
|
1326
|
-
const cookieSpecs = (0, $bd973abb63c1ed35$export$f266452a5050185d)(url1);
|
|
1327
|
-
const renderedCookie = yield (0, $0b27779070651c3e$export$cfc0723de5712e57)(cookieSpecs).catch((err)=>{
|
|
1328
|
-
(0, $6B8p2$consola).error(err);
|
|
1329
|
-
return "";
|
|
1330
|
-
});
|
|
1331
|
-
if (renderedCookie) headers["Cookie"] = renderedCookie;
|
|
1332
|
-
else (0, $6B8p2$consola).info("No cookies found for this request");
|
|
1333
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b)["dump-request-headers"]) {
|
|
1334
|
-
(0, $6B8p2$consola).info("Request URL:", url1.href);
|
|
1335
|
-
(0, $6B8p2$consola).info("Request headers:", headers);
|
|
1336
|
-
}
|
|
1337
|
-
const newOptions1 = (0, $6B8p2$merge)(defaultOptions, {
|
|
1338
|
-
headers: headers
|
|
1339
|
-
}, options);
|
|
1340
|
-
try {
|
|
1341
|
-
const res = yield fetch(url1, newOptions1);
|
|
1342
|
-
// noinspection JSMismatchedCollectionQueryUpdate
|
|
1343
|
-
const headers = [];
|
|
1344
|
-
res.headers.forEach((value, key)=>{
|
|
1345
|
-
headers.push([
|
|
1346
|
-
key,
|
|
1347
|
-
value
|
|
1348
|
-
]);
|
|
1349
|
-
});
|
|
1350
|
-
// for (const [key, value] of headers) {
|
|
1351
|
-
// if (key === "set-cookie") {
|
|
1352
|
-
// const cookieJar1 = await cookieJarPromise;
|
|
1353
|
-
// await cookieJar1.setCookie(value, url2);
|
|
1354
|
-
// if (parsedArgs.verbose) {
|
|
1355
|
-
// console.log(blue(`Set-Cookie:`), yellow(value), yellow(url2));
|
|
1356
|
-
// }
|
|
1357
|
-
// }
|
|
1358
|
-
// }
|
|
1359
|
-
const newUrl = (_a = res.headers.get("location")) !== null && _a !== void 0 ? _a : res.url;
|
|
1360
|
-
// const sameHost = new URL(newUrl).host === url1.host;
|
|
1361
|
-
if (res.status == 301 || res.status == 302) // follow the redirect
|
|
1362
|
-
{
|
|
1363
|
-
if (newUrl && newUrl !== url2) {
|
|
1364
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose || (0, $01f4cf98d50740c6$export$c348dfaf65040d9b)["dump-response-headers"]) (0, $6B8p2$consola).info(`Redirected to `, newUrl);
|
|
1365
|
-
return $7d6c43a28f2485bc$export$b24a545a0b39f491(//
|
|
1366
|
-
newUrl, newOptions1, fetch, originalRequest1);
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
|
-
if (res.status == 303 && newUrl && newUrl !== url2) {
|
|
1370
|
-
// follow the redirect with GET
|
|
1371
|
-
let newOptions2 = {};
|
|
1372
|
-
switch(newOptions1.method){
|
|
1373
|
-
case "POST":
|
|
1374
|
-
case "PUT":
|
|
1375
|
-
case "DELETE":
|
|
1376
|
-
(0, $6B8p2$merge)(newOptions2, newOptions1, {
|
|
1377
|
-
method: "GET"
|
|
1378
|
-
});
|
|
1379
|
-
newOptions2.body = undefined; // TODO: is this needed?
|
|
1380
|
-
break;
|
|
1381
|
-
case "HEAD":
|
|
1382
|
-
case "GET":
|
|
1383
|
-
(0, $6B8p2$merge)(newOptions2, newOptions1);
|
|
1384
|
-
newOptions2.body = undefined; // TODO: is this needed?
|
|
1385
|
-
break;
|
|
1386
|
-
default:
|
|
1387
|
-
(0, $6B8p2$merge)(newOptions2, newOptions1);
|
|
1388
|
-
break;
|
|
1389
|
-
}
|
|
1390
|
-
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log(`Redirected to `, newUrl);
|
|
1391
|
-
return $7d6c43a28f2485bc$export$b24a545a0b39f491(//
|
|
1392
|
-
newUrl, newOptions2, fetch, originalRequest1);
|
|
1393
|
-
}
|
|
1394
|
-
// all deserialize functions will use the arraybuffer
|
|
1395
|
-
const arrayBufferPromise = res.arrayBuffer();
|
|
1396
|
-
const bufferPromise = arrayBufferPromise.then(Buffer.from);
|
|
1397
|
-
function arrayBuffer() {
|
|
1398
|
-
return $7d6c43a28f2485bc$var$__awaiter(this, void 0, void 0, function*() {
|
|
1399
|
-
return arrayBufferPromise;
|
|
1400
|
-
});
|
|
1401
|
-
}
|
|
1402
|
-
function buffer() {
|
|
1403
|
-
return $7d6c43a28f2485bc$var$__awaiter(this, void 0, void 0, function*() {
|
|
1404
|
-
return bufferPromise;
|
|
1405
|
-
});
|
|
1406
|
-
}
|
|
1407
|
-
function text() {
|
|
1408
|
-
return $7d6c43a28f2485bc$var$__awaiter(this, void 0, void 0, function*() {
|
|
1409
|
-
const buffer1 = yield bufferPromise;
|
|
1410
|
-
return buffer1.toString("utf8");
|
|
1411
|
-
});
|
|
1412
|
-
}
|
|
1413
|
-
function json() {
|
|
1414
|
-
return $7d6c43a28f2485bc$var$__awaiter(this, void 0, void 0, function*() {
|
|
1415
|
-
const text1 = yield text();
|
|
1416
|
-
return (0, $6B8p2$destr)(text1);
|
|
1417
|
-
});
|
|
1418
|
-
}
|
|
1419
|
-
function formData() {
|
|
1420
|
-
return $7d6c43a28f2485bc$var$__awaiter(this, void 0, void 0, function*() {
|
|
1421
|
-
const urlSearchParams = yield text().then((text)=>new URLSearchParams(text));
|
|
1422
|
-
const formData = new FormData();
|
|
1423
|
-
for (const [key, value] of urlSearchParams.entries())formData.append(key, value);
|
|
1424
|
-
return formData;
|
|
1425
|
-
});
|
|
1426
|
-
}
|
|
1427
|
-
const res1 = res;
|
|
1428
|
-
const source2 = {
|
|
1429
|
-
arrayBuffer: arrayBuffer,
|
|
1430
|
-
text: text,
|
|
1431
|
-
json: json,
|
|
1432
|
-
buffer: buffer,
|
|
1433
|
-
formData: formData
|
|
1434
|
-
};
|
|
1435
|
-
return (0, $6B8p2$merge)(res1, source2);
|
|
1436
|
-
} catch (e) {
|
|
1437
|
-
throw e;
|
|
1438
|
-
}
|
|
1439
|
-
});
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
export {$3a892f71b64103f5$export$4be65e66cfa2648a as getCookie, $c23eafaef8340cc3$export$e5637297e9eb6f2e as getChromeCookie, $bea34252b8e17f8d$export$c44c5fdef43f0941 as getFirefoxCookie, $0b27779070651c3e$export$cfc0723de5712e57 as getMergedRenderedCookies, $9bb85405e96c1fbc$export$4d2e9997e2c23417 as getGroupedRenderedCookies, $7d6c43a28f2485bc$export$b24a545a0b39f491 as fetchWithCookies};
|
|
1446
|
-
//# sourceMappingURL=module.js.map
|