@mherod/get-cookie 2.0.0-rc.18 → 2.0.0-rc.19
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/.fleet/settings.json +2 -2
- package/.idea/runConfigurations/build.xml +12 -0
- package/.prettierignore +5 -0
- package/.prettierrc.json +1 -1
- package/README.md +2 -2
- package/dist/index.js +304 -185
- package/package.json +10 -10
- package/src/CookieStore.ts +20 -7
- package/src/FileCookieStore.ts +170 -0
- package/src/browsers/CookieStoreQueryStrategy.ts +23 -18
- package/src/fetchWithCookies.ts +7 -5
- package/tsconfig.json +9 -15
package/dist/index.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
6
|
-
var $
|
|
7
|
-
var $
|
|
8
|
-
var $
|
|
9
|
-
var $
|
|
10
|
-
var $
|
|
11
|
-
var $
|
|
12
|
-
var $
|
|
13
|
-
var $
|
|
14
|
-
var $
|
|
15
|
-
var $
|
|
16
|
-
var $7oI3p$useragents = require("user-agents");
|
|
2
|
+
var $cDXzb$lodash = require("lodash");
|
|
3
|
+
var $cDXzb$minimist = require("minimist");
|
|
4
|
+
var $cDXzb$lrucache = require("lru-cache");
|
|
5
|
+
var $cDXzb$colorette = require("colorette");
|
|
6
|
+
var $cDXzb$fs = require("fs");
|
|
7
|
+
var $cDXzb$crypto = require("crypto");
|
|
8
|
+
var $cDXzb$path = require("path");
|
|
9
|
+
var $cDXzb$sqlite3 = require("sqlite3");
|
|
10
|
+
var $cDXzb$child_process = require("child_process");
|
|
11
|
+
var $cDXzb$toughcookie = require("tough-cookie");
|
|
12
|
+
var $cDXzb$destr = require("destr");
|
|
13
|
+
var $cDXzb$jsonwebtoken = require("jsonwebtoken");
|
|
14
|
+
var $cDXzb$crossfetch = require("cross-fetch");
|
|
15
|
+
var $cDXzb$useragents = require("user-agents");
|
|
17
16
|
|
|
18
17
|
function $parcel$export(e, n, v, s) {
|
|
19
18
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
@@ -38,27 +37,27 @@ function $parcel$interopDefault(a) {
|
|
|
38
37
|
return a && a.__esModule ? a.default : a;
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
$parcel$export(module.exports, "getCookie", () => $
|
|
42
|
-
$parcel$export(module.exports, "getChromeCookie", () => $
|
|
43
|
-
$parcel$export(module.exports, "getFirefoxCookie", () => $
|
|
44
|
-
$parcel$export(module.exports, "getMergedRenderedCookies", () => $
|
|
45
|
-
$parcel$export(module.exports, "getGroupedRenderedCookies", () => $
|
|
46
|
-
$parcel$export(module.exports, "fetchWithCookies", () => $
|
|
40
|
+
$parcel$export(module.exports, "getCookie", () => $5059c79c511ef67d$export$4be65e66cfa2648a);
|
|
41
|
+
$parcel$export(module.exports, "getChromeCookie", () => $0d142dad92c7a441$export$e5637297e9eb6f2e);
|
|
42
|
+
$parcel$export(module.exports, "getFirefoxCookie", () => $2c9cc1b8a57118d9$export$c44c5fdef43f0941);
|
|
43
|
+
$parcel$export(module.exports, "getMergedRenderedCookies", () => $01a8b57f5e2fbc3a$export$cfc0723de5712e57);
|
|
44
|
+
$parcel$export(module.exports, "getGroupedRenderedCookies", () => $3250e6c7c8746c6f$export$4d2e9997e2c23417);
|
|
45
|
+
$parcel$export(module.exports, "fetchWithCookies", () => $9784c2ab321f9dab$export$b24a545a0b39f491);
|
|
47
46
|
|
|
48
47
|
|
|
49
48
|
|
|
50
|
-
const $
|
|
51
|
-
const $
|
|
52
|
-
const $
|
|
49
|
+
const $7b83c0e89cc28a81$export$6f4ae1207c703045 = process.argv ?? [];
|
|
50
|
+
const $7b83c0e89cc28a81$var$minimistArgs = (0, ($parcel$interopDefault($cDXzb$minimist)))($7b83c0e89cc28a81$export$6f4ae1207c703045.slice(2));
|
|
51
|
+
const $7b83c0e89cc28a81$var$defaultOptions = {
|
|
53
52
|
verbose: false
|
|
54
53
|
};
|
|
55
|
-
const $
|
|
54
|
+
const $7b83c0e89cc28a81$export$c348dfaf65040d9b = (0, $cDXzb$lodash.merge)($7b83c0e89cc28a81$var$defaultOptions, $7b83c0e89cc28a81$var$minimistArgs);
|
|
56
55
|
|
|
57
56
|
|
|
58
57
|
|
|
59
|
-
async function $
|
|
58
|
+
async function $564742ddd35242d9$export$8d71c74f97c0202e(command) {
|
|
60
59
|
return new Promise((resolve, reject)=>{
|
|
61
|
-
(0, $
|
|
60
|
+
(0, $cDXzb$child_process.exec)(command, {
|
|
62
61
|
encoding: "binary",
|
|
63
62
|
maxBuffer: 5120
|
|
64
63
|
}, (error, stdout, stderr)=>{
|
|
@@ -77,48 +76,48 @@ async function $25b78d6746d4ad48$export$8d71c74f97c0202e(command) {
|
|
|
77
76
|
|
|
78
77
|
|
|
79
78
|
|
|
80
|
-
const $
|
|
81
|
-
(0, $
|
|
82
|
-
const $
|
|
83
|
-
if (!$
|
|
79
|
+
const $9aaa37efbfec96e1$export$a7b6bc01c63cdfc3 = {};
|
|
80
|
+
(0, $cDXzb$lodash.merge)($9aaa37efbfec96e1$export$a7b6bc01c63cdfc3, process.env);
|
|
81
|
+
const $9aaa37efbfec96e1$export$a7c5707626fc90f = $9aaa37efbfec96e1$export$a7b6bc01c63cdfc3["HOME"];
|
|
82
|
+
if (!$9aaa37efbfec96e1$export$a7c5707626fc90f) throw new Error("HOME environment variable is not set");
|
|
84
83
|
|
|
85
84
|
|
|
86
85
|
|
|
87
86
|
|
|
88
87
|
|
|
89
|
-
async function $
|
|
88
|
+
async function $80bd1d9d7f29d893$export$2c9faf86071156ae({ path: path , name: name , maxDepth: maxDepth = 2 }) {
|
|
90
89
|
const rootSegments = path.split("/").length;
|
|
91
90
|
const files = [];
|
|
92
91
|
let readdirSync;
|
|
93
92
|
try {
|
|
94
|
-
readdirSync = $
|
|
93
|
+
readdirSync = $cDXzb$fs.readdirSync(path);
|
|
95
94
|
} catch (e) {
|
|
96
|
-
if ((0, $
|
|
95
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log(`Error reading ${path}`, e);
|
|
97
96
|
return [];
|
|
98
97
|
}
|
|
99
98
|
for (const file of readdirSync){
|
|
100
99
|
const filePath = path + "/" + file;
|
|
101
100
|
let stat;
|
|
102
101
|
try {
|
|
103
|
-
stat = $
|
|
102
|
+
stat = $cDXzb$fs.statSync(filePath);
|
|
104
103
|
} catch (e1) {
|
|
105
|
-
if ((0, $
|
|
104
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.error(`Error getting stat for ${filePath}`, e1);
|
|
106
105
|
continue;
|
|
107
106
|
}
|
|
108
107
|
if (stat.isDirectory()) {
|
|
109
108
|
if (filePath.split("/").length < rootSegments + maxDepth) try {
|
|
110
|
-
const subFiles = await $
|
|
109
|
+
const subFiles = await $80bd1d9d7f29d893$export$2c9faf86071156ae({
|
|
111
110
|
path: filePath,
|
|
112
111
|
name: name,
|
|
113
112
|
maxDepth: 2
|
|
114
113
|
});
|
|
115
114
|
files.push(...subFiles);
|
|
116
115
|
} catch (e2) {
|
|
117
|
-
if ((0, $
|
|
116
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.error(e2);
|
|
118
117
|
}
|
|
119
118
|
} else if (file === name) files.push(filePath);
|
|
120
119
|
}
|
|
121
|
-
if ((0, $
|
|
120
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) {
|
|
122
121
|
if (files.length > 0) {
|
|
123
122
|
console.log(`Found ${files.length} ${name} files`);
|
|
124
123
|
console.log(files);
|
|
@@ -131,17 +130,17 @@ async function $e62c2c56eb720f29$export$2c9faf86071156ae({ path: path , name: na
|
|
|
131
130
|
|
|
132
131
|
|
|
133
132
|
|
|
134
|
-
function $
|
|
133
|
+
function $f490d8883fd09138$export$bc926c43858bd3cb(obj) {
|
|
135
134
|
return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;
|
|
136
135
|
}
|
|
137
136
|
|
|
138
137
|
|
|
139
|
-
function $
|
|
138
|
+
function $5ab7b2322194eec8$export$963c8d651337e4a4(obj) {
|
|
140
139
|
return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;
|
|
141
140
|
}
|
|
142
141
|
|
|
143
142
|
|
|
144
|
-
function $
|
|
143
|
+
function $0dadf812b76e7b53$export$4eadcf0bf35a2ddb(s) {
|
|
145
144
|
const s1 = s.replaceAll(/\./gi, ".");
|
|
146
145
|
const s2 = s1.replace(/%/g, ".*");
|
|
147
146
|
const s3 = s2.replace(/\*/g, ".*");
|
|
@@ -151,62 +150,62 @@ function $68c0ed99fadee6ca$export$4eadcf0bf35a2ddb(s) {
|
|
|
151
150
|
|
|
152
151
|
|
|
153
152
|
|
|
154
|
-
class $
|
|
153
|
+
class $2863e754fd8bb18c$export$2e2bcd8739ae039 {
|
|
155
154
|
browserName = "Chrome";
|
|
156
155
|
async queryCookies(name, domain) {
|
|
157
156
|
if (process.platform !== "darwin") throw new Error("This only works on macOS");
|
|
158
|
-
if ((0, $
|
|
159
|
-
return $
|
|
157
|
+
if ((0, $9aaa37efbfec96e1$export$a7b6bc01c63cdfc3).FIREFOX_ONLY) return [];
|
|
158
|
+
return $2863e754fd8bb18c$var$getChromeCookies({
|
|
160
159
|
requireJwt: false,
|
|
161
160
|
name: name,
|
|
162
161
|
domain: domain
|
|
163
162
|
});
|
|
164
163
|
}
|
|
165
164
|
}
|
|
166
|
-
async function $
|
|
165
|
+
async function $2863e754fd8bb18c$var$getPromise1(name, domain, file) {
|
|
167
166
|
try {
|
|
168
|
-
return await $
|
|
167
|
+
return await $2863e754fd8bb18c$var$getEncryptedChromeCookie({
|
|
169
168
|
name: name,
|
|
170
169
|
domain: domain,
|
|
171
170
|
file: file
|
|
172
171
|
});
|
|
173
172
|
} catch (e) {
|
|
174
|
-
if ((0, $
|
|
173
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log("Error getting encrypted cookie", e);
|
|
175
174
|
return [];
|
|
176
175
|
}
|
|
177
176
|
}
|
|
178
|
-
async function $
|
|
177
|
+
async function $2863e754fd8bb18c$var$getPromise(name, domain) {
|
|
179
178
|
try {
|
|
180
|
-
const files = await (0, $
|
|
181
|
-
path: $
|
|
179
|
+
const files = await (0, $80bd1d9d7f29d893$export$2c9faf86071156ae)({
|
|
180
|
+
path: $2863e754fd8bb18c$var$chromeLocal,
|
|
182
181
|
name: "Cookies"
|
|
183
182
|
});
|
|
184
|
-
const promises = files.map((file)=>$
|
|
183
|
+
const promises = files.map((file)=>$2863e754fd8bb18c$var$getPromise1(name, domain, file));
|
|
185
184
|
const results1 = await Promise.all(promises);
|
|
186
|
-
return results1.flat().filter((0, $
|
|
185
|
+
return results1.flat().filter((0, $f490d8883fd09138$export$bc926c43858bd3cb));
|
|
187
186
|
} catch (error) {
|
|
188
|
-
if ((0, $
|
|
187
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log("error", error);
|
|
189
188
|
return [];
|
|
190
189
|
}
|
|
191
190
|
}
|
|
192
|
-
async function $
|
|
191
|
+
async function $2863e754fd8bb18c$var$decryptValue(password, encryptedValue) {
|
|
193
192
|
let d;
|
|
194
193
|
try {
|
|
195
|
-
d = await $
|
|
194
|
+
d = await $2863e754fd8bb18c$var$decrypt(password, encryptedValue);
|
|
196
195
|
} catch (e) {
|
|
197
|
-
if ((0, $
|
|
196
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log("Error decrypting cookie", e);
|
|
198
197
|
d = null;
|
|
199
198
|
}
|
|
200
199
|
return d ?? encryptedValue.toString("utf-8");
|
|
201
200
|
}
|
|
202
|
-
async function $
|
|
203
|
-
const encryptedDataItems = await $
|
|
204
|
-
const password = await $
|
|
201
|
+
async function $2863e754fd8bb18c$var$getChromeCookies({ name: name , domain: domain = "%" , requireJwt: requireJwt = false }) {
|
|
202
|
+
const encryptedDataItems = await $2863e754fd8bb18c$var$getPromise(name, domain);
|
|
203
|
+
const password = await $2863e754fd8bb18c$var$getChromePassword();
|
|
205
204
|
const decrypted = encryptedDataItems.filter(({ value: value })=>value != null && value.length > 0).map(async (cookieRow)=>{
|
|
206
205
|
const encryptedValue = cookieRow.value;
|
|
207
|
-
const decryptedValue = await $
|
|
206
|
+
const decryptedValue = await $2863e754fd8bb18c$var$decryptValue(password, encryptedValue);
|
|
208
207
|
const meta = {};
|
|
209
|
-
(0, $
|
|
208
|
+
(0, $cDXzb$lodash.merge)(meta, cookieRow.meta ?? {});
|
|
210
209
|
const exportedCookie = {
|
|
211
210
|
domain: cookieRow.domain,
|
|
212
211
|
name: cookieRow.name,
|
|
@@ -219,17 +218,17 @@ async function $269fe42bfd555305$var$getChromeCookies({ name: name , domain: dom
|
|
|
219
218
|
} : {
|
|
220
219
|
expiry: "Infinity"
|
|
221
220
|
};
|
|
222
|
-
(0, $
|
|
221
|
+
(0, $cDXzb$lodash.merge)(exportedCookie, mergeExpiry);
|
|
223
222
|
return exportedCookie;
|
|
224
223
|
});
|
|
225
|
-
const results = (await Promise.all(decrypted)).filter((0, $
|
|
226
|
-
if ((0, $
|
|
224
|
+
const results = (await Promise.all(decrypted)).filter((0, $5ab7b2322194eec8$export$963c8d651337e4a4));
|
|
225
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log("results", results);
|
|
227
226
|
return results;
|
|
228
227
|
}
|
|
229
|
-
const $
|
|
230
|
-
async function $
|
|
231
|
-
if (!(0, $
|
|
232
|
-
if ((0, $
|
|
228
|
+
const $2863e754fd8bb18c$var$chromeLocal = $cDXzb$path.join((0, $9aaa37efbfec96e1$export$a7c5707626fc90f), "Library", "Application Support", "Google", "Chrome");
|
|
229
|
+
async function $2863e754fd8bb18c$var$getEncryptedChromeCookie({ name: name , domain: domain , file: file = $cDXzb$path.join($2863e754fd8bb18c$var$chromeLocal, "Default", "Cookies") }) {
|
|
230
|
+
if (!(0, $cDXzb$fs.existsSync)(file)) throw new Error(`File ${file} does not exist`);
|
|
231
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) {
|
|
233
232
|
const s = file.split("/").slice(-3).join("/");
|
|
234
233
|
console.log(`Trying Chrome (at ${s}) cookie ${name} for domain ${domain}`);
|
|
235
234
|
}
|
|
@@ -255,9 +254,9 @@ async function $269fe42bfd555305$var$getEncryptedChromeCookie({ name: name , dom
|
|
|
255
254
|
sql += `host_key LIKE '${sqlEmbedDomain}';`;
|
|
256
255
|
}
|
|
257
256
|
}
|
|
258
|
-
if ((0, $
|
|
259
|
-
const domainRegexp = (0, $
|
|
260
|
-
const sqliteQuery1 = await $
|
|
257
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log("sql", sql);
|
|
258
|
+
const domainRegexp = (0, $0dadf812b76e7b53$export$4eadcf0bf35a2ddb)(domain);
|
|
259
|
+
const sqliteQuery1 = await $2863e754fd8bb18c$export$bd52b72df8d0d261({
|
|
261
260
|
file: file,
|
|
262
261
|
sql: sql,
|
|
263
262
|
rowFilter: (row)=>{
|
|
@@ -270,7 +269,7 @@ async function $269fe42bfd555305$var$getEncryptedChromeCookie({ name: name , dom
|
|
|
270
269
|
name: row["name"],
|
|
271
270
|
value: row["encrypted_value"]
|
|
272
271
|
};
|
|
273
|
-
if ((0, $
|
|
272
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log("CookieRow", cookieRow);
|
|
274
273
|
return cookieRow;
|
|
275
274
|
}
|
|
276
275
|
});
|
|
@@ -278,10 +277,10 @@ async function $269fe42bfd555305$var$getEncryptedChromeCookie({ name: name , dom
|
|
|
278
277
|
return row.domain.match(domainRegexp) != null;
|
|
279
278
|
});
|
|
280
279
|
}
|
|
281
|
-
async function $
|
|
282
|
-
return (0, $
|
|
280
|
+
async function $2863e754fd8bb18c$var$getChromePassword() {
|
|
281
|
+
return (0, $564742ddd35242d9$export$8d71c74f97c0202e)('security find-generic-password -w -s "Chrome Safe Storage"');
|
|
283
282
|
}
|
|
284
|
-
async function $
|
|
283
|
+
async function $2863e754fd8bb18c$var$decrypt(password, encryptedData) {
|
|
285
284
|
if (typeof password !== "string") throw new Error("password must be a string: " + password);
|
|
286
285
|
let encryptedData1;
|
|
287
286
|
encryptedData1 = encryptedData;
|
|
@@ -289,31 +288,31 @@ async function $269fe42bfd555305$var$decrypt(password, encryptedData) {
|
|
|
289
288
|
if (!(encryptedData1 instanceof Buffer)) {
|
|
290
289
|
if (Array.isArray(encryptedData1) && encryptedData1[0] instanceof Buffer) {
|
|
291
290
|
[encryptedData1] = encryptedData1;
|
|
292
|
-
if ((0, $
|
|
291
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log(`encryptedData is an array of buffers, selected first: ${encryptedData1}`);
|
|
293
292
|
} else throw new Error("encryptedData must be a Buffer: " + encryptedData1);
|
|
294
293
|
encryptedData1 = Buffer.from(encryptedData1);
|
|
295
294
|
}
|
|
296
|
-
if ((0, $
|
|
295
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log(`Trying to decrypt with password ${password}`);
|
|
297
296
|
return new Promise((resolve, reject)=>{
|
|
298
|
-
$
|
|
297
|
+
$cDXzb$crypto.pbkdf2(password, "saltysalt", 1003, 16, "sha1", (error, buffer)=>{
|
|
299
298
|
try {
|
|
300
299
|
if (error) {
|
|
301
|
-
if ((0, $
|
|
300
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2", error);
|
|
302
301
|
reject(error);
|
|
303
302
|
return;
|
|
304
303
|
}
|
|
305
304
|
if (buffer.length !== 16) {
|
|
306
|
-
if ((0, $
|
|
305
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2, buffer length is not 16", buffer.length);
|
|
307
306
|
reject(new Error("Buffer length is not 16"));
|
|
308
307
|
return;
|
|
309
308
|
}
|
|
310
309
|
const str = new Array(17).join(" ");
|
|
311
310
|
const iv = Buffer.from(str, "binary");
|
|
312
|
-
const decipher = $
|
|
311
|
+
const decipher = $cDXzb$crypto.createDecipheriv("aes-128-cbc", buffer, iv);
|
|
313
312
|
decipher.setAutoPadding(false);
|
|
314
313
|
if (encryptedData1 && encryptedData1.slice) encryptedData1 = encryptedData1.slice(3);
|
|
315
314
|
if (encryptedData1.length % 16 !== 0) {
|
|
316
|
-
if ((0, $
|
|
315
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2, encryptedData length is not a multiple of 16", encryptedData1.length);
|
|
317
316
|
reject(new Error("encryptedData length is not a multiple of 16"));
|
|
318
317
|
return;
|
|
319
318
|
}
|
|
@@ -321,7 +320,7 @@ async function $269fe42bfd555305$var$decrypt(password, encryptedData) {
|
|
|
321
320
|
try {
|
|
322
321
|
decipher.final("utf-8");
|
|
323
322
|
} catch (e) {
|
|
324
|
-
if ((0, $
|
|
323
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log("Error doing decipher.final()", e);
|
|
325
324
|
reject(e);
|
|
326
325
|
return;
|
|
327
326
|
}
|
|
@@ -336,9 +335,9 @@ async function $269fe42bfd555305$var$decrypt(password, encryptedData) {
|
|
|
336
335
|
});
|
|
337
336
|
});
|
|
338
337
|
}
|
|
339
|
-
async function $
|
|
340
|
-
if (!file || file && !(0, ($parcel$interopDefault($
|
|
341
|
-
const db = new $
|
|
338
|
+
async function $2863e754fd8bb18c$export$bd52b72df8d0d261({ file: file , sql: sql , rowFilter: rowFilter = ()=>true , rowTransform: rowTransform }) {
|
|
339
|
+
if (!file || file && !(0, ($parcel$interopDefault($cDXzb$fs))).existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
|
|
340
|
+
const db = new $cDXzb$sqlite3.Database(file);
|
|
342
341
|
return new Promise((resolve, reject)=>{
|
|
343
342
|
db.all(sql, (err, rows)=>{
|
|
344
343
|
if (err) {
|
|
@@ -358,12 +357,12 @@ async function $269fe42bfd555305$export$bd52b72df8d0d261({ file: file , sql: sql
|
|
|
358
357
|
}
|
|
359
358
|
};
|
|
360
359
|
const cookieRow = rowTransform(row);
|
|
361
|
-
return (0, $
|
|
360
|
+
return (0, $cDXzb$lodash.merge)(newVar, cookieRow);
|
|
362
361
|
});
|
|
363
362
|
resolve(cookieRows);
|
|
364
363
|
return;
|
|
365
364
|
}
|
|
366
|
-
if ((0, $
|
|
365
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
|
|
367
366
|
resolve([
|
|
368
367
|
rows1
|
|
369
368
|
]);
|
|
@@ -376,7 +375,7 @@ async function $269fe42bfd555305$export$bd52b72df8d0d261({ file: file , sql: sql
|
|
|
376
375
|
|
|
377
376
|
|
|
378
377
|
|
|
379
|
-
function $
|
|
378
|
+
function $4cf67f382f391bdd$export$da22813e5a2ec500({ name: name , domain: domain }) {
|
|
380
379
|
const wildcardRegexp = /^([*%])$/i;
|
|
381
380
|
return {
|
|
382
381
|
specifiedName: name.match(wildcardRegexp) == null,
|
|
@@ -388,9 +387,9 @@ function $b744d19cc39f964e$export$da22813e5a2ec500({ name: name , domain: domain
|
|
|
388
387
|
|
|
389
388
|
|
|
390
389
|
|
|
391
|
-
async function $
|
|
392
|
-
if (!file || file && !(0, ($parcel$interopDefault($
|
|
393
|
-
const db = new $
|
|
390
|
+
async function $5df4e8bfccec8ffc$export$f19f611d1fa7c6f3({ file: file , sql: sql , rowTransform: rowTransform }) {
|
|
391
|
+
if (!file || file && !(0, ($parcel$interopDefault($cDXzb$fs))).existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
|
|
392
|
+
const db = new $cDXzb$sqlite3.Database(file);
|
|
394
393
|
return new Promise((resolve, reject)=>{
|
|
395
394
|
db.all(sql, (err, rows)=>{
|
|
396
395
|
if (err) {
|
|
@@ -410,24 +409,24 @@ async function $7bb7da9a77b2fd99$export$f19f611d1fa7c6f3({ file: file , sql: sql
|
|
|
410
409
|
}
|
|
411
410
|
};
|
|
412
411
|
const cookieRow = rowTransform(row);
|
|
413
|
-
return (0, $
|
|
412
|
+
return (0, $cDXzb$lodash.merge)(newVar, cookieRow);
|
|
414
413
|
});
|
|
415
414
|
resolve(cookieRows);
|
|
416
415
|
return;
|
|
417
416
|
}
|
|
418
|
-
if ((0, $
|
|
417
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
|
|
419
418
|
resolve([
|
|
420
419
|
rows1
|
|
421
420
|
]);
|
|
422
421
|
});
|
|
423
422
|
});
|
|
424
423
|
}
|
|
425
|
-
class $
|
|
424
|
+
class $5df4e8bfccec8ffc$export$2e2bcd8739ae039 {
|
|
426
425
|
browserName = "Firefox";
|
|
427
426
|
async queryCookies(name, domain) {
|
|
428
427
|
if (process.platform !== "darwin") // TODO: implement
|
|
429
428
|
return [];
|
|
430
|
-
if ((0, $
|
|
429
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).browser !== "firefox") return [];
|
|
431
430
|
const cookies = await this.#getFirefoxCookie({
|
|
432
431
|
name: name,
|
|
433
432
|
domain: domain
|
|
@@ -443,8 +442,8 @@ class $7bb7da9a77b2fd99$export$2e2bcd8739ae039 {
|
|
|
443
442
|
}
|
|
444
443
|
async #getFirefoxCookie({ name: name , domain: domain } //
|
|
445
444
|
) {
|
|
446
|
-
const files = await (0, $
|
|
447
|
-
path: $
|
|
445
|
+
const files = await (0, $80bd1d9d7f29d893$export$2c9faf86071156ae)({
|
|
446
|
+
path: $cDXzb$path.join((0, $9aaa37efbfec96e1$export$a7c5707626fc90f), "Library", "Application Support", "Firefox", "Profiles"),
|
|
448
447
|
name: "cookies.sqlite"
|
|
449
448
|
});
|
|
450
449
|
const fn = async (file)=>{
|
|
@@ -455,11 +454,11 @@ class $7bb7da9a77b2fd99$export$2e2bcd8739ae039 {
|
|
|
455
454
|
return all.flat();
|
|
456
455
|
}
|
|
457
456
|
async #queryCookiesDb(file, name1, domain1) {
|
|
458
|
-
if (file && !(0, $
|
|
457
|
+
if (file && !(0, $cDXzb$fs.existsSync)(file)) throw new Error(`File ${file} does not exist`);
|
|
459
458
|
let sql;
|
|
460
459
|
//language=SQL
|
|
461
460
|
sql = "SELECT value, name, host FROM moz_cookies";
|
|
462
|
-
const { specifiedName: specifiedName , specifiedDomain: specifiedDomain } = (0, $
|
|
461
|
+
const { specifiedName: specifiedName , specifiedDomain: specifiedDomain } = (0, $4cf67f382f391bdd$export$da22813e5a2ec500)({
|
|
463
462
|
name: name1,
|
|
464
463
|
domain: domain1
|
|
465
464
|
});
|
|
@@ -481,7 +480,7 @@ class $7bb7da9a77b2fd99$export$2e2bcd8739ae039 {
|
|
|
481
480
|
};
|
|
482
481
|
};
|
|
483
482
|
try {
|
|
484
|
-
return await $
|
|
483
|
+
return await $5df4e8bfccec8ffc$export$f19f611d1fa7c6f3({
|
|
485
484
|
file: file,
|
|
486
485
|
sql: sql,
|
|
487
486
|
rowTransform: rowTransform
|
|
@@ -494,7 +493,7 @@ class $7bb7da9a77b2fd99$export$2e2bcd8739ae039 {
|
|
|
494
493
|
}
|
|
495
494
|
|
|
496
495
|
|
|
497
|
-
class $
|
|
496
|
+
class $0ca9bb20e90816f9$export$2e2bcd8739ae039 {
|
|
498
497
|
browserName = "Safari";
|
|
499
498
|
async queryCookies(name, domain) {
|
|
500
499
|
// TODO: implement
|
|
@@ -508,15 +507,131 @@ class $fad6f51bd5c7bae2$export$2e2bcd8739ae039 {
|
|
|
508
507
|
|
|
509
508
|
|
|
510
509
|
|
|
511
|
-
var $53a3bcc99a05dfcf$require$FileCookieStore = $7oI3p$toughcookiefilestore.FileCookieStore;
|
|
512
|
-
let $53a3bcc99a05dfcf$export$6c62df16f2e9c7e8;
|
|
513
|
-
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b)["cs"] == "memory") $53a3bcc99a05dfcf$export$6c62df16f2e9c7e8 = new (0, $7oI3p$toughcookie.MemoryCookieStore)();
|
|
514
|
-
else $53a3bcc99a05dfcf$export$6c62df16f2e9c7e8 = new $53a3bcc99a05dfcf$require$FileCookieStore(`${(0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3)["HOME"]}/cookie-star.json`);
|
|
515
|
-
const $53a3bcc99a05dfcf$export$928a906645f9d018 = new (0, $7oI3p$toughcookie.CookieJar)($53a3bcc99a05dfcf$export$6c62df16f2e9c7e8);
|
|
516
510
|
|
|
517
511
|
|
|
518
512
|
|
|
519
|
-
class $
|
|
513
|
+
class $30e4b5d3291f1a19$export$55374e421ca433de extends (0, $cDXzb$toughcookie.Store) {
|
|
514
|
+
synchronous = false;
|
|
515
|
+
tasks = [];
|
|
516
|
+
constructor(filePath, internalStore = new (0, $cDXzb$toughcookie.MemoryCookieStore)()){
|
|
517
|
+
super();
|
|
518
|
+
this.filePath = filePath;
|
|
519
|
+
this.internalStore = internalStore ?? new (0, $cDXzb$toughcookie.MemoryCookieStore)();
|
|
520
|
+
console.log("Importing cookies from", filePath, internalStore);
|
|
521
|
+
this.tasks.push(this.importSaved(filePath, internalStore).then(console.log, console.error));
|
|
522
|
+
}
|
|
523
|
+
async importSaved(filePath, store) {
|
|
524
|
+
const cookies = [];
|
|
525
|
+
if ((0, $cDXzb$fs.existsSync)(filePath)) {
|
|
526
|
+
const data = (0, $cDXzb$fs.readFileSync)(filePath, "utf8");
|
|
527
|
+
const cookies1 = Object.values((0, ($parcel$interopDefault($cDXzb$destr)))(data)).flatMap((domainCookies)=>Object.values(domainCookies)).flatMap((domainCookies)=>Object.values(domainCookies));
|
|
528
|
+
console.log("Importing", cookies1.length, "cookies");
|
|
529
|
+
const array = Array.isArray(cookies1) ? cookies1 : Object.values(cookies1);
|
|
530
|
+
const put = await Promise.all(array.map((cookie)=>{
|
|
531
|
+
const fromJSON = (0, $cDXzb$toughcookie.Cookie).fromJSON(cookie);
|
|
532
|
+
if (fromJSON) return this.putCookieInternal(fromJSON, store);
|
|
533
|
+
}));
|
|
534
|
+
cookies1.push(...put);
|
|
535
|
+
}
|
|
536
|
+
return cookies;
|
|
537
|
+
}
|
|
538
|
+
findCookie(domain, path, key, cb) {
|
|
539
|
+
this.waitUntilIdle().finally(()=>{
|
|
540
|
+
this.internalStore.findCookie(domain, path, key, cb);
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
findCookies(domain, path, allowSpecialUseDomain, cb) {
|
|
544
|
+
this.waitUntilIdle().finally(()=>{
|
|
545
|
+
this.internalStore.findCookies(domain, path, allowSpecialUseDomain, cb);
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
putCookie(cookie, cb) {
|
|
549
|
+
this.internalStore.putCookie(cookie, cb);
|
|
550
|
+
this.internalStore.getAllCookies((err, cookies)=>{
|
|
551
|
+
this.serializeCallback(err, cookies);
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
updateCookie(oldCookie, newCookie, cb) {
|
|
555
|
+
this.internalStore.updateCookie(oldCookie, newCookie, cb);
|
|
556
|
+
this.internalStore.getAllCookies((err, cookies)=>{
|
|
557
|
+
this.serializeCallback(err, cookies);
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
removeCookie(domain, path, key, cb) {
|
|
561
|
+
this.internalStore.removeCookie(domain, path, key, cb);
|
|
562
|
+
this.internalStore.getAllCookies((err, cookies)=>{
|
|
563
|
+
this.serializeCallback(err, cookies);
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
removeCookies(domain, path, cb) {
|
|
567
|
+
this.internalStore.removeCookies(domain, path, cb);
|
|
568
|
+
this.internalStore.getAllCookies((err, cookies)=>{
|
|
569
|
+
this.serializeCallback(err, cookies);
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
getAllCookies(cb) {
|
|
573
|
+
this.waitUntilIdle().finally(()=>{
|
|
574
|
+
this.internalStore.getAllCookies(cb);
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
waitUntilIdle() {
|
|
578
|
+
return Promise.allSettled(this.tasks).catch(console.error);
|
|
579
|
+
}
|
|
580
|
+
async putCookieInternal(cookie, store) {
|
|
581
|
+
await this.waitUntilIdle();
|
|
582
|
+
return await new Promise((resolve, reject)=>{
|
|
583
|
+
store.putCookie(cookie, (err)=>{
|
|
584
|
+
if (err) reject(err);
|
|
585
|
+
else resolve(cookie);
|
|
586
|
+
});
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
serializeCallback(err, cookies) {
|
|
590
|
+
if (err) {
|
|
591
|
+
console.error(err);
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
const cookieObjs = cookies.map((cookie)=>cookie);
|
|
595
|
+
const idx = {};
|
|
596
|
+
for (const cookie of cookieObjs){
|
|
597
|
+
const domain = cookie.domain;
|
|
598
|
+
if (typeof domain === "string") {
|
|
599
|
+
const path = cookie.path ?? "/";
|
|
600
|
+
const key = cookie.key;
|
|
601
|
+
(0, $cDXzb$lodash.merge)(idx, {
|
|
602
|
+
[domain]: {
|
|
603
|
+
[path]: {
|
|
604
|
+
[key]: cookie.toJSON()
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
const stringify = JSON.stringify(idx, null, 2);
|
|
611
|
+
(0, $cDXzb$fs.writeFile)(this.filePath, stringify, (err)=>{
|
|
612
|
+
if (err) console.error(err);
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
const $14bfa2612c55b48d$var$memoryCookieStore = new (0, $cDXzb$toughcookie.MemoryCookieStore)();
|
|
619
|
+
async function $14bfa2612c55b48d$var$getCookieStore() {
|
|
620
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b)["cs"] == "memory") return $14bfa2612c55b48d$var$memoryCookieStore;
|
|
621
|
+
const fileCookieStore = new (0, $30e4b5d3291f1a19$export$55374e421ca433de)(`${(0, $9aaa37efbfec96e1$export$a7b6bc01c63cdfc3)["HOME"]}/cookie-star.json`, $14bfa2612c55b48d$var$memoryCookieStore);
|
|
622
|
+
await fileCookieStore.waitUntilIdle();
|
|
623
|
+
return fileCookieStore;
|
|
624
|
+
}
|
|
625
|
+
const $14bfa2612c55b48d$export$2c043f03eceff4e8 = new Promise((resolve)=>{
|
|
626
|
+
$14bfa2612c55b48d$var$getCookieStore().then(resolve);
|
|
627
|
+
});
|
|
628
|
+
const $14bfa2612c55b48d$export$eced8873dedbb4c0 = new Promise((resolve)=>{
|
|
629
|
+
$14bfa2612c55b48d$export$2c043f03eceff4e8.then((store)=>new (0, $cDXzb$toughcookie.CookieJar)(store)).then(resolve);
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
class $7fc5b30fe5c37771$export$2e2bcd8739ae039 {
|
|
520
635
|
browserName = "internal";
|
|
521
636
|
async queryCookies(name, domain) {
|
|
522
637
|
const exportedCookies = [];
|
|
@@ -547,10 +662,10 @@ class $e4efb16e005540de$export$2e2bcd8739ae039 {
|
|
|
547
662
|
exportedCookies.push(...domainCookies);
|
|
548
663
|
}
|
|
549
664
|
if (name == "%") return exportedCookies.filter((cookie)=>{
|
|
550
|
-
return cookie.domain.match((0, $
|
|
665
|
+
return cookie.domain.match((0, $0dadf812b76e7b53$export$4eadcf0bf35a2ddb)(domain));
|
|
551
666
|
});
|
|
552
667
|
return exportedCookies.filter((cookie)=>{
|
|
553
|
-
return cookie.name.match((0, $
|
|
668
|
+
return cookie.name.match((0, $0dadf812b76e7b53$export$4eadcf0bf35a2ddb)(name)) && cookie.domain.match((0, $0dadf812b76e7b53$export$4eadcf0bf35a2ddb)(domain));
|
|
554
669
|
});
|
|
555
670
|
}
|
|
556
671
|
#extracted(cookie, cookieSpec) {
|
|
@@ -564,19 +679,19 @@ class $e4efb16e005540de$export$2e2bcd8739ae039 {
|
|
|
564
679
|
}
|
|
565
680
|
};
|
|
566
681
|
}
|
|
567
|
-
|
|
682
|
+
async #getCookies(url) {
|
|
683
|
+
const cookieJar = await (0, $14bfa2612c55b48d$export$eced8873dedbb4c0);
|
|
568
684
|
return new Promise((resolve, reject)=>{
|
|
569
|
-
|
|
570
|
-
return (0, $53a3bcc99a05dfcf$export$928a906645f9d018).getCookies(url, (err, cookies)=>{
|
|
685
|
+
return cookieJar.getCookies(url, (err, cookies)=>{
|
|
571
686
|
if (err) reject(err);
|
|
572
687
|
else resolve(cookies ?? []);
|
|
573
688
|
});
|
|
574
689
|
});
|
|
575
690
|
}
|
|
576
|
-
|
|
691
|
+
async #getAllCookies() {
|
|
692
|
+
const cookieStore = await (0, $14bfa2612c55b48d$export$2c043f03eceff4e8);
|
|
577
693
|
return new Promise((resolve, reject)=>{
|
|
578
|
-
|
|
579
|
-
return (0, $53a3bcc99a05dfcf$export$6c62df16f2e9c7e8).getAllCookies((err, cookies)=>{
|
|
694
|
+
return cookieStore.getAllCookies((err, cookies)=>{
|
|
580
695
|
if (err) reject(err);
|
|
581
696
|
else resolve(cookies ?? []);
|
|
582
697
|
});
|
|
@@ -588,19 +703,19 @@ class $e4efb16e005540de$export$2e2bcd8739ae039 {
|
|
|
588
703
|
|
|
589
704
|
|
|
590
705
|
|
|
591
|
-
const $
|
|
706
|
+
const $9b213ca499318f10$var$cache = new (0, ($parcel$interopDefault($cDXzb$lrucache)))({
|
|
592
707
|
ttl: 2000,
|
|
593
708
|
max: 10
|
|
594
709
|
});
|
|
595
|
-
class $
|
|
710
|
+
class $9b213ca499318f10$export$2e2bcd8739ae039 {
|
|
596
711
|
browserName = "all";
|
|
597
712
|
#strategies;
|
|
598
713
|
constructor(){
|
|
599
714
|
this.#strategies = [
|
|
600
|
-
(0, $
|
|
601
|
-
(0, $
|
|
602
|
-
(0, $
|
|
603
|
-
(0, $
|
|
715
|
+
(0, $7fc5b30fe5c37771$export$2e2bcd8739ae039),
|
|
716
|
+
(0, $2863e754fd8bb18c$export$2e2bcd8739ae039),
|
|
717
|
+
(0, $5df4e8bfccec8ffc$export$2e2bcd8739ae039),
|
|
718
|
+
(0, $0ca9bb20e90816f9$export$2e2bcd8739ae039),
|
|
604
719
|
].map((strategy)=>{
|
|
605
720
|
return new strategy();
|
|
606
721
|
});
|
|
@@ -608,26 +723,26 @@ class $f72befa528c23ca7$export$2e2bcd8739ae039 {
|
|
|
608
723
|
async queryCookies(name, domain) {
|
|
609
724
|
// domain = domain.match(/(\w+.+\w+)/gi)?.pop() ?? domain;
|
|
610
725
|
const key = `${name}:${domain}`;
|
|
611
|
-
const cached = $
|
|
726
|
+
const cached = $9b213ca499318f10$var$cache.get(key);
|
|
612
727
|
if (cached) return cached;
|
|
613
|
-
if ((0, $
|
|
728
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log("Querying cookies:", name, domain);
|
|
614
729
|
const results = await Promise.all(this.#strategies.map(async (strategy)=>{
|
|
615
730
|
// @ts-ignore
|
|
616
731
|
return strategy.queryCookies(name, domain).then((cookies)=>{
|
|
617
732
|
return cookies.map((cookie)=>{
|
|
618
|
-
return (0, $
|
|
733
|
+
return (0, $cDXzb$lodash.merge)(cookie, {
|
|
619
734
|
meta: {
|
|
620
735
|
browser: strategy.browserName
|
|
621
736
|
}
|
|
622
737
|
});
|
|
623
738
|
});
|
|
624
739
|
}).catch((e)=>{
|
|
625
|
-
console.log((0, $
|
|
740
|
+
console.log((0, $cDXzb$colorette.red)(`Error querying ${strategy.browserName} cookies`), e);
|
|
626
741
|
return [];
|
|
627
742
|
});
|
|
628
743
|
}));
|
|
629
744
|
const flat = results.flat();
|
|
630
|
-
$
|
|
745
|
+
$9b213ca499318f10$var$cache.set(`${name}:${domain}`, flat);
|
|
631
746
|
return flat;
|
|
632
747
|
}
|
|
633
748
|
}
|
|
@@ -635,12 +750,12 @@ class $f72befa528c23ca7$export$2e2bcd8739ae039 {
|
|
|
635
750
|
|
|
636
751
|
|
|
637
752
|
|
|
638
|
-
function $
|
|
753
|
+
function $02c6d50814f70012$export$2e2bcd8739ae039(token) {
|
|
639
754
|
try {
|
|
640
|
-
const result = (0, ($parcel$interopDefault($
|
|
755
|
+
const result = (0, ($parcel$interopDefault($cDXzb$jsonwebtoken))).decode(token, {
|
|
641
756
|
complete: true
|
|
642
757
|
});
|
|
643
|
-
if ((0, $
|
|
758
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose && result) console.log(result);
|
|
644
759
|
const payload = result?.payload;
|
|
645
760
|
if (payload) {
|
|
646
761
|
const exp = payload.exp;
|
|
@@ -656,27 +771,27 @@ function $9a6b2ace073cf1d7$export$2e2bcd8739ae039(token) {
|
|
|
656
771
|
}
|
|
657
772
|
|
|
658
773
|
|
|
659
|
-
async function $
|
|
774
|
+
async function $adc20573c5fde3a5$export$e6d428437cf2cacb({ name: name , domain: domain }, strategy = new (0, $9b213ca499318f10$export$2e2bcd8739ae039)()) {
|
|
660
775
|
const results = await strategy.queryCookies(name, domain);
|
|
661
|
-
const allCookies = (0, $
|
|
662
|
-
if ((0, $
|
|
776
|
+
const allCookies = (0, $cDXzb$lodash.uniqBy)(results, JSON.stringify);
|
|
777
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b)["require-jwt"]) {
|
|
663
778
|
const jwtCookies = [];
|
|
664
779
|
for (const result of allCookies){
|
|
665
780
|
const value = result.value;
|
|
666
|
-
if ((0, $
|
|
781
|
+
if ((0, $02c6d50814f70012$export$2e2bcd8739ae039)(value)) jwtCookies.push(result);
|
|
667
782
|
}
|
|
668
|
-
return (0, $
|
|
783
|
+
return (0, $7b83c0e89cc28a81$export$c348dfaf65040d9b)["single"] ? [
|
|
669
784
|
jwtCookies[0]
|
|
670
785
|
] : jwtCookies;
|
|
671
|
-
} else return (0, $
|
|
786
|
+
} else return (0, $7b83c0e89cc28a81$export$c348dfaf65040d9b)["single"] ? [
|
|
672
787
|
allCookies[0]
|
|
673
788
|
] : allCookies;
|
|
674
789
|
}
|
|
675
790
|
|
|
676
791
|
|
|
677
792
|
|
|
678
|
-
async function $
|
|
679
|
-
const cookies = await (0, $
|
|
793
|
+
async function $5059c79c511ef67d$export$4be65e66cfa2648a(params) {
|
|
794
|
+
const cookies = await (0, $adc20573c5fde3a5$export$e6d428437cf2cacb)(params, new (0, $9b213ca499318f10$export$2e2bcd8739ae039)());
|
|
680
795
|
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
681
796
|
else throw new Error("Cookie not found");
|
|
682
797
|
}
|
|
@@ -685,17 +800,17 @@ async function $8481e2034946cc4b$export$4be65e66cfa2648a(params) {
|
|
|
685
800
|
|
|
686
801
|
|
|
687
802
|
|
|
688
|
-
async function $
|
|
689
|
-
const cookies = await (0, $
|
|
803
|
+
async function $0d142dad92c7a441$export$e5637297e9eb6f2e(params) {
|
|
804
|
+
const cookies = await (0, $adc20573c5fde3a5$export$e6d428437cf2cacb)(params, new (0, $2863e754fd8bb18c$export$2e2bcd8739ae039)());
|
|
690
805
|
if (cookies.length == 0) throw new Error("Cookie not found");
|
|
691
|
-
return cookies.find((0, $
|
|
806
|
+
return cookies.find((0, $5ab7b2322194eec8$export$963c8d651337e4a4));
|
|
692
807
|
}
|
|
693
808
|
|
|
694
809
|
|
|
695
810
|
|
|
696
811
|
|
|
697
|
-
async function $
|
|
698
|
-
const cookies = await (0, $
|
|
812
|
+
async function $2c9cc1b8a57118d9$export$c44c5fdef43f0941(params) {
|
|
813
|
+
const cookies = await (0, $adc20573c5fde3a5$export$e6d428437cf2cacb)(params, new (0, $5df4e8bfccec8ffc$export$2e2bcd8739ae039)());
|
|
699
814
|
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
700
815
|
else throw new Error("Cookie not found");
|
|
701
816
|
}
|
|
@@ -703,53 +818,53 @@ async function $f9b70200901ad17d$export$c44c5fdef43f0941(params) {
|
|
|
703
818
|
|
|
704
819
|
|
|
705
820
|
|
|
706
|
-
function $
|
|
821
|
+
function $146fc82c45a46a88$export$9abc0a414b0d8b8f(results) {
|
|
707
822
|
// sort by name and expiry descending
|
|
708
823
|
// takes the latest expiry for each name
|
|
709
|
-
const orderedResults = (0, $
|
|
824
|
+
const orderedResults = (0, $cDXzb$lodash.orderBy)(results, [
|
|
710
825
|
"name",
|
|
711
826
|
"expiry"
|
|
712
827
|
], [
|
|
713
828
|
"asc",
|
|
714
829
|
"desc"
|
|
715
830
|
]);
|
|
716
|
-
return (0, $
|
|
831
|
+
return (0, $cDXzb$lodash.uniqBy)(orderedResults, (r)=>r.name).map((r)=>r.name + "=" + r.value).join("; ");
|
|
717
832
|
}
|
|
718
833
|
|
|
719
834
|
|
|
720
835
|
|
|
721
836
|
|
|
722
|
-
async function $
|
|
837
|
+
async function $662fc5266a187ee3$export$a65902517ae87ba8(cookieSpec) {
|
|
723
838
|
const cookies = [];
|
|
724
839
|
if (Array.isArray(cookieSpec)) {
|
|
725
840
|
const results = await Promise.all(cookieSpec.map((cs)=>{
|
|
726
|
-
return (0, $
|
|
841
|
+
return (0, $adc20573c5fde3a5$export$e6d428437cf2cacb)(cs);
|
|
727
842
|
}));
|
|
728
843
|
for (const exportedCookie of results.flat())cookies.push(exportedCookie);
|
|
729
844
|
} else {
|
|
730
|
-
const singleQuery = await (0, $
|
|
845
|
+
const singleQuery = await (0, $adc20573c5fde3a5$export$e6d428437cf2cacb)(cookieSpec);
|
|
731
846
|
cookies.push(...singleQuery);
|
|
732
847
|
}
|
|
733
|
-
return (0, $
|
|
848
|
+
return (0, $cDXzb$lodash.uniqBy)(cookies, JSON.stringify);
|
|
734
849
|
}
|
|
735
850
|
|
|
736
851
|
|
|
737
|
-
async function $
|
|
738
|
-
const cookies = await (0, $
|
|
852
|
+
async function $3250e6c7c8746c6f$export$4d2e9997e2c23417(cookieSpec) {
|
|
853
|
+
const cookies = await (0, $662fc5266a187ee3$export$a65902517ae87ba8)(cookieSpec);
|
|
739
854
|
if (cookies.length == 0) throw new Error("Cookie not found");
|
|
740
|
-
const groupedByFile = (0, $
|
|
855
|
+
const groupedByFile = (0, $cDXzb$lodash.groupBy)(cookies, (r)=>r.meta?.file);
|
|
741
856
|
return Object.keys(groupedByFile).map((file)=>{
|
|
742
857
|
const results = groupedByFile[file];
|
|
743
|
-
return (0, $
|
|
858
|
+
return (0, $146fc82c45a46a88$export$9abc0a414b0d8b8f)(results);
|
|
744
859
|
});
|
|
745
860
|
}
|
|
746
861
|
|
|
747
862
|
|
|
748
863
|
|
|
749
864
|
|
|
750
|
-
async function $
|
|
751
|
-
const cookies = await (0, $
|
|
752
|
-
if (cookies.length > 0) return (0, $
|
|
865
|
+
async function $01a8b57f5e2fbc3a$export$cfc0723de5712e57(cookieSpec) {
|
|
866
|
+
const cookies = await (0, $662fc5266a187ee3$export$a65902517ae87ba8)(cookieSpec);
|
|
867
|
+
if (cookies.length > 0) return (0, $146fc82c45a46a88$export$9abc0a414b0d8b8f)(cookies);
|
|
753
868
|
return "";
|
|
754
869
|
}
|
|
755
870
|
|
|
@@ -763,7 +878,7 @@ async function $4ffeaeb7bb3c0319$export$cfc0723de5712e57(cookieSpec) {
|
|
|
763
878
|
|
|
764
879
|
|
|
765
880
|
|
|
766
|
-
function $
|
|
881
|
+
function $2788377d65b088d2$export$f266452a5050185d(url) {
|
|
767
882
|
const url1 = typeof url == "string" ? new URL(url) : url;
|
|
768
883
|
const cookieSpecs = [];
|
|
769
884
|
const splits = url1.hostname.split(".");
|
|
@@ -784,18 +899,18 @@ function $2d84054eb5f070a6$export$f266452a5050185d(url) {
|
|
|
784
899
|
domain: tld
|
|
785
900
|
};
|
|
786
901
|
cookieSpecs.push(cookieSpec2);
|
|
787
|
-
return (0, $
|
|
902
|
+
return (0, $cDXzb$lodash.uniqBy)(cookieSpecs, JSON.stringify);
|
|
788
903
|
}
|
|
789
904
|
|
|
790
905
|
|
|
791
|
-
const $
|
|
792
|
-
async function $
|
|
906
|
+
const $9784c2ab321f9dab$var$userAgent = new (0, ($parcel$interopDefault($cDXzb$useragents)))().toString();
|
|
907
|
+
async function $9784c2ab321f9dab$export$b24a545a0b39f491(url, options = {}, fetch = (0, $cDXzb$crossfetch.fetch), originalRequest) {
|
|
793
908
|
const originalRequest1 = originalRequest || {
|
|
794
909
|
url: url,
|
|
795
910
|
options: options
|
|
796
911
|
};
|
|
797
912
|
const headers = {
|
|
798
|
-
"User-Agent": $
|
|
913
|
+
"User-Agent": $9784c2ab321f9dab$var$userAgent
|
|
799
914
|
};
|
|
800
915
|
const defaultOptions = {
|
|
801
916
|
headers: headers,
|
|
@@ -803,10 +918,13 @@ async function $cfc07ae4aa2c7e44$export$b24a545a0b39f491(url, options = {}, fetc
|
|
|
803
918
|
};
|
|
804
919
|
const url2 = `${url}`;
|
|
805
920
|
const url1 = new URL(url2);
|
|
806
|
-
const cookieSpecs = (0, $
|
|
807
|
-
headers["Cookie"] = await (0, $
|
|
808
|
-
if ((0, $
|
|
809
|
-
|
|
921
|
+
const cookieSpecs = (0, $2788377d65b088d2$export$f266452a5050185d)(url1);
|
|
922
|
+
headers["Cookie"] = await (0, $01a8b57f5e2fbc3a$export$cfc0723de5712e57)(cookieSpecs).catch(()=>"");
|
|
923
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b)["dump-request-headers"]) {
|
|
924
|
+
console.log((0, $cDXzb$colorette.redBright)("Request URL:"), url1.href);
|
|
925
|
+
console.log((0, $cDXzb$colorette.blue)("Request headers:"), headers);
|
|
926
|
+
}
|
|
927
|
+
const newOptions1 = (0, $cDXzb$lodash.merge)(defaultOptions, {
|
|
810
928
|
headers: headers
|
|
811
929
|
}, options);
|
|
812
930
|
try {
|
|
@@ -819,16 +937,17 @@ async function $cfc07ae4aa2c7e44$export$b24a545a0b39f491(url, options = {}, fetc
|
|
|
819
937
|
]);
|
|
820
938
|
});
|
|
821
939
|
for (const [key, value] of headers1)if (key === "set-cookie") {
|
|
822
|
-
await (0, $
|
|
823
|
-
|
|
940
|
+
const cookieJar1 = await (0, $14bfa2612c55b48d$export$eced8873dedbb4c0);
|
|
941
|
+
await cookieJar1.setCookie(value, url2);
|
|
942
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log((0, $cDXzb$colorette.blue)(`Set-Cookie:`), (0, $cDXzb$colorette.yellow)(value), (0, $cDXzb$colorette.yellow)(url2));
|
|
824
943
|
}
|
|
825
944
|
const newUrl = res.headers.get("location") ?? res.url;
|
|
826
|
-
const sameHost = new URL(newUrl).host === url1.host;
|
|
945
|
+
// const sameHost = new URL(newUrl).host === url1.host;
|
|
827
946
|
if (res.status == 301 || res.status == 302) // follow the redirect
|
|
828
947
|
{
|
|
829
948
|
if (newUrl && newUrl !== url2) {
|
|
830
|
-
if ((0, $
|
|
831
|
-
return $
|
|
949
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose || (0, $7b83c0e89cc28a81$export$c348dfaf65040d9b)["dump-response-headers"]) console.log((0, $cDXzb$colorette.blue)(`Redirected to `), (0, $cDXzb$colorette.yellow)(newUrl));
|
|
950
|
+
return $9784c2ab321f9dab$export$b24a545a0b39f491(//
|
|
832
951
|
newUrl, newOptions1, fetch, originalRequest1);
|
|
833
952
|
}
|
|
834
953
|
}
|
|
@@ -839,22 +958,22 @@ async function $cfc07ae4aa2c7e44$export$b24a545a0b39f491(url, options = {}, fetc
|
|
|
839
958
|
case "POST":
|
|
840
959
|
case "PUT":
|
|
841
960
|
case "DELETE":
|
|
842
|
-
(0, $
|
|
961
|
+
(0, $cDXzb$lodash.merge)(newOptions2, newOptions1, {
|
|
843
962
|
method: "GET"
|
|
844
963
|
});
|
|
845
964
|
newOptions2.body = undefined; // TODO: is this needed?
|
|
846
965
|
break;
|
|
847
966
|
case "HEAD":
|
|
848
967
|
case "GET":
|
|
849
|
-
(0, $
|
|
968
|
+
(0, $cDXzb$lodash.merge)(newOptions2, newOptions1);
|
|
850
969
|
newOptions2.body = undefined; // TODO: is this needed?
|
|
851
970
|
break;
|
|
852
971
|
default:
|
|
853
|
-
(0, $
|
|
972
|
+
(0, $cDXzb$lodash.merge)(newOptions2, newOptions1);
|
|
854
973
|
break;
|
|
855
974
|
}
|
|
856
|
-
if ((0, $
|
|
857
|
-
return $
|
|
975
|
+
if ((0, $7b83c0e89cc28a81$export$c348dfaf65040d9b).verbose) console.log((0, $cDXzb$colorette.blue)(`Redirected to `), (0, $cDXzb$colorette.yellow)(newUrl));
|
|
976
|
+
return $9784c2ab321f9dab$export$b24a545a0b39f491(//
|
|
858
977
|
newUrl, newOptions2, fetch, originalRequest1);
|
|
859
978
|
}
|
|
860
979
|
const arrayBuffer1 = res.arrayBuffer();
|
|
@@ -868,7 +987,7 @@ async function $cfc07ae4aa2c7e44$export$b24a545a0b39f491(url, options = {}, fetc
|
|
|
868
987
|
return buffer().then((buffer)=>buffer.toString("utf8"));
|
|
869
988
|
}
|
|
870
989
|
async function json() {
|
|
871
|
-
return text().then((text)=>(0, ($parcel$interopDefault($
|
|
990
|
+
return text().then((text)=>(0, ($parcel$interopDefault($cDXzb$destr)))(text));
|
|
872
991
|
}
|
|
873
992
|
async function formData() {
|
|
874
993
|
const urlSearchParams = await text().then((text)=>new URLSearchParams(text));
|
|
@@ -884,25 +1003,25 @@ async function $cfc07ae4aa2c7e44$export$b24a545a0b39f491(url, options = {}, fetc
|
|
|
884
1003
|
buffer: buffer,
|
|
885
1004
|
formData: formData
|
|
886
1005
|
};
|
|
887
|
-
return (0, $
|
|
1006
|
+
return (0, $cDXzb$lodash.merge)(res1, source2);
|
|
888
1007
|
} catch (e) {
|
|
889
1008
|
throw e;
|
|
890
1009
|
}
|
|
891
1010
|
}
|
|
892
1011
|
|
|
893
1012
|
|
|
894
|
-
var $
|
|
1013
|
+
var $36f7eea49875091b$exports = {};
|
|
895
1014
|
|
|
896
1015
|
|
|
897
|
-
var $
|
|
1016
|
+
var $80f8b323ce8fd8b7$exports = {};
|
|
898
1017
|
|
|
899
1018
|
|
|
900
|
-
var $
|
|
1019
|
+
var $bf28d13de48682c5$exports = {};
|
|
901
1020
|
|
|
902
1021
|
|
|
903
|
-
$parcel$exportWildcard(module.exports, $
|
|
904
|
-
$parcel$exportWildcard(module.exports, $
|
|
905
|
-
$parcel$exportWildcard(module.exports, $
|
|
1022
|
+
$parcel$exportWildcard(module.exports, $36f7eea49875091b$exports);
|
|
1023
|
+
$parcel$exportWildcard(module.exports, $80f8b323ce8fd8b7$exports);
|
|
1024
|
+
$parcel$exportWildcard(module.exports, $bf28d13de48682c5$exports);
|
|
906
1025
|
|
|
907
1026
|
|
|
908
1027
|
//# sourceMappingURL=index.js.map
|