@mherod/get-cookie 2.0.0-rc.21 → 2.0.0-rc.23
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 +12 -0
- package/.prettierrc +12 -0
- package/dist/cli.js +299 -247
- package/dist/index.js +263 -247
- package/dist/index.js.map +1 -1
- package/dist/module.js +261 -223
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +5 -4
- package/dist/types.d.ts.map +1 -1
- package/package-lock.json +632 -29
- package/package.json +10 -6
- package/src/cli.ts +23 -22
- package/src/index.ts +0 -4
- package/src/logger.ts +3 -0
- package/.prettierrc.json +0 -1
package/dist/module.js
CHANGED
|
@@ -14,19 +14,26 @@ import $6B8p2$jsonwebtoken from "jsonwebtoken";
|
|
|
14
14
|
import {fetch as $6B8p2$fetch} from "cross-fetch";
|
|
15
15
|
import $6B8p2$useragents from "user-agents";
|
|
16
16
|
|
|
17
|
+
function $parcel$export(e, n, v, s) {
|
|
18
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
19
|
+
}
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
|
|
20
|
-
const $
|
|
21
|
-
const $
|
|
22
|
-
const $
|
|
23
|
+
const $01f4cf98d50740c6$export$6f4ae1207c703045 = process.argv ?? [];
|
|
24
|
+
const $01f4cf98d50740c6$var$minimistArgs = (0, $6B8p2$minimist)($01f4cf98d50740c6$export$6f4ae1207c703045.slice(2));
|
|
25
|
+
const $01f4cf98d50740c6$var$defaultOptions = {
|
|
23
26
|
verbose: false
|
|
24
27
|
};
|
|
25
|
-
const $
|
|
28
|
+
const $01f4cf98d50740c6$export$c348dfaf65040d9b = (0, $6B8p2$merge)($01f4cf98d50740c6$var$defaultOptions, $01f4cf98d50740c6$var$minimistArgs);
|
|
29
|
+
|
|
26
30
|
|
|
31
|
+
var $49168e685ea38e19$exports = {};
|
|
27
32
|
|
|
33
|
+
$parcel$export($49168e685ea38e19$exports, "default", () => $49168e685ea38e19$export$2e2bcd8739ae039, (v) => $49168e685ea38e19$export$2e2bcd8739ae039 = v);
|
|
34
|
+
// noinspection JSUnusedGlobalSymbols
|
|
28
35
|
|
|
29
|
-
async function $
|
|
36
|
+
async function $7a8c6b6f0e26a266$export$8d71c74f97c0202e(command) {
|
|
30
37
|
return new Promise((resolve, reject)=>{
|
|
31
38
|
(0, $6B8p2$exec)(command, {
|
|
32
39
|
encoding: "binary",
|
|
@@ -47,23 +54,23 @@ async function $5487dc2a77024e5b$export$8d71c74f97c0202e(command) {
|
|
|
47
54
|
|
|
48
55
|
|
|
49
56
|
|
|
50
|
-
const $
|
|
51
|
-
(0, $6B8p2$merge)($
|
|
52
|
-
const $
|
|
53
|
-
if (!$
|
|
57
|
+
const $ebc8f9a71f429261$export$a7b6bc01c63cdfc3 = {};
|
|
58
|
+
(0, $6B8p2$merge)($ebc8f9a71f429261$export$a7b6bc01c63cdfc3, process.env);
|
|
59
|
+
const $ebc8f9a71f429261$export$a7c5707626fc90f = $ebc8f9a71f429261$export$a7b6bc01c63cdfc3["HOME"];
|
|
60
|
+
if (!$ebc8f9a71f429261$export$a7c5707626fc90f) throw new Error("HOME environment variable is not set");
|
|
54
61
|
|
|
55
62
|
|
|
56
63
|
|
|
57
64
|
|
|
58
65
|
|
|
59
|
-
async function $
|
|
66
|
+
async function $a6c1a5673fde1c2b$export$2c9faf86071156ae({ path: path , name: name , maxDepth: maxDepth = 2 }) {
|
|
60
67
|
const rootSegments = path.split("/").length;
|
|
61
68
|
const files = [];
|
|
62
69
|
let readdirSync;
|
|
63
70
|
try {
|
|
64
71
|
readdirSync = $6B8p2$readdirSync(path);
|
|
65
72
|
} catch (e) {
|
|
66
|
-
if ((0, $
|
|
73
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log(`Error reading ${path}`, e);
|
|
67
74
|
return [];
|
|
68
75
|
}
|
|
69
76
|
for (const file of readdirSync){
|
|
@@ -72,23 +79,23 @@ async function $5ddc6ac5caa391cf$export$2c9faf86071156ae({ path: path , name: na
|
|
|
72
79
|
try {
|
|
73
80
|
stat = $6B8p2$statSync(filePath);
|
|
74
81
|
} catch (e1) {
|
|
75
|
-
if ((0, $
|
|
82
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.error(`Error getting stat for ${filePath}`, e1);
|
|
76
83
|
continue;
|
|
77
84
|
}
|
|
78
85
|
if (stat.isDirectory()) {
|
|
79
86
|
if (filePath.split("/").length < rootSegments + maxDepth) try {
|
|
80
|
-
const subFiles = await $
|
|
87
|
+
const subFiles = await $a6c1a5673fde1c2b$export$2c9faf86071156ae({
|
|
81
88
|
path: filePath,
|
|
82
89
|
name: name,
|
|
83
90
|
maxDepth: 2
|
|
84
91
|
});
|
|
85
92
|
files.push(...subFiles);
|
|
86
93
|
} catch (e2) {
|
|
87
|
-
if ((0, $
|
|
94
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.error(e2);
|
|
88
95
|
}
|
|
89
96
|
} else if (file === name) files.push(filePath);
|
|
90
97
|
}
|
|
91
|
-
if ((0, $
|
|
98
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) {
|
|
92
99
|
if (files.length > 0) {
|
|
93
100
|
console.log(`Found ${files.length} ${name} files`);
|
|
94
101
|
console.log(files);
|
|
@@ -101,17 +108,17 @@ async function $5ddc6ac5caa391cf$export$2c9faf86071156ae({ path: path , name: na
|
|
|
101
108
|
|
|
102
109
|
|
|
103
110
|
|
|
104
|
-
function $
|
|
111
|
+
function $63d6ce571e62efc6$export$bc926c43858bd3cb(obj) {
|
|
105
112
|
return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;
|
|
106
113
|
}
|
|
107
114
|
|
|
108
115
|
|
|
109
|
-
function $
|
|
116
|
+
function $2c20f7c9c363469f$export$963c8d651337e4a4(obj) {
|
|
110
117
|
return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;
|
|
111
118
|
}
|
|
112
119
|
|
|
113
120
|
|
|
114
|
-
function $
|
|
121
|
+
function $78efb18fcf7b6c2c$export$4eadcf0bf35a2ddb(s) {
|
|
115
122
|
const s1 = s.replaceAll(/\./gi, ".");
|
|
116
123
|
const s2 = s1.replace(/%/g, ".*");
|
|
117
124
|
const s3 = s2.replace(/\*/g, ".*");
|
|
@@ -121,60 +128,62 @@ function $8a525b77a45adb9e$export$4eadcf0bf35a2ddb(s) {
|
|
|
121
128
|
|
|
122
129
|
|
|
123
130
|
|
|
124
|
-
class $
|
|
125
|
-
|
|
131
|
+
class $a6f61760d01c3afd$export$2e2bcd8739ae039 {
|
|
132
|
+
constructor(){
|
|
133
|
+
this.browserName = "Chrome";
|
|
134
|
+
}
|
|
126
135
|
async queryCookies(name, domain) {
|
|
127
136
|
if (process.platform !== "darwin") throw new Error("This only works on macOS");
|
|
128
|
-
if ((0, $
|
|
129
|
-
return $
|
|
137
|
+
if ((0, $ebc8f9a71f429261$export$a7b6bc01c63cdfc3).FIREFOX_ONLY) return [];
|
|
138
|
+
return $a6f61760d01c3afd$var$getChromeCookies({
|
|
130
139
|
requireJwt: false,
|
|
131
140
|
name: name,
|
|
132
141
|
domain: domain
|
|
133
142
|
});
|
|
134
143
|
}
|
|
135
144
|
}
|
|
136
|
-
async function $
|
|
145
|
+
async function $a6f61760d01c3afd$var$getPromise1(name, domain, file) {
|
|
137
146
|
try {
|
|
138
|
-
return await $
|
|
147
|
+
return await $a6f61760d01c3afd$var$getEncryptedChromeCookie({
|
|
139
148
|
name: name,
|
|
140
149
|
domain: domain,
|
|
141
150
|
file: file
|
|
142
151
|
});
|
|
143
152
|
} catch (e) {
|
|
144
|
-
if ((0, $
|
|
153
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("Error getting encrypted cookie", e);
|
|
145
154
|
return [];
|
|
146
155
|
}
|
|
147
156
|
}
|
|
148
|
-
async function $
|
|
157
|
+
async function $a6f61760d01c3afd$var$getPromise(name, domain) {
|
|
149
158
|
try {
|
|
150
|
-
const files = await (0, $
|
|
151
|
-
path: $
|
|
159
|
+
const files = await (0, $a6c1a5673fde1c2b$export$2c9faf86071156ae)({
|
|
160
|
+
path: $a6f61760d01c3afd$var$chromeLocal,
|
|
152
161
|
name: "Cookies"
|
|
153
162
|
});
|
|
154
|
-
const promises = files.map((file)=>$
|
|
163
|
+
const promises = files.map((file)=>$a6f61760d01c3afd$var$getPromise1(name, domain, file));
|
|
155
164
|
const results1 = await Promise.all(promises);
|
|
156
|
-
return results1.flat().filter((0, $
|
|
165
|
+
return results1.flat().filter((0, $63d6ce571e62efc6$export$bc926c43858bd3cb));
|
|
157
166
|
} catch (error) {
|
|
158
|
-
if ((0, $
|
|
167
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("error", error);
|
|
159
168
|
return [];
|
|
160
169
|
}
|
|
161
170
|
}
|
|
162
|
-
async function $
|
|
171
|
+
async function $a6f61760d01c3afd$var$decryptValue(password, encryptedValue) {
|
|
163
172
|
let d;
|
|
164
173
|
try {
|
|
165
|
-
d = await $
|
|
174
|
+
d = await $a6f61760d01c3afd$var$decrypt(password, encryptedValue);
|
|
166
175
|
} catch (e) {
|
|
167
|
-
if ((0, $
|
|
176
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("Error decrypting cookie", e);
|
|
168
177
|
d = null;
|
|
169
178
|
}
|
|
170
179
|
return d ?? encryptedValue.toString("utf-8");
|
|
171
180
|
}
|
|
172
|
-
async function $
|
|
173
|
-
const encryptedDataItems = await $
|
|
174
|
-
const password = await $
|
|
181
|
+
async function $a6f61760d01c3afd$var$getChromeCookies({ name: name , domain: domain = "%" , requireJwt: requireJwt = false }) {
|
|
182
|
+
const encryptedDataItems = await $a6f61760d01c3afd$var$getPromise(name, domain);
|
|
183
|
+
const password = await $a6f61760d01c3afd$var$getChromePassword();
|
|
175
184
|
const decrypted = encryptedDataItems.filter(({ value: value })=>value != null && value.length > 0).map(async (cookieRow)=>{
|
|
176
185
|
const encryptedValue = cookieRow.value;
|
|
177
|
-
const decryptedValue = await $
|
|
186
|
+
const decryptedValue = await $a6f61760d01c3afd$var$decryptValue(password, encryptedValue);
|
|
178
187
|
const meta = {};
|
|
179
188
|
(0, $6B8p2$merge)(meta, cookieRow.meta ?? {});
|
|
180
189
|
const exportedCookie = {
|
|
@@ -192,14 +201,14 @@ async function $245d30db16a07938$var$getChromeCookies({ name: name , domain: dom
|
|
|
192
201
|
(0, $6B8p2$merge)(exportedCookie, mergeExpiry);
|
|
193
202
|
return exportedCookie;
|
|
194
203
|
});
|
|
195
|
-
const results = (await Promise.all(decrypted)).filter((0, $
|
|
196
|
-
if ((0, $
|
|
204
|
+
const results = (await Promise.all(decrypted)).filter((0, $2c20f7c9c363469f$export$963c8d651337e4a4));
|
|
205
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("results", results);
|
|
197
206
|
return results;
|
|
198
207
|
}
|
|
199
|
-
const $
|
|
200
|
-
async function $
|
|
208
|
+
const $a6f61760d01c3afd$var$chromeLocal = $6B8p2$join((0, $ebc8f9a71f429261$export$a7c5707626fc90f), "Library", "Application Support", "Google", "Chrome");
|
|
209
|
+
async function $a6f61760d01c3afd$var$getEncryptedChromeCookie({ name: name , domain: domain , file: file = $6B8p2$join($a6f61760d01c3afd$var$chromeLocal, "Default", "Cookies") }) {
|
|
201
210
|
if (!(0, $6B8p2$existsSync)(file)) throw new Error(`File ${file} does not exist`);
|
|
202
|
-
if ((0, $
|
|
211
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) {
|
|
203
212
|
const s = file.split("/").slice(-3).join("/");
|
|
204
213
|
console.log(`Trying Chrome (at ${s}) cookie ${name} for domain ${domain}`);
|
|
205
214
|
}
|
|
@@ -225,9 +234,9 @@ async function $245d30db16a07938$var$getEncryptedChromeCookie({ name: name , dom
|
|
|
225
234
|
sql += `host_key LIKE '${sqlEmbedDomain}';`;
|
|
226
235
|
}
|
|
227
236
|
}
|
|
228
|
-
if ((0, $
|
|
229
|
-
const domainRegexp = (0, $
|
|
230
|
-
const sqliteQuery1 = await $
|
|
237
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("sql", sql);
|
|
238
|
+
const domainRegexp = (0, $78efb18fcf7b6c2c$export$4eadcf0bf35a2ddb)(domain);
|
|
239
|
+
const sqliteQuery1 = await $a6f61760d01c3afd$export$bd52b72df8d0d261({
|
|
231
240
|
file: file,
|
|
232
241
|
sql: sql,
|
|
233
242
|
rowFilter: (row)=>{
|
|
@@ -240,7 +249,7 @@ async function $245d30db16a07938$var$getEncryptedChromeCookie({ name: name , dom
|
|
|
240
249
|
name: row["name"],
|
|
241
250
|
value: row["encrypted_value"]
|
|
242
251
|
};
|
|
243
|
-
if ((0, $
|
|
252
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("CookieRow", cookieRow);
|
|
244
253
|
return cookieRow;
|
|
245
254
|
}
|
|
246
255
|
});
|
|
@@ -248,10 +257,10 @@ async function $245d30db16a07938$var$getEncryptedChromeCookie({ name: name , dom
|
|
|
248
257
|
return row.domain.match(domainRegexp) != null;
|
|
249
258
|
});
|
|
250
259
|
}
|
|
251
|
-
async function $
|
|
252
|
-
return (0, $
|
|
260
|
+
async function $a6f61760d01c3afd$var$getChromePassword() {
|
|
261
|
+
return (0, $7a8c6b6f0e26a266$export$8d71c74f97c0202e)('security find-generic-password -w -s "Chrome Safe Storage"');
|
|
253
262
|
}
|
|
254
|
-
async function $
|
|
263
|
+
async function $a6f61760d01c3afd$var$decrypt(password, encryptedData) {
|
|
255
264
|
if (typeof password !== "string") throw new Error("password must be a string: " + password);
|
|
256
265
|
let encryptedData1;
|
|
257
266
|
encryptedData1 = encryptedData;
|
|
@@ -259,21 +268,21 @@ async function $245d30db16a07938$var$decrypt(password, encryptedData) {
|
|
|
259
268
|
if (!(encryptedData1 instanceof Buffer)) {
|
|
260
269
|
if (Array.isArray(encryptedData1) && encryptedData1[0] instanceof Buffer) {
|
|
261
270
|
[encryptedData1] = encryptedData1;
|
|
262
|
-
if ((0, $
|
|
271
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log(`encryptedData is an array of buffers, selected first: ${encryptedData1}`);
|
|
263
272
|
} else throw new Error("encryptedData must be a Buffer: " + encryptedData1);
|
|
264
273
|
encryptedData1 = Buffer.from(encryptedData1);
|
|
265
274
|
}
|
|
266
|
-
if ((0, $
|
|
275
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log(`Trying to decrypt with password ${password}`);
|
|
267
276
|
return new Promise((resolve, reject)=>{
|
|
268
277
|
$6B8p2$pbkdf2(password, "saltysalt", 1003, 16, "sha1", (error, buffer)=>{
|
|
269
278
|
try {
|
|
270
279
|
if (error) {
|
|
271
|
-
if ((0, $
|
|
280
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2", error);
|
|
272
281
|
reject(error);
|
|
273
282
|
return;
|
|
274
283
|
}
|
|
275
284
|
if (buffer.length !== 16) {
|
|
276
|
-
if ((0, $
|
|
285
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2, buffer length is not 16", buffer.length);
|
|
277
286
|
reject(new Error("Buffer length is not 16"));
|
|
278
287
|
return;
|
|
279
288
|
}
|
|
@@ -283,7 +292,7 @@ async function $245d30db16a07938$var$decrypt(password, encryptedData) {
|
|
|
283
292
|
decipher.setAutoPadding(false);
|
|
284
293
|
if (encryptedData1 && encryptedData1.slice) encryptedData1 = encryptedData1.slice(3);
|
|
285
294
|
if (encryptedData1.length % 16 !== 0) {
|
|
286
|
-
if ((0, $
|
|
295
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2, encryptedData length is not a multiple of 16", encryptedData1.length);
|
|
287
296
|
reject(new Error("encryptedData length is not a multiple of 16"));
|
|
288
297
|
return;
|
|
289
298
|
}
|
|
@@ -291,7 +300,7 @@ async function $245d30db16a07938$var$decrypt(password, encryptedData) {
|
|
|
291
300
|
try {
|
|
292
301
|
decipher.final("utf-8");
|
|
293
302
|
} catch (e) {
|
|
294
|
-
if ((0, $
|
|
303
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("Error doing decipher.final()", e);
|
|
295
304
|
reject(e);
|
|
296
305
|
return;
|
|
297
306
|
}
|
|
@@ -306,7 +315,7 @@ async function $245d30db16a07938$var$decrypt(password, encryptedData) {
|
|
|
306
315
|
});
|
|
307
316
|
});
|
|
308
317
|
}
|
|
309
|
-
async function $
|
|
318
|
+
async function $a6f61760d01c3afd$export$bd52b72df8d0d261({ file: file , sql: sql , rowFilter: rowFilter = ()=>true , rowTransform: rowTransform }) {
|
|
310
319
|
if (!file || file && !(0, $6B8p2$fs).existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
|
|
311
320
|
const db = new $6B8p2$Database(file);
|
|
312
321
|
return new Promise((resolve, reject)=>{
|
|
@@ -333,7 +342,7 @@ async function $245d30db16a07938$export$bd52b72df8d0d261({ file: file , sql: sql
|
|
|
333
342
|
resolve(cookieRows);
|
|
334
343
|
return;
|
|
335
344
|
}
|
|
336
|
-
if ((0, $
|
|
345
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
|
|
337
346
|
resolve([
|
|
338
347
|
rows1
|
|
339
348
|
]);
|
|
@@ -342,11 +351,15 @@ async function $245d30db16a07938$export$bd52b72df8d0d261({ file: file , sql: sql
|
|
|
342
351
|
}
|
|
343
352
|
|
|
344
353
|
|
|
354
|
+
var $62dcb7ce199205be$exports = {};
|
|
355
|
+
|
|
356
|
+
$parcel$export($62dcb7ce199205be$exports, "doSqliteQuery1", () => $62dcb7ce199205be$export$f19f611d1fa7c6f3, (v) => $62dcb7ce199205be$export$f19f611d1fa7c6f3 = v);
|
|
357
|
+
$parcel$export($62dcb7ce199205be$exports, "default", () => $62dcb7ce199205be$export$2e2bcd8739ae039, (v) => $62dcb7ce199205be$export$2e2bcd8739ae039 = v);
|
|
345
358
|
|
|
346
359
|
|
|
347
360
|
|
|
348
361
|
|
|
349
|
-
function $
|
|
362
|
+
function $81d2f9cb974d13de$export$da22813e5a2ec500({ name: name , domain: domain }) {
|
|
350
363
|
const wildcardRegexp = /^([*%])$/i;
|
|
351
364
|
return {
|
|
352
365
|
specifiedName: name.match(wildcardRegexp) == null,
|
|
@@ -358,7 +371,13 @@ function $043534331646fe99$export$da22813e5a2ec500({ name: name , domain: domain
|
|
|
358
371
|
|
|
359
372
|
|
|
360
373
|
|
|
361
|
-
|
|
374
|
+
var $62dcb7ce199205be$var$__classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
375
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
376
|
+
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");
|
|
377
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
378
|
+
};
|
|
379
|
+
var $62dcb7ce199205be$var$_FirefoxCookieQueryStrategy_instances, $62dcb7ce199205be$var$_FirefoxCookieQueryStrategy_getFirefoxCookie, $62dcb7ce199205be$var$_FirefoxCookieQueryStrategy_queryCookiesDb;
|
|
380
|
+
async function $62dcb7ce199205be$export$f19f611d1fa7c6f3({ file: file , sql: sql , rowTransform: rowTransform }) {
|
|
362
381
|
if (!file || file && !(0, $6B8p2$fs).existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
|
|
363
382
|
const db = new $6B8p2$Database(file);
|
|
364
383
|
return new Promise((resolve, reject)=>{
|
|
@@ -385,20 +404,23 @@ async function $ded29c0fa27637d3$export$f19f611d1fa7c6f3({ file: file , sql: sql
|
|
|
385
404
|
resolve(cookieRows);
|
|
386
405
|
return;
|
|
387
406
|
}
|
|
388
|
-
if ((0, $
|
|
407
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
|
|
389
408
|
resolve([
|
|
390
409
|
rows1
|
|
391
410
|
]);
|
|
392
411
|
});
|
|
393
412
|
});
|
|
394
413
|
}
|
|
395
|
-
class $
|
|
396
|
-
|
|
414
|
+
class $62dcb7ce199205be$export$2e2bcd8739ae039 {
|
|
415
|
+
constructor(){
|
|
416
|
+
$62dcb7ce199205be$var$_FirefoxCookieQueryStrategy_instances.add(this);
|
|
417
|
+
this.browserName = "Firefox";
|
|
418
|
+
}
|
|
397
419
|
async queryCookies(name, domain) {
|
|
398
420
|
if (process.platform !== "darwin") // TODO: implement
|
|
399
421
|
return [];
|
|
400
|
-
if ((0, $
|
|
401
|
-
const cookies = await this
|
|
422
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).browser !== "firefox") return [];
|
|
423
|
+
const cookies = await $62dcb7ce199205be$var$__classPrivateFieldGet(this, $62dcb7ce199205be$var$_FirefoxCookieQueryStrategy_instances, "m", $62dcb7ce199205be$var$_FirefoxCookieQueryStrategy_getFirefoxCookie).call(this, {
|
|
402
424
|
name: name,
|
|
403
425
|
domain: domain
|
|
404
426
|
});
|
|
@@ -411,61 +433,62 @@ class $ded29c0fa27637d3$export$2e2bcd8739ae039 {
|
|
|
411
433
|
});
|
|
412
434
|
else return [];
|
|
413
435
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
}
|
|
442
|
-
if (specifiedDomain) sql += `host LIKE '${domain1}';`;
|
|
436
|
+
}
|
|
437
|
+
$62dcb7ce199205be$var$_FirefoxCookieQueryStrategy_instances = new WeakSet(), $62dcb7ce199205be$var$_FirefoxCookieQueryStrategy_getFirefoxCookie = async function _FirefoxCookieQueryStrategy_getFirefoxCookie({ name: name , domain: domain } //
|
|
438
|
+
) {
|
|
439
|
+
const files = await (0, $a6c1a5673fde1c2b$export$2c9faf86071156ae)({
|
|
440
|
+
path: $6B8p2$join((0, $ebc8f9a71f429261$export$a7c5707626fc90f), "Library", "Application Support", "Firefox", "Profiles"),
|
|
441
|
+
name: "cookies.sqlite"
|
|
442
|
+
});
|
|
443
|
+
const fn = async (file)=>{
|
|
444
|
+
return await $62dcb7ce199205be$var$__classPrivateFieldGet(this, $62dcb7ce199205be$var$_FirefoxCookieQueryStrategy_instances, "m", $62dcb7ce199205be$var$_FirefoxCookieQueryStrategy_queryCookiesDb).call(this, file, name, domain);
|
|
445
|
+
};
|
|
446
|
+
const all = await Promise.all(files.map(fn));
|
|
447
|
+
// flatten
|
|
448
|
+
return all.flat();
|
|
449
|
+
}, $62dcb7ce199205be$var$_FirefoxCookieQueryStrategy_queryCookiesDb = async function _FirefoxCookieQueryStrategy_queryCookiesDb(file, name, domain) {
|
|
450
|
+
if (file && !(0, $6B8p2$existsSync)(file)) throw new Error(`File ${file} does not exist`);
|
|
451
|
+
let sql;
|
|
452
|
+
//language=SQL
|
|
453
|
+
sql = "SELECT value, name, host FROM moz_cookies";
|
|
454
|
+
const { specifiedName: specifiedName , specifiedDomain: specifiedDomain } = (0, $81d2f9cb974d13de$export$da22813e5a2ec500)({
|
|
455
|
+
name: name,
|
|
456
|
+
domain: domain
|
|
457
|
+
});
|
|
458
|
+
if (specifiedName || specifiedDomain) {
|
|
459
|
+
sql += ` WHERE `;
|
|
460
|
+
if (specifiedName) {
|
|
461
|
+
sql += `name = '${name}'`;
|
|
462
|
+
if (specifiedDomain) sql += ` AND `;
|
|
443
463
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
464
|
+
if (specifiedDomain) sql += `host LIKE '${domain}';`;
|
|
465
|
+
}
|
|
466
|
+
const rowTransform = (row)=>{
|
|
467
|
+
// row is object key by column name
|
|
468
|
+
const value = row.value;
|
|
469
|
+
return {
|
|
470
|
+
domain: row.domain,
|
|
471
|
+
name: row.name,
|
|
472
|
+
value: Buffer.from(value, "utf8")
|
|
452
473
|
};
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
474
|
+
};
|
|
475
|
+
try {
|
|
476
|
+
return await $62dcb7ce199205be$export$f19f611d1fa7c6f3({
|
|
477
|
+
file: file,
|
|
478
|
+
sql: sql,
|
|
479
|
+
rowTransform: rowTransform
|
|
480
|
+
});
|
|
481
|
+
} catch (e) {
|
|
482
|
+
console.error(`Error querying ${file}`, e);
|
|
483
|
+
return [];
|
|
463
484
|
}
|
|
464
|
-
}
|
|
485
|
+
};
|
|
465
486
|
|
|
466
487
|
|
|
467
|
-
class $
|
|
468
|
-
|
|
488
|
+
class $b470ee3b0b06a25e$export$2e2bcd8739ae039 {
|
|
489
|
+
constructor(){
|
|
490
|
+
this.browserName = "Safari";
|
|
491
|
+
}
|
|
469
492
|
async queryCookies(name, domain) {
|
|
470
493
|
// TODO: implement
|
|
471
494
|
return [];
|
|
@@ -474,6 +497,9 @@ class $68ef79184bd02203$export$2e2bcd8739ae039 {
|
|
|
474
497
|
|
|
475
498
|
|
|
476
499
|
|
|
500
|
+
var $cc714734e025a2db$exports = {};
|
|
501
|
+
|
|
502
|
+
$parcel$export($cc714734e025a2db$exports, "default", () => $cc714734e025a2db$export$2e2bcd8739ae039, (v) => $cc714734e025a2db$export$2e2bcd8739ae039 = v);
|
|
477
503
|
|
|
478
504
|
|
|
479
505
|
|
|
@@ -481,11 +507,11 @@ class $68ef79184bd02203$export$2e2bcd8739ae039 {
|
|
|
481
507
|
|
|
482
508
|
|
|
483
509
|
|
|
484
|
-
class $
|
|
485
|
-
synchronous = false;
|
|
486
|
-
tasks = [];
|
|
510
|
+
class $9992049ed060fd67$export$55374e421ca433de extends (0, $6B8p2$Store) {
|
|
487
511
|
constructor(filePath, internalStore = new (0, $6B8p2$MemoryCookieStore)()){
|
|
488
512
|
super();
|
|
513
|
+
this.synchronous = false;
|
|
514
|
+
this.tasks = [];
|
|
489
515
|
this.filePath = filePath;
|
|
490
516
|
this.internalStore = internalStore ?? new (0, $6B8p2$MemoryCookieStore)();
|
|
491
517
|
console.log("Importing cookies from", filePath, internalStore);
|
|
@@ -586,30 +612,39 @@ class $703b18edcf62c952$export$55374e421ca433de extends (0, $6B8p2$Store) {
|
|
|
586
612
|
}
|
|
587
613
|
|
|
588
614
|
|
|
589
|
-
const $
|
|
590
|
-
async function $
|
|
591
|
-
if ((0, $
|
|
592
|
-
const fileCookieStore = new (0, $
|
|
615
|
+
const $77099c72165ec5ea$var$memoryCookieStore = new (0, $6B8p2$MemoryCookieStore)();
|
|
616
|
+
async function $77099c72165ec5ea$var$getCookieStore() {
|
|
617
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b)["cs"] == "memory") return $77099c72165ec5ea$var$memoryCookieStore;
|
|
618
|
+
const fileCookieStore = new (0, $9992049ed060fd67$export$55374e421ca433de)(`${(0, $ebc8f9a71f429261$export$a7b6bc01c63cdfc3)["HOME"]}/cookie-star.json`, $77099c72165ec5ea$var$memoryCookieStore);
|
|
593
619
|
await fileCookieStore.waitUntilIdle();
|
|
594
620
|
return fileCookieStore;
|
|
595
621
|
}
|
|
596
|
-
const $
|
|
597
|
-
$
|
|
622
|
+
const $77099c72165ec5ea$export$2c043f03eceff4e8 = new Promise((resolve)=>{
|
|
623
|
+
$77099c72165ec5ea$var$getCookieStore().then(resolve);
|
|
598
624
|
});
|
|
599
|
-
const $
|
|
600
|
-
$
|
|
625
|
+
const $77099c72165ec5ea$export$eced8873dedbb4c0 = new Promise((resolve)=>{
|
|
626
|
+
$77099c72165ec5ea$export$2c043f03eceff4e8.then((store)=>new (0, $6B8p2$CookieJar)(store)).then(resolve);
|
|
601
627
|
});
|
|
602
628
|
|
|
603
629
|
|
|
604
630
|
|
|
605
|
-
|
|
606
|
-
|
|
631
|
+
var $cc714734e025a2db$var$__classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
632
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
633
|
+
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");
|
|
634
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
635
|
+
};
|
|
636
|
+
var $cc714734e025a2db$var$_CookieStoreQueryStrategy_instances, $cc714734e025a2db$var$_CookieStoreQueryStrategy_extracted, $cc714734e025a2db$var$_CookieStoreQueryStrategy_getCookies, $cc714734e025a2db$var$_CookieStoreQueryStrategy_getAllCookies;
|
|
637
|
+
class $cc714734e025a2db$export$2e2bcd8739ae039 {
|
|
638
|
+
constructor(){
|
|
639
|
+
$cc714734e025a2db$var$_CookieStoreQueryStrategy_instances.add(this);
|
|
640
|
+
this.browserName = "internal";
|
|
641
|
+
}
|
|
607
642
|
async queryCookies(name, domain) {
|
|
608
643
|
const exportedCookies = [];
|
|
609
644
|
// if (name.match(/[%*]/) || domain.match(/[%*]/)) {
|
|
610
|
-
const cookies = await this
|
|
645
|
+
const cookies = await $cc714734e025a2db$var$__classPrivateFieldGet(this, $cc714734e025a2db$var$_CookieStoreQueryStrategy_instances, "m", $cc714734e025a2db$var$_CookieStoreQueryStrategy_getAllCookies).call(this);
|
|
611
646
|
const allExportedCookies = cookies.map((cookie)=>{
|
|
612
|
-
return this
|
|
647
|
+
return $cc714734e025a2db$var$__classPrivateFieldGet(this, $cc714734e025a2db$var$_CookieStoreQueryStrategy_instances, "m", $cc714734e025a2db$var$_CookieStoreQueryStrategy_extracted).call(this, cookie, {
|
|
613
648
|
name: name,
|
|
614
649
|
domain: domain
|
|
615
650
|
});
|
|
@@ -623,9 +658,9 @@ class $6f21bbb0b106370d$export$2e2bcd8739ae039 {
|
|
|
623
658
|
const domain1 = domain.match(/(\w+.+\w+)/gi)?.pop() ?? domain;
|
|
624
659
|
const url = new URL("https://" + domain1);
|
|
625
660
|
url.pathname = path;
|
|
626
|
-
const cookies1 = await this
|
|
661
|
+
const cookies1 = await $cc714734e025a2db$var$__classPrivateFieldGet(this, $cc714734e025a2db$var$_CookieStoreQueryStrategy_instances, "m", $cc714734e025a2db$var$_CookieStoreQueryStrategy_getCookies).call(this, url.href);
|
|
627
662
|
const domainCookies = cookies1.map((cookie)=>{
|
|
628
|
-
return this
|
|
663
|
+
return $cc714734e025a2db$var$__classPrivateFieldGet(this, $cc714734e025a2db$var$_CookieStoreQueryStrategy_instances, "m", $cc714734e025a2db$var$_CookieStoreQueryStrategy_extracted).call(this, cookie, {
|
|
629
664
|
domain: domain,
|
|
630
665
|
name: name
|
|
631
666
|
});
|
|
@@ -633,71 +668,81 @@ class $6f21bbb0b106370d$export$2e2bcd8739ae039 {
|
|
|
633
668
|
exportedCookies.push(...domainCookies);
|
|
634
669
|
}
|
|
635
670
|
if (name == "%") return exportedCookies.filter((cookie)=>{
|
|
636
|
-
return cookie.domain.match((0, $
|
|
671
|
+
return cookie.domain.match((0, $78efb18fcf7b6c2c$export$4eadcf0bf35a2ddb)(domain));
|
|
637
672
|
});
|
|
638
673
|
return exportedCookies.filter((cookie)=>{
|
|
639
|
-
return cookie.name.match((0, $
|
|
674
|
+
return cookie.name.match((0, $78efb18fcf7b6c2c$export$4eadcf0bf35a2ddb)(name)) && cookie.domain.match((0, $78efb18fcf7b6c2c$export$4eadcf0bf35a2ddb)(domain));
|
|
640
675
|
});
|
|
641
676
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
});
|
|
677
|
+
}
|
|
678
|
+
$cc714734e025a2db$var$_CookieStoreQueryStrategy_instances = new WeakSet(), $cc714734e025a2db$var$_CookieStoreQueryStrategy_extracted = function _CookieStoreQueryStrategy_extracted(cookie, cookieSpec) {
|
|
679
|
+
return {
|
|
680
|
+
domain: cookie.domain ?? cookieSpec.domain,
|
|
681
|
+
name: cookie.key ?? cookieSpec.name,
|
|
682
|
+
value: cookie.value,
|
|
683
|
+
expiry: cookie.expires ?? "Infinity",
|
|
684
|
+
meta: {
|
|
685
|
+
file: "tough-cookie"
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
}, $cc714734e025a2db$var$_CookieStoreQueryStrategy_getCookies = async function _CookieStoreQueryStrategy_getCookies(url) {
|
|
689
|
+
const cookieJar = await (0, $77099c72165ec5ea$export$eced8873dedbb4c0);
|
|
690
|
+
return new Promise((resolve, reject)=>{
|
|
691
|
+
return cookieJar.getCookies(url, (err, cookies)=>{
|
|
692
|
+
if (err) reject(err);
|
|
693
|
+
else resolve(cookies ?? []);
|
|
660
694
|
});
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
});
|
|
695
|
+
});
|
|
696
|
+
}, $cc714734e025a2db$var$_CookieStoreQueryStrategy_getAllCookies = async function _CookieStoreQueryStrategy_getAllCookies() {
|
|
697
|
+
const cookieStore = await (0, $77099c72165ec5ea$export$2c043f03eceff4e8);
|
|
698
|
+
return new Promise((resolve, reject)=>{
|
|
699
|
+
return cookieStore.getAllCookies((err, cookies)=>{
|
|
700
|
+
if (err) reject(err);
|
|
701
|
+
else resolve(cookies ?? []);
|
|
669
702
|
});
|
|
670
|
-
}
|
|
671
|
-
}
|
|
703
|
+
});
|
|
704
|
+
};
|
|
672
705
|
|
|
673
706
|
|
|
674
707
|
|
|
675
708
|
|
|
676
709
|
|
|
677
|
-
|
|
710
|
+
var $49168e685ea38e19$var$__classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
711
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
712
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
713
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
714
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
715
|
+
};
|
|
716
|
+
var $49168e685ea38e19$var$__classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
717
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
718
|
+
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");
|
|
719
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
720
|
+
};
|
|
721
|
+
var $49168e685ea38e19$var$_CompositeCookieQueryStrategy_strategies;
|
|
722
|
+
const $49168e685ea38e19$var$cache = new (0, $6B8p2$lrucache)({
|
|
678
723
|
ttl: 2000,
|
|
679
724
|
max: 10
|
|
680
725
|
});
|
|
681
|
-
class $
|
|
682
|
-
browserName = "all";
|
|
683
|
-
#strategies;
|
|
726
|
+
class $49168e685ea38e19$export$2e2bcd8739ae039 {
|
|
684
727
|
constructor(){
|
|
685
|
-
this
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
(0, $
|
|
689
|
-
(0, $
|
|
728
|
+
this.browserName = "all";
|
|
729
|
+
$49168e685ea38e19$var$_CompositeCookieQueryStrategy_strategies.set(this, void 0);
|
|
730
|
+
$49168e685ea38e19$var$__classPrivateFieldSet(this, $49168e685ea38e19$var$_CompositeCookieQueryStrategy_strategies, [
|
|
731
|
+
(0, $cc714734e025a2db$exports.default),
|
|
732
|
+
(0, $a6f61760d01c3afd$export$2e2bcd8739ae039),
|
|
733
|
+
(0, $62dcb7ce199205be$exports.default),
|
|
734
|
+
(0, $b470ee3b0b06a25e$export$2e2bcd8739ae039)
|
|
690
735
|
].map((strategy)=>{
|
|
691
736
|
return new strategy();
|
|
692
|
-
});
|
|
737
|
+
}), "f");
|
|
693
738
|
}
|
|
694
739
|
async queryCookies(name, domain) {
|
|
695
740
|
// domain = domain.match(/(\w+.+\w+)/gi)?.pop() ?? domain;
|
|
696
741
|
const key = `${name}:${domain}`;
|
|
697
|
-
const cached = $
|
|
742
|
+
const cached = $49168e685ea38e19$var$cache.get(key);
|
|
698
743
|
if (cached) return cached;
|
|
699
|
-
if ((0, $
|
|
700
|
-
const results = await Promise.all(this
|
|
744
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log("Querying cookies:", name, domain);
|
|
745
|
+
const results = await Promise.all($49168e685ea38e19$var$__classPrivateFieldGet(this, $49168e685ea38e19$var$_CompositeCookieQueryStrategy_strategies, "f").map(async (strategy)=>{
|
|
701
746
|
// @ts-ignore
|
|
702
747
|
return strategy.queryCookies(name, domain).then((cookies)=>{
|
|
703
748
|
return cookies.map((cookie)=>{
|
|
@@ -713,20 +758,21 @@ class $4ad2c96545f22a92$export$2e2bcd8739ae039 {
|
|
|
713
758
|
});
|
|
714
759
|
}));
|
|
715
760
|
const flat = results.flat();
|
|
716
|
-
$
|
|
761
|
+
$49168e685ea38e19$var$cache.set(`${name}:${domain}`, flat);
|
|
717
762
|
return flat;
|
|
718
763
|
}
|
|
719
764
|
}
|
|
765
|
+
$49168e685ea38e19$var$_CompositeCookieQueryStrategy_strategies = new WeakMap();
|
|
720
766
|
|
|
721
767
|
|
|
722
768
|
|
|
723
769
|
|
|
724
|
-
function $
|
|
770
|
+
function $459cd094c935086e$export$2e2bcd8739ae039(token) {
|
|
725
771
|
try {
|
|
726
772
|
const result = (0, $6B8p2$jsonwebtoken).decode(token, {
|
|
727
773
|
complete: true
|
|
728
774
|
});
|
|
729
|
-
if ((0, $
|
|
775
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose && result) console.log(result);
|
|
730
776
|
const payload = result?.payload;
|
|
731
777
|
if (payload) {
|
|
732
778
|
const exp = payload.exp;
|
|
@@ -742,27 +788,27 @@ function $382bb98116581c98$export$2e2bcd8739ae039(token) {
|
|
|
742
788
|
}
|
|
743
789
|
|
|
744
790
|
|
|
745
|
-
async function $
|
|
791
|
+
async function $f382029733f65752$export$e6d428437cf2cacb({ name: name , domain: domain }, strategy = new (0, $49168e685ea38e19$exports.default)()) {
|
|
746
792
|
const results = await strategy.queryCookies(name, domain);
|
|
747
793
|
const allCookies = (0, $6B8p2$uniqBy)(results, JSON.stringify);
|
|
748
|
-
if ((0, $
|
|
794
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b)["require-jwt"]) {
|
|
749
795
|
const jwtCookies = [];
|
|
750
796
|
for (const result of allCookies){
|
|
751
797
|
const value = result.value;
|
|
752
|
-
if ((0, $
|
|
798
|
+
if ((0, $459cd094c935086e$export$2e2bcd8739ae039)(value)) jwtCookies.push(result);
|
|
753
799
|
}
|
|
754
|
-
return (0, $
|
|
800
|
+
return (0, $01f4cf98d50740c6$export$c348dfaf65040d9b)["single"] ? [
|
|
755
801
|
jwtCookies[0]
|
|
756
802
|
] : jwtCookies;
|
|
757
|
-
} else return (0, $
|
|
803
|
+
} else return (0, $01f4cf98d50740c6$export$c348dfaf65040d9b)["single"] ? [
|
|
758
804
|
allCookies[0]
|
|
759
805
|
] : allCookies;
|
|
760
806
|
}
|
|
761
807
|
|
|
762
808
|
|
|
763
809
|
|
|
764
|
-
async function $
|
|
765
|
-
const cookies = await (0, $
|
|
810
|
+
async function $3a892f71b64103f5$export$4be65e66cfa2648a(params) {
|
|
811
|
+
const cookies = await (0, $f382029733f65752$export$e6d428437cf2cacb)(params, new (0, $49168e685ea38e19$exports.default)());
|
|
766
812
|
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
767
813
|
else throw new Error("Cookie not found");
|
|
768
814
|
}
|
|
@@ -771,17 +817,17 @@ async function $ee90d6e46afee441$export$4be65e66cfa2648a(params) {
|
|
|
771
817
|
|
|
772
818
|
|
|
773
819
|
|
|
774
|
-
async function $
|
|
775
|
-
const cookies = await (0, $
|
|
820
|
+
async function $c23eafaef8340cc3$export$e5637297e9eb6f2e(params) {
|
|
821
|
+
const cookies = await (0, $f382029733f65752$export$e6d428437cf2cacb)(params, new (0, $a6f61760d01c3afd$export$2e2bcd8739ae039)());
|
|
776
822
|
if (cookies.length == 0) throw new Error("Cookie not found");
|
|
777
|
-
return cookies.find((0, $
|
|
823
|
+
return cookies.find((0, $2c20f7c9c363469f$export$963c8d651337e4a4));
|
|
778
824
|
}
|
|
779
825
|
|
|
780
826
|
|
|
781
827
|
|
|
782
828
|
|
|
783
|
-
async function $
|
|
784
|
-
const cookies = await (0, $
|
|
829
|
+
async function $bea34252b8e17f8d$export$c44c5fdef43f0941(params) {
|
|
830
|
+
const cookies = await (0, $f382029733f65752$export$e6d428437cf2cacb)(params, new (0, $62dcb7ce199205be$exports.default)());
|
|
785
831
|
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
786
832
|
else throw new Error("Cookie not found");
|
|
787
833
|
}
|
|
@@ -789,7 +835,7 @@ async function $d3544dba87d45eaf$export$c44c5fdef43f0941(params) {
|
|
|
789
835
|
|
|
790
836
|
|
|
791
837
|
|
|
792
|
-
function $
|
|
838
|
+
function $8227023f453bcf31$export$9abc0a414b0d8b8f(results) {
|
|
793
839
|
// sort by name and expiry descending
|
|
794
840
|
// takes the latest expiry for each name
|
|
795
841
|
const orderedResults = (0, $6B8p2$orderBy)(results, [
|
|
@@ -805,41 +851,42 @@ function $c874cfe31b9a966d$export$9abc0a414b0d8b8f(results) {
|
|
|
805
851
|
|
|
806
852
|
|
|
807
853
|
|
|
808
|
-
async function $
|
|
854
|
+
async function $0f113de605a2ef1d$export$a65902517ae87ba8(cookieSpec) {
|
|
809
855
|
const cookies = [];
|
|
810
856
|
if (Array.isArray(cookieSpec)) {
|
|
811
857
|
const results = await Promise.all(cookieSpec.map((cs)=>{
|
|
812
|
-
return (0, $
|
|
858
|
+
return (0, $f382029733f65752$export$e6d428437cf2cacb)(cs);
|
|
813
859
|
}));
|
|
814
860
|
for (const exportedCookie of results.flat())cookies.push(exportedCookie);
|
|
815
861
|
} else {
|
|
816
|
-
const singleQuery = await (0, $
|
|
862
|
+
const singleQuery = await (0, $f382029733f65752$export$e6d428437cf2cacb)(cookieSpec);
|
|
817
863
|
cookies.push(...singleQuery);
|
|
818
864
|
}
|
|
819
865
|
return (0, $6B8p2$uniqBy)(cookies, JSON.stringify);
|
|
820
866
|
}
|
|
821
867
|
|
|
822
868
|
|
|
823
|
-
async function $
|
|
824
|
-
const cookies = await (0, $
|
|
869
|
+
async function $9bb85405e96c1fbc$export$4d2e9997e2c23417(cookieSpec) {
|
|
870
|
+
const cookies = await (0, $0f113de605a2ef1d$export$a65902517ae87ba8)(cookieSpec);
|
|
825
871
|
if (cookies.length == 0) throw new Error("Cookie not found");
|
|
826
872
|
const groupedByFile = (0, $6B8p2$groupBy)(cookies, (r)=>r.meta?.file);
|
|
827
873
|
return Object.keys(groupedByFile).map((file)=>{
|
|
828
874
|
const results = groupedByFile[file];
|
|
829
|
-
return (0, $
|
|
875
|
+
return (0, $8227023f453bcf31$export$9abc0a414b0d8b8f)(results);
|
|
830
876
|
});
|
|
831
877
|
}
|
|
832
878
|
|
|
833
879
|
|
|
834
880
|
|
|
835
881
|
|
|
836
|
-
async function $
|
|
837
|
-
const cookies = await (0, $
|
|
838
|
-
if (cookies.length > 0) return (0, $
|
|
882
|
+
async function $0b27779070651c3e$export$cfc0723de5712e57(cookieSpec) {
|
|
883
|
+
const cookies = await (0, $0f113de605a2ef1d$export$a65902517ae87ba8)(cookieSpec);
|
|
884
|
+
if (cookies.length > 0) return (0, $8227023f453bcf31$export$9abc0a414b0d8b8f)(cookies);
|
|
839
885
|
return "";
|
|
840
886
|
}
|
|
841
887
|
|
|
842
888
|
|
|
889
|
+
// noinspection JSUnusedGlobalSymbols,ExceptionCaughtLocallyJS
|
|
843
890
|
|
|
844
891
|
|
|
845
892
|
|
|
@@ -849,7 +896,7 @@ async function $dc47e52699aadc0c$export$cfc0723de5712e57(cookieSpec) {
|
|
|
849
896
|
|
|
850
897
|
|
|
851
898
|
|
|
852
|
-
function $
|
|
899
|
+
function $bd973abb63c1ed35$export$f266452a5050185d(url) {
|
|
853
900
|
const url1 = typeof url == "string" ? new URL(url) : url;
|
|
854
901
|
const cookieSpecs = [];
|
|
855
902
|
const splits = url1.hostname.split(".");
|
|
@@ -874,14 +921,14 @@ function $2fa260a31891b0ed$export$f266452a5050185d(url) {
|
|
|
874
921
|
}
|
|
875
922
|
|
|
876
923
|
|
|
877
|
-
const $
|
|
878
|
-
async function $
|
|
924
|
+
const $7d6c43a28f2485bc$var$userAgent = new (0, $6B8p2$useragents)().toString();
|
|
925
|
+
async function $7d6c43a28f2485bc$export$b24a545a0b39f491(url, options = {}, fetch = (0, $6B8p2$fetch), originalRequest) {
|
|
879
926
|
const originalRequest1 = originalRequest || {
|
|
880
927
|
url: url,
|
|
881
928
|
options: options
|
|
882
929
|
};
|
|
883
930
|
const headers = {
|
|
884
|
-
"User-Agent": $
|
|
931
|
+
"User-Agent": $7d6c43a28f2485bc$var$userAgent
|
|
885
932
|
};
|
|
886
933
|
const defaultOptions = {
|
|
887
934
|
headers: headers,
|
|
@@ -889,9 +936,9 @@ async function $a1c21070f1cf1867$export$b24a545a0b39f491(url, options = {}, fetc
|
|
|
889
936
|
};
|
|
890
937
|
const url2 = `${url}`;
|
|
891
938
|
const url1 = new URL(url2);
|
|
892
|
-
const cookieSpecs = (0, $
|
|
893
|
-
headers["Cookie"] = await (0, $
|
|
894
|
-
if ((0, $
|
|
939
|
+
const cookieSpecs = (0, $bd973abb63c1ed35$export$f266452a5050185d)(url1);
|
|
940
|
+
headers["Cookie"] = await (0, $0b27779070651c3e$export$cfc0723de5712e57)(cookieSpecs).catch(()=>"");
|
|
941
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b)["dump-request-headers"]) {
|
|
895
942
|
console.log((0, $6B8p2$redBright)("Request URL:"), url1.href);
|
|
896
943
|
console.log((0, $6B8p2$blue)("Request headers:"), headers);
|
|
897
944
|
}
|
|
@@ -908,17 +955,17 @@ async function $a1c21070f1cf1867$export$b24a545a0b39f491(url, options = {}, fetc
|
|
|
908
955
|
]);
|
|
909
956
|
});
|
|
910
957
|
for (const [key, value] of headers1)if (key === "set-cookie") {
|
|
911
|
-
const cookieJar1 = await (0, $
|
|
958
|
+
const cookieJar1 = await (0, $77099c72165ec5ea$export$eced8873dedbb4c0);
|
|
912
959
|
await cookieJar1.setCookie(value, url2);
|
|
913
|
-
if ((0, $
|
|
960
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log((0, $6B8p2$blue)(`Set-Cookie:`), (0, $6B8p2$yellow)(value), (0, $6B8p2$yellow)(url2));
|
|
914
961
|
}
|
|
915
962
|
const newUrl = res.headers.get("location") ?? res.url;
|
|
916
963
|
// const sameHost = new URL(newUrl).host === url1.host;
|
|
917
964
|
if (res.status == 301 || res.status == 302) // follow the redirect
|
|
918
965
|
{
|
|
919
966
|
if (newUrl && newUrl !== url2) {
|
|
920
|
-
if ((0, $
|
|
921
|
-
return $
|
|
967
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose || (0, $01f4cf98d50740c6$export$c348dfaf65040d9b)["dump-response-headers"]) console.log((0, $6B8p2$blue)(`Redirected to `), (0, $6B8p2$yellow)(newUrl));
|
|
968
|
+
return $7d6c43a28f2485bc$export$b24a545a0b39f491(//
|
|
922
969
|
newUrl, newOptions1, fetch, originalRequest1);
|
|
923
970
|
}
|
|
924
971
|
}
|
|
@@ -943,8 +990,8 @@ async function $a1c21070f1cf1867$export$b24a545a0b39f491(url, options = {}, fetc
|
|
|
943
990
|
(0, $6B8p2$merge)(newOptions2, newOptions1);
|
|
944
991
|
break;
|
|
945
992
|
}
|
|
946
|
-
if ((0, $
|
|
947
|
-
return $
|
|
993
|
+
if ((0, $01f4cf98d50740c6$export$c348dfaf65040d9b).verbose) console.log((0, $6B8p2$blue)(`Redirected to `), (0, $6B8p2$yellow)(newUrl));
|
|
994
|
+
return $7d6c43a28f2485bc$export$b24a545a0b39f491(//
|
|
948
995
|
newUrl, newOptions2, fetch, originalRequest1);
|
|
949
996
|
}
|
|
950
997
|
const arrayBuffer1 = res.arrayBuffer();
|
|
@@ -981,16 +1028,7 @@ async function $a1c21070f1cf1867$export$b24a545a0b39f491(url, options = {}, fetc
|
|
|
981
1028
|
}
|
|
982
1029
|
|
|
983
1030
|
|
|
984
|
-
var $a37c3808491b8fab$exports = {};
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
var $801bca016ea3ef3e$exports = {};
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
var $e3cac67a6cf22070$exports = {};
|
|
991
|
-
|
|
992
|
-
|
|
993
1031
|
|
|
994
1032
|
|
|
995
|
-
export {$
|
|
1033
|
+
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};
|
|
996
1034
|
//# sourceMappingURL=module.js.map
|