@mherod/get-cookie 2.0.0-rc.1 → 2.0.0-rc.11
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/dist/index.js +413 -156
- package/package-lock.json +12295 -0
- package/package.json +12 -8
- package/src/CookieRow.ts +2 -1
- package/src/CookieSpec.ts +4 -2
- package/src/CookieStore.ts +11 -0
- package/src/ExportedCookie.ts +2 -1
- package/src/FetchResponse.ts +2 -0
- package/src/IsCookieRow.ts +1 -1
- package/src/IsExportedCookie.ts +1 -1
- package/src/SpecialCases.ts +1 -1
- package/src/StringToRegex.ts +6 -0
- package/src/argv.ts +4 -0
- package/src/browsers/ChromeCookieQueryStrategy.ts +106 -24
- package/src/browsers/CompositeCookieQueryStrategy.ts +32 -8
- package/src/browsers/CookieQueryStrategy.ts +3 -1
- package/src/browsers/CookieStoreQueryStrategy.ts +94 -0
- package/src/browsers/FirefoxCookieQueryStrategy.ts +5 -3
- package/src/browsers/SafariCookieQueryStrategy.ts +3 -1
- package/src/cli.ts +101 -93
- package/src/comboQueryCookieSpec.ts +21 -0
- package/src/cookieSpecsFromUrl.ts +26 -0
- package/src/doSqliteQuery1.ts +4 -8
- package/src/doSqliteQuery1Params.ts +8 -0
- package/src/fetchWithCookies.ts +79 -34
- package/src/findAllFiles.ts +5 -9
- package/src/getChromeCookie.ts +19 -0
- package/src/getCookie.ts +19 -0
- package/src/getFirefoxCookie.ts +19 -0
- package/src/getGroupedRenderedCookies.ts +12 -25
- package/src/getMergedRenderedCookies.ts +14 -0
- package/src/index.ts +13 -52
- package/src/isValidJwt.ts +2 -2
- package/src/queryCookies.ts +16 -12
- package/src/resultsRendered.ts +7 -4
- package/src/unpackHeaders.ts +7 -4
- package/src/utils.ts +0 -25
- package/dist/cli.js +0 -3
- package/dist/cli.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/module.js +0 -586
- package/dist/module.js.map +0 -1
- package/dist/types.d.ts +0 -35
- package/dist/types.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var $7oI3p$lodash = require("lodash");
|
|
3
|
+
var $7oI3p$minimist = require("minimist");
|
|
3
4
|
var $7oI3p$lrucache = require("lru-cache");
|
|
5
|
+
var $7oI3p$colorette = require("colorette");
|
|
4
6
|
var $7oI3p$fs = require("fs");
|
|
5
7
|
var $7oI3p$crypto = require("crypto");
|
|
6
8
|
var $7oI3p$path = require("path");
|
|
7
|
-
var $7oI3p$child_process = require("child_process");
|
|
8
9
|
var $7oI3p$sqlite3 = require("sqlite3");
|
|
10
|
+
var $7oI3p$child_process = require("child_process");
|
|
11
|
+
var $7oI3p$toughcookie = require("tough-cookie");
|
|
12
|
+
var $7oI3p$toughcookiefilestore = require("tough-cookie-file-store");
|
|
9
13
|
var $7oI3p$jsonwebtoken = require("jsonwebtoken");
|
|
10
14
|
var $7oI3p$crossfetch = require("cross-fetch");
|
|
11
15
|
var $7oI3p$destr = require("destr");
|
|
16
|
+
var $7oI3p$useragents = require("user-agents");
|
|
12
17
|
|
|
13
18
|
function $parcel$export(e, n, v, s) {
|
|
14
19
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
@@ -33,17 +38,16 @@ function $parcel$interopDefault(a) {
|
|
|
33
38
|
return a && a.__esModule ? a.default : a;
|
|
34
39
|
}
|
|
35
40
|
|
|
36
|
-
$parcel$export(module.exports, "getCookie", () => $
|
|
37
|
-
$parcel$export(module.exports, "
|
|
38
|
-
$parcel$export(module.exports, "
|
|
41
|
+
$parcel$export(module.exports, "getCookie", () => $8481e2034946cc4b$export$4be65e66cfa2648a);
|
|
42
|
+
$parcel$export(module.exports, "getChromeCookie", () => $1a92ef2038b55530$export$e5637297e9eb6f2e);
|
|
43
|
+
$parcel$export(module.exports, "getFirefoxCookie", () => $f9b70200901ad17d$export$c44c5fdef43f0941);
|
|
44
|
+
$parcel$export(module.exports, "getMergedRenderedCookies", () => $4ffeaeb7bb3c0319$export$cfc0723de5712e57);
|
|
39
45
|
$parcel$export(module.exports, "getGroupedRenderedCookies", () => $300d8b33187a203c$export$4d2e9997e2c23417);
|
|
40
46
|
$parcel$export(module.exports, "fetchWithCookies", () => $cfc07ae4aa2c7e44$export$b24a545a0b39f491);
|
|
41
47
|
|
|
42
|
-
const $fac425c10fbbada5$export$a7b6bc01c63cdfc3 = {};
|
|
43
|
-
(0, $7oI3p$lodash.merge)($fac425c10fbbada5$export$a7b6bc01c63cdfc3, process.env);
|
|
44
|
-
const $fac425c10fbbada5$export$a7c5707626fc90f = $fac425c10fbbada5$export$a7b6bc01c63cdfc3["HOME"];
|
|
45
|
-
if (!$fac425c10fbbada5$export$a7c5707626fc90f) throw new Error("HOME environment variable is not set");
|
|
46
48
|
|
|
49
|
+
const $ef3d5dc2fd8022f5$export$6f4ae1207c703045 = process.argv ?? [];
|
|
50
|
+
const $ef3d5dc2fd8022f5$export$c348dfaf65040d9b = (0, ($parcel$interopDefault($7oI3p$minimist)))($ef3d5dc2fd8022f5$export$6f4ae1207c703045.slice(2));
|
|
47
51
|
|
|
48
52
|
|
|
49
53
|
|
|
@@ -65,35 +69,26 @@ async function $25b78d6746d4ad48$export$8d71c74f97c0202e(command) {
|
|
|
65
69
|
});
|
|
66
70
|
});
|
|
67
71
|
}
|
|
68
|
-
function $25b78d6746d4ad48$export$d53bf2de587a369(result) {
|
|
69
|
-
if (result == null) return null;
|
|
70
|
-
if (process.env.VERBOSE) console.log("result", result);
|
|
71
|
-
if (typeof result === "string" && result.length > 0) return result;
|
|
72
|
-
if (result.slice && result.toString) // noinspection JSCheckFunctionSignatures
|
|
73
|
-
return result.toString("utf8");
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
function $25b78d6746d4ad48$export$99ce3e33a555daf1(input) {
|
|
77
|
-
return typeof input !== "string" || input.length === 0;
|
|
78
|
-
}
|
|
79
|
-
function $25b78d6746d4ad48$export$5348b46700dd771c(input) {
|
|
80
|
-
return typeof input == "string" && input.length > 0;
|
|
81
|
-
}
|
|
82
72
|
|
|
83
73
|
|
|
84
74
|
|
|
75
|
+
const $fac425c10fbbada5$export$a7b6bc01c63cdfc3 = {};
|
|
76
|
+
(0, $7oI3p$lodash.merge)($fac425c10fbbada5$export$a7b6bc01c63cdfc3, process.env);
|
|
77
|
+
const $fac425c10fbbada5$export$a7c5707626fc90f = $fac425c10fbbada5$export$a7b6bc01c63cdfc3["HOME"];
|
|
78
|
+
if (!$fac425c10fbbada5$export$a7c5707626fc90f) throw new Error("HOME environment variable is not set");
|
|
79
|
+
|
|
80
|
+
|
|
85
81
|
|
|
86
82
|
|
|
87
83
|
|
|
88
84
|
async function $e62c2c56eb720f29$export$2c9faf86071156ae({ path: path , name: name , maxDepth: maxDepth = 2 }) {
|
|
89
85
|
const rootSegments = path.split("/").length;
|
|
90
|
-
if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log(`Searching for ${name} in ${path}`);
|
|
91
86
|
const files = [];
|
|
92
87
|
let readdirSync;
|
|
93
88
|
try {
|
|
94
89
|
readdirSync = $7oI3p$fs.readdirSync(path);
|
|
95
90
|
} catch (e) {
|
|
96
|
-
if ((0, $
|
|
91
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log(`Error reading ${path}`, e);
|
|
97
92
|
return [];
|
|
98
93
|
}
|
|
99
94
|
for (const file of readdirSync){
|
|
@@ -102,7 +97,7 @@ async function $e62c2c56eb720f29$export$2c9faf86071156ae({ path: path , name: na
|
|
|
102
97
|
try {
|
|
103
98
|
stat = $7oI3p$fs.statSync(filePath);
|
|
104
99
|
} catch (e1) {
|
|
105
|
-
if ((0, $
|
|
100
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.error(`Error getting stat for ${filePath}`, e1);
|
|
106
101
|
continue;
|
|
107
102
|
}
|
|
108
103
|
if (stat.isDirectory()) {
|
|
@@ -114,11 +109,11 @@ async function $e62c2c56eb720f29$export$2c9faf86071156ae({ path: path , name: na
|
|
|
114
109
|
});
|
|
115
110
|
files.push(...subFiles);
|
|
116
111
|
} catch (e2) {
|
|
117
|
-
if ((0, $
|
|
112
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.error(e2);
|
|
118
113
|
}
|
|
119
114
|
} else if (file === name) files.push(filePath);
|
|
120
115
|
}
|
|
121
|
-
if ((0, $
|
|
116
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) {
|
|
122
117
|
if (files.length > 0) {
|
|
123
118
|
console.log(`Found ${files.length} ${name} files`);
|
|
124
119
|
console.log(files);
|
|
@@ -131,45 +126,6 @@ async function $e62c2c56eb720f29$export$2c9faf86071156ae({ path: path , name: na
|
|
|
131
126
|
|
|
132
127
|
|
|
133
128
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
async function $a085b524d8ee9fce$export$f19f611d1fa7c6f3({ file: file , sql: sql , rowTransform: rowTransform }) {
|
|
137
|
-
if (!file || file && !$7oI3p$fs.existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
|
|
138
|
-
const db = new $7oI3p$sqlite3.Database(file);
|
|
139
|
-
return new Promise((resolve, reject)=>{
|
|
140
|
-
db.all(sql, (err, rows)=>{
|
|
141
|
-
if (err) {
|
|
142
|
-
reject(err);
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
const rows1 = rows;
|
|
146
|
-
if (rows1 == null || rows1.length === 0) {
|
|
147
|
-
resolve([]);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (Array.isArray(rows1)) {
|
|
151
|
-
const cookieRows = rows1.map((row)=>{
|
|
152
|
-
const newVar = {
|
|
153
|
-
meta: {
|
|
154
|
-
file: file
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
const cookieRow = rowTransform(row);
|
|
158
|
-
return (0, $7oI3p$lodash.merge)(newVar, cookieRow);
|
|
159
|
-
});
|
|
160
|
-
resolve(cookieRows);
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (process.env.VERBOSE) console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
|
|
164
|
-
resolve([
|
|
165
|
-
rows1
|
|
166
|
-
]);
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
129
|
function $af69dfb8766652d8$export$bc926c43858bd3cb(obj) {
|
|
174
130
|
return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;
|
|
175
131
|
}
|
|
@@ -180,7 +136,18 @@ function $d66f40b581ba8bfa$export$963c8d651337e4a4(obj) {
|
|
|
180
136
|
}
|
|
181
137
|
|
|
182
138
|
|
|
139
|
+
function $68c0ed99fadee6ca$export$4eadcf0bf35a2ddb(s) {
|
|
140
|
+
const s1 = s.replaceAll(/\./gi, ".");
|
|
141
|
+
const s2 = s1.replace(/%/g, ".*");
|
|
142
|
+
const s3 = s2.replace(/\*/g, ".*");
|
|
143
|
+
return new RegExp(s3);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
183
149
|
class $269fe42bfd555305$export$2e2bcd8739ae039 {
|
|
150
|
+
browserName = "Chrome";
|
|
184
151
|
async queryCookies(name, domain) {
|
|
185
152
|
if (process.platform !== "darwin") throw new Error("This only works on macOS");
|
|
186
153
|
if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).FIREFOX_ONLY) return [];
|
|
@@ -199,7 +166,7 @@ async function $269fe42bfd555305$var$getPromise1(name, domain, file) {
|
|
|
199
166
|
file: file
|
|
200
167
|
});
|
|
201
168
|
} catch (e) {
|
|
202
|
-
if ((0, $
|
|
169
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Error getting encrypted cookie", e);
|
|
203
170
|
return [];
|
|
204
171
|
}
|
|
205
172
|
}
|
|
@@ -213,7 +180,7 @@ async function $269fe42bfd555305$var$getPromise(name, domain) {
|
|
|
213
180
|
const results1 = await Promise.all(promises);
|
|
214
181
|
return results1.flat().filter((0, $af69dfb8766652d8$export$bc926c43858bd3cb));
|
|
215
182
|
} catch (error) {
|
|
216
|
-
if ((0, $
|
|
183
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("error", error);
|
|
217
184
|
return [];
|
|
218
185
|
}
|
|
219
186
|
}
|
|
@@ -222,7 +189,7 @@ async function $269fe42bfd555305$var$decryptValue(password, encryptedValue) {
|
|
|
222
189
|
try {
|
|
223
190
|
d = await $269fe42bfd555305$var$decrypt(password, encryptedValue);
|
|
224
191
|
} catch (e) {
|
|
225
|
-
if ((0, $
|
|
192
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Error decrypting cookie", e);
|
|
226
193
|
d = null;
|
|
227
194
|
}
|
|
228
195
|
return d ?? encryptedValue.toString("utf-8");
|
|
@@ -235,49 +202,76 @@ async function $269fe42bfd555305$var$getChromeCookies({ name: name , domain: dom
|
|
|
235
202
|
const decryptedValue = await $269fe42bfd555305$var$decryptValue(password, encryptedValue);
|
|
236
203
|
const meta = {};
|
|
237
204
|
(0, $7oI3p$lodash.merge)(meta, cookieRow.meta ?? {});
|
|
238
|
-
|
|
205
|
+
const exportedCookie = {
|
|
239
206
|
domain: cookieRow.domain,
|
|
240
207
|
name: cookieRow.name,
|
|
241
208
|
value: decryptedValue,
|
|
242
209
|
meta: meta
|
|
243
210
|
};
|
|
211
|
+
const expiry = cookieRow.expiry;
|
|
212
|
+
const mergeExpiry = expiry != null && expiry > 0 ? {
|
|
213
|
+
expiry: new Date(expiry)
|
|
214
|
+
} : {
|
|
215
|
+
expiry: "Infinity"
|
|
216
|
+
};
|
|
217
|
+
(0, $7oI3p$lodash.merge)(exportedCookie, mergeExpiry);
|
|
218
|
+
return exportedCookie;
|
|
244
219
|
});
|
|
245
220
|
const results = (await Promise.all(decrypted)).filter((0, $d66f40b581ba8bfa$export$963c8d651337e4a4));
|
|
246
|
-
if ((0, $
|
|
221
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("results", results);
|
|
247
222
|
return results;
|
|
248
223
|
}
|
|
249
224
|
const $269fe42bfd555305$var$chromeLocal = $7oI3p$path.join((0, $fac425c10fbbada5$export$a7c5707626fc90f), "Library", "Application Support", "Google", "Chrome");
|
|
250
225
|
async function $269fe42bfd555305$var$getEncryptedChromeCookie({ name: name , domain: domain , file: file = $7oI3p$path.join($269fe42bfd555305$var$chromeLocal, "Default", "Cookies") }) {
|
|
251
226
|
if (!(0, $7oI3p$fs.existsSync)(file)) throw new Error(`File ${file} does not exist`);
|
|
252
|
-
if ((0, $
|
|
227
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) {
|
|
253
228
|
const s = file.split("/").slice(-3).join("/");
|
|
254
229
|
console.log(`Trying Chrome (at ${s}) cookie ${name} for domain ${domain}`);
|
|
255
230
|
}
|
|
256
231
|
let sql;
|
|
257
232
|
//language=SQL
|
|
258
|
-
sql = "SELECT
|
|
233
|
+
sql = "SELECT * FROM cookies";
|
|
234
|
+
// sql = "SELECT encrypted_value, name, host_key FROM cookies";
|
|
259
235
|
const wildcardRegexp = /^([*%])$/i;
|
|
260
236
|
const specifiedName = name.match(wildcardRegexp) == null;
|
|
261
237
|
const specifiedDomain = domain.match(wildcardRegexp) == null;
|
|
262
|
-
|
|
238
|
+
const wildcardDomain = domain.match(/[%*]/) != null;
|
|
239
|
+
const queryDomain = specifiedDomain && !wildcardDomain;
|
|
240
|
+
// if we have a wildcard domain, we need to use a regexp
|
|
241
|
+
if (specifiedName || queryDomain) {
|
|
263
242
|
sql += ` WHERE `;
|
|
264
243
|
if (specifiedName) {
|
|
265
244
|
sql += `name = '${name}'`;
|
|
266
|
-
if (
|
|
245
|
+
if (queryDomain) sql += ` AND `;
|
|
246
|
+
}
|
|
247
|
+
if (queryDomain) {
|
|
248
|
+
// leading dot replaced with % to match subdomains
|
|
249
|
+
const sqlEmbedDomain = domain.replace(/^[.%]?/, "%");
|
|
250
|
+
sql += `host_key LIKE '${sqlEmbedDomain}';`;
|
|
267
251
|
}
|
|
268
|
-
if (specifiedDomain) sql += `host_key LIKE '${domain}';`;
|
|
269
252
|
}
|
|
270
|
-
|
|
253
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("sql", sql);
|
|
254
|
+
const domainRegexp = (0, $68c0ed99fadee6ca$export$4eadcf0bf35a2ddb)(domain);
|
|
255
|
+
const sqliteQuery1 = await $269fe42bfd555305$export$bd52b72df8d0d261({
|
|
271
256
|
file: file,
|
|
272
257
|
sql: sql,
|
|
258
|
+
rowFilter: (row)=>{
|
|
259
|
+
return row["host_key"].match(domainRegexp) != null;
|
|
260
|
+
},
|
|
273
261
|
rowTransform: (row)=>{
|
|
274
|
-
|
|
262
|
+
const cookieRow = {
|
|
263
|
+
expiry: (row["expires_utc"] / 1000000 - 11644473600) * 1000,
|
|
275
264
|
domain: row["host_key"],
|
|
276
265
|
name: row["name"],
|
|
277
266
|
value: row["encrypted_value"]
|
|
278
267
|
};
|
|
268
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("CookieRow", cookieRow);
|
|
269
|
+
return cookieRow;
|
|
279
270
|
}
|
|
280
271
|
});
|
|
272
|
+
return sqliteQuery1.filter((row)=>{
|
|
273
|
+
return row.domain.match(domainRegexp) != null;
|
|
274
|
+
});
|
|
281
275
|
}
|
|
282
276
|
async function $269fe42bfd555305$var$getChromePassword() {
|
|
283
277
|
return (0, $25b78d6746d4ad48$export$8d71c74f97c0202e)('security find-generic-password -w -s "Chrome Safe Storage"');
|
|
@@ -290,21 +284,21 @@ async function $269fe42bfd555305$var$decrypt(password, encryptedData) {
|
|
|
290
284
|
if (!(encryptedData1 instanceof Buffer)) {
|
|
291
285
|
if (Array.isArray(encryptedData1) && encryptedData1[0] instanceof Buffer) {
|
|
292
286
|
[encryptedData1] = encryptedData1;
|
|
293
|
-
if ((0, $
|
|
287
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log(`encryptedData is an array of buffers, selected first: ${encryptedData1}`);
|
|
294
288
|
} else throw new Error("encryptedData must be a Buffer: " + encryptedData1);
|
|
295
289
|
encryptedData1 = Buffer.from(encryptedData1);
|
|
296
290
|
}
|
|
297
|
-
if ((0, $
|
|
291
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log(`Trying to decrypt with password ${password}`);
|
|
298
292
|
return new Promise((resolve, reject)=>{
|
|
299
293
|
$7oI3p$crypto.pbkdf2(password, "saltysalt", 1003, 16, "sha1", (error, buffer)=>{
|
|
300
294
|
try {
|
|
301
295
|
if (error) {
|
|
302
|
-
if ((0, $
|
|
296
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2", error);
|
|
303
297
|
reject(error);
|
|
304
298
|
return;
|
|
305
299
|
}
|
|
306
300
|
if (buffer.length !== 16) {
|
|
307
|
-
if ((0, $
|
|
301
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2, buffer length is not 16", buffer.length);
|
|
308
302
|
reject(new Error("Buffer length is not 16"));
|
|
309
303
|
return;
|
|
310
304
|
}
|
|
@@ -314,7 +308,7 @@ async function $269fe42bfd555305$var$decrypt(password, encryptedData) {
|
|
|
314
308
|
decipher.setAutoPadding(false);
|
|
315
309
|
if (encryptedData1 && encryptedData1.slice) encryptedData1 = encryptedData1.slice(3);
|
|
316
310
|
if (encryptedData1.length % 16 !== 0) {
|
|
317
|
-
if ((0, $
|
|
311
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Error doing pbkdf2, encryptedData length is not a multiple of 16", encryptedData1.length);
|
|
318
312
|
reject(new Error("encryptedData length is not a multiple of 16"));
|
|
319
313
|
return;
|
|
320
314
|
}
|
|
@@ -322,7 +316,7 @@ async function $269fe42bfd555305$var$decrypt(password, encryptedData) {
|
|
|
322
316
|
try {
|
|
323
317
|
decipher.final("utf-8");
|
|
324
318
|
} catch (e) {
|
|
325
|
-
if ((0, $
|
|
319
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Error doing decipher.final()", e);
|
|
326
320
|
reject(e);
|
|
327
321
|
return;
|
|
328
322
|
}
|
|
@@ -337,6 +331,43 @@ async function $269fe42bfd555305$var$decrypt(password, encryptedData) {
|
|
|
337
331
|
});
|
|
338
332
|
});
|
|
339
333
|
}
|
|
334
|
+
async function $269fe42bfd555305$export$bd52b72df8d0d261({ file: file , sql: sql , rowFilter: rowFilter = ()=>true , rowTransform: rowTransform }) {
|
|
335
|
+
if (!file || file && !(0, ($parcel$interopDefault($7oI3p$fs))).existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
|
|
336
|
+
const db = new $7oI3p$sqlite3.Database(file);
|
|
337
|
+
return new Promise((resolve, reject)=>{
|
|
338
|
+
db.all(sql, (err, rows)=>{
|
|
339
|
+
if (err) {
|
|
340
|
+
reject(err);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const rows1 = rows;
|
|
344
|
+
if (rows1 == null || rows1.length === 0) {
|
|
345
|
+
resolve([]);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
if (Array.isArray(rows1)) {
|
|
349
|
+
const cookieRows = rows1.filter(rowFilter).map((row)=>{
|
|
350
|
+
const newVar = {
|
|
351
|
+
meta: {
|
|
352
|
+
file: file
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
const cookieRow = rowTransform(row);
|
|
356
|
+
return (0, $7oI3p$lodash.merge)(newVar, cookieRow);
|
|
357
|
+
});
|
|
358
|
+
resolve(cookieRows);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
|
|
362
|
+
resolve([
|
|
363
|
+
rows1
|
|
364
|
+
]);
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
340
371
|
|
|
341
372
|
|
|
342
373
|
|
|
@@ -344,6 +375,42 @@ async function $269fe42bfd555305$var$decrypt(password, encryptedData) {
|
|
|
344
375
|
|
|
345
376
|
|
|
346
377
|
|
|
378
|
+
async function $a085b524d8ee9fce$export$f19f611d1fa7c6f3({ file: file , sql: sql , rowTransform: rowTransform }) {
|
|
379
|
+
if (!file || file && !$7oI3p$fs.existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
|
|
380
|
+
const db = new $7oI3p$sqlite3.Database(file);
|
|
381
|
+
return new Promise((resolve, reject)=>{
|
|
382
|
+
db.all(sql, (err, rows)=>{
|
|
383
|
+
if (err) {
|
|
384
|
+
reject(err);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
const rows1 = rows;
|
|
388
|
+
if (rows1 == null || rows1.length === 0) {
|
|
389
|
+
resolve([]);
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (Array.isArray(rows1)) {
|
|
393
|
+
const cookieRows = rows1.map((row)=>{
|
|
394
|
+
const newVar = {
|
|
395
|
+
meta: {
|
|
396
|
+
file: file
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
const cookieRow = rowTransform(row);
|
|
400
|
+
return (0, $7oI3p$lodash.merge)(newVar, cookieRow);
|
|
401
|
+
});
|
|
402
|
+
resolve(cookieRows);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
|
|
406
|
+
resolve([
|
|
407
|
+
rows1
|
|
408
|
+
]);
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
|
|
347
414
|
function $b744d19cc39f964e$export$da22813e5a2ec500({ name: name , domain: domain }) {
|
|
348
415
|
const wildcardRegexp = /^([*%])$/i;
|
|
349
416
|
return {
|
|
@@ -354,6 +421,7 @@ function $b744d19cc39f964e$export$da22813e5a2ec500({ name: name , domain: domain
|
|
|
354
421
|
|
|
355
422
|
|
|
356
423
|
class $7bb7da9a77b2fd99$export$2e2bcd8739ae039 {
|
|
424
|
+
browserName = "Firefox";
|
|
357
425
|
async queryCookies(name, domain) {
|
|
358
426
|
if (process.platform !== "darwin") throw new Error("This only works on macOS");
|
|
359
427
|
if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).CHROME_ONLY) return [];
|
|
@@ -423,6 +491,7 @@ class $7bb7da9a77b2fd99$export$2e2bcd8739ae039 {
|
|
|
423
491
|
|
|
424
492
|
|
|
425
493
|
class $fad6f51bd5c7bae2$export$2e2bcd8739ae039 {
|
|
494
|
+
browserName = "Safari";
|
|
426
495
|
async queryCookies(name, domain) {
|
|
427
496
|
return [];
|
|
428
497
|
}
|
|
@@ -430,14 +499,97 @@ class $fad6f51bd5c7bae2$export$2e2bcd8739ae039 {
|
|
|
430
499
|
|
|
431
500
|
|
|
432
501
|
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
var $53a3bcc99a05dfcf$require$FileCookieStore = $7oI3p$toughcookiefilestore.FileCookieStore;
|
|
506
|
+
const $53a3bcc99a05dfcf$export$6c62df16f2e9c7e8 = new $53a3bcc99a05dfcf$require$FileCookieStore(`${(0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3)["HOME"]}/cookie-star.json`);
|
|
507
|
+
const $53a3bcc99a05dfcf$export$928a906645f9d018 = new (0, $7oI3p$toughcookie.CookieJar)($53a3bcc99a05dfcf$export$6c62df16f2e9c7e8);
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
class $e4efb16e005540de$export$2e2bcd8739ae039 {
|
|
512
|
+
browserName = "internal";
|
|
513
|
+
async queryCookies(name, domain) {
|
|
514
|
+
const exportedCookies = [];
|
|
515
|
+
// if (name.match(/[%*]/) || domain.match(/[%*]/)) {
|
|
516
|
+
const cookies = await this.#getAllCookies();
|
|
517
|
+
const allExportedCookies = cookies.map((cookie)=>{
|
|
518
|
+
return this.#extracted(cookie, {
|
|
519
|
+
name: name,
|
|
520
|
+
domain: domain
|
|
521
|
+
});
|
|
522
|
+
});
|
|
523
|
+
exportedCookies.push(...allExportedCookies);
|
|
524
|
+
// }
|
|
525
|
+
const wildcardRegexp = /^([*%])$/i;
|
|
526
|
+
if (name.match(wildcardRegexp) && domain.match(wildcardRegexp)) return exportedCookies;
|
|
527
|
+
const path = "/";
|
|
528
|
+
if (domain != "%") {
|
|
529
|
+
const domain1 = domain.match(/(\w+.+\w+)/gi)?.pop() ?? domain;
|
|
530
|
+
const url = new URL("https://" + domain1);
|
|
531
|
+
url.pathname = path;
|
|
532
|
+
const cookies1 = await this.#getCookies(url.href);
|
|
533
|
+
const domainCookies = cookies1.map((cookie)=>{
|
|
534
|
+
return this.#extracted(cookie, {
|
|
535
|
+
domain: domain,
|
|
536
|
+
name: name
|
|
537
|
+
});
|
|
538
|
+
});
|
|
539
|
+
exportedCookies.push(...domainCookies);
|
|
540
|
+
}
|
|
541
|
+
if (name == "%") return exportedCookies.filter((cookie)=>{
|
|
542
|
+
return cookie.domain.match((0, $68c0ed99fadee6ca$export$4eadcf0bf35a2ddb)(domain));
|
|
543
|
+
});
|
|
544
|
+
return exportedCookies.filter((cookie)=>{
|
|
545
|
+
return cookie.name.match((0, $68c0ed99fadee6ca$export$4eadcf0bf35a2ddb)(name)) && cookie.domain.match((0, $68c0ed99fadee6ca$export$4eadcf0bf35a2ddb)(domain));
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
#extracted(cookie, cookieSpec) {
|
|
549
|
+
return {
|
|
550
|
+
domain: cookie.domain ?? cookieSpec.domain,
|
|
551
|
+
name: cookie.key ?? cookieSpec.name,
|
|
552
|
+
value: cookie.value,
|
|
553
|
+
expiry: cookie.expires ?? "Infinity",
|
|
554
|
+
meta: {
|
|
555
|
+
file: "tough-cookie"
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
#getCookies(url) {
|
|
560
|
+
return new Promise((resolve, reject)=>{
|
|
561
|
+
// @ts-ignore
|
|
562
|
+
return (0, $53a3bcc99a05dfcf$export$928a906645f9d018).getCookies(url, (err, cookies)=>{
|
|
563
|
+
if (err) reject(err);
|
|
564
|
+
else resolve(cookies ?? []);
|
|
565
|
+
});
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
#getAllCookies() {
|
|
569
|
+
return new Promise((resolve, reject)=>{
|
|
570
|
+
// @ts-ignore
|
|
571
|
+
return (0, $53a3bcc99a05dfcf$export$6c62df16f2e9c7e8).getAllCookies((err, cookies)=>{
|
|
572
|
+
if (err) reject(err);
|
|
573
|
+
else resolve(cookies ?? []);
|
|
574
|
+
});
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
|
|
433
583
|
const $f72befa528c23ca7$var$cache = new (0, ($parcel$interopDefault($7oI3p$lrucache)))({
|
|
434
584
|
ttl: 2000,
|
|
435
585
|
max: 10
|
|
436
586
|
});
|
|
437
587
|
class $f72befa528c23ca7$export$2e2bcd8739ae039 {
|
|
588
|
+
browserName = "all";
|
|
438
589
|
#strategies;
|
|
439
590
|
constructor(){
|
|
440
591
|
this.#strategies = [
|
|
592
|
+
(0, $e4efb16e005540de$export$2e2bcd8739ae039),
|
|
441
593
|
(0, $269fe42bfd555305$export$2e2bcd8739ae039),
|
|
442
594
|
(0, $7bb7da9a77b2fd99$export$2e2bcd8739ae039),
|
|
443
595
|
(0, $fad6f51bd5c7bae2$export$2e2bcd8739ae039),
|
|
@@ -446,13 +598,25 @@ class $f72befa528c23ca7$export$2e2bcd8739ae039 {
|
|
|
446
598
|
});
|
|
447
599
|
}
|
|
448
600
|
async queryCookies(name, domain) {
|
|
601
|
+
// domain = domain.match(/(\w+.+\w+)/gi)?.pop() ?? domain;
|
|
449
602
|
const key = `${name}:${domain}`;
|
|
450
603
|
const cached = $f72befa528c23ca7$var$cache.get(key);
|
|
451
604
|
if (cached) return cached;
|
|
605
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log("Querying cookies:", name, domain);
|
|
452
606
|
const results = await Promise.all(this.#strategies.map(async (strategy)=>{
|
|
453
607
|
// @ts-ignore
|
|
454
|
-
|
|
455
|
-
|
|
608
|
+
return strategy.queryCookies(name, domain).then((cookies)=>{
|
|
609
|
+
return cookies.map((cookie)=>{
|
|
610
|
+
return (0, $7oI3p$lodash.merge)(cookie, {
|
|
611
|
+
meta: {
|
|
612
|
+
browser: strategy.browserName
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
});
|
|
616
|
+
}).catch((e)=>{
|
|
617
|
+
console.log((0, $7oI3p$colorette.red)(`Error querying ${strategy.browserName} cookies`), e);
|
|
618
|
+
return [];
|
|
619
|
+
});
|
|
456
620
|
}));
|
|
457
621
|
const flat = results.flat();
|
|
458
622
|
$f72befa528c23ca7$var$cache.set(`${name}:${domain}`, flat);
|
|
@@ -468,7 +632,7 @@ function $9a6b2ace073cf1d7$export$2e2bcd8739ae039(token) {
|
|
|
468
632
|
const result = (0, ($parcel$interopDefault($7oI3p$jsonwebtoken))).decode(token, {
|
|
469
633
|
complete: true
|
|
470
634
|
});
|
|
471
|
-
if ((0, $
|
|
635
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose && result) console.log(result);
|
|
472
636
|
const payload = result?.payload;
|
|
473
637
|
if (payload) {
|
|
474
638
|
const exp = payload.exp;
|
|
@@ -486,98 +650,206 @@ function $9a6b2ace073cf1d7$export$2e2bcd8739ae039(token) {
|
|
|
486
650
|
|
|
487
651
|
async function $7a068a32d4710f0b$export$e6d428437cf2cacb({ name: name , domain: domain }, strategy = new (0, $f72befa528c23ca7$export$2e2bcd8739ae039)()) {
|
|
488
652
|
const results = await strategy.queryCookies(name, domain);
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
const
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
653
|
+
const allCookies = (0, $7oI3p$lodash.uniqBy)(results, JSON.stringify);
|
|
654
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b)["require-jwt"]) {
|
|
655
|
+
const jwtCookies = [];
|
|
656
|
+
for (const result of allCookies){
|
|
657
|
+
const value = result.value;
|
|
658
|
+
if ((0, $9a6b2ace073cf1d7$export$2e2bcd8739ae039)(value)) jwtCookies.push(result);
|
|
659
|
+
}
|
|
660
|
+
return (0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b)["single"] ? [
|
|
661
|
+
jwtCookies[0]
|
|
662
|
+
] : jwtCookies;
|
|
663
|
+
} else return (0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b)["single"] ? [
|
|
664
|
+
allCookies[0]
|
|
665
|
+
] : allCookies;
|
|
499
666
|
}
|
|
500
667
|
|
|
501
668
|
|
|
502
669
|
|
|
670
|
+
async function $8481e2034946cc4b$export$4be65e66cfa2648a(params) {
|
|
671
|
+
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $f72befa528c23ca7$export$2e2bcd8739ae039)());
|
|
672
|
+
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
673
|
+
else throw new Error("Cookie not found");
|
|
674
|
+
}
|
|
503
675
|
|
|
504
676
|
|
|
505
677
|
|
|
506
678
|
|
|
507
679
|
|
|
680
|
+
async function $1a92ef2038b55530$export$e5637297e9eb6f2e(params) {
|
|
681
|
+
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $269fe42bfd555305$export$2e2bcd8739ae039)());
|
|
682
|
+
if (cookies.length == 0) throw new Error("Cookie not found");
|
|
683
|
+
return cookies.find((0, $d66f40b581ba8bfa$export$963c8d651337e4a4));
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
async function $f9b70200901ad17d$export$c44c5fdef43f0941(params) {
|
|
690
|
+
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $7bb7da9a77b2fd99$export$2e2bcd8739ae039)());
|
|
691
|
+
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
692
|
+
else throw new Error("Cookie not found");
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
|
|
508
697
|
|
|
509
698
|
function $9c43c2ed82e63570$export$9abc0a414b0d8b8f(results) {
|
|
510
|
-
|
|
699
|
+
// sort by name and expiry descending
|
|
700
|
+
// takes the latest expiry for each name
|
|
701
|
+
const orderedResults = (0, $7oI3p$lodash.orderBy)(results, [
|
|
702
|
+
"name",
|
|
703
|
+
"expiry"
|
|
704
|
+
], [
|
|
705
|
+
"asc",
|
|
706
|
+
"desc"
|
|
707
|
+
]);
|
|
708
|
+
return (0, $7oI3p$lodash.uniqBy)(orderedResults, (r)=>r.name).map((r)=>r.name + "=" + r.value).join("; ");
|
|
511
709
|
}
|
|
512
710
|
|
|
513
711
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
async function $8ef2ebdbd659489d$export$a65902517ae87ba8(cookieSpec) {
|
|
715
|
+
const cookies = [];
|
|
716
|
+
if (Array.isArray(cookieSpec)) {
|
|
717
|
+
const cookieSpecs = cookieSpec;
|
|
718
|
+
for (const cookieSpec1 of cookieSpecs){
|
|
719
|
+
const cookies1 = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(cookieSpec1);
|
|
720
|
+
cookies.push(...cookies1);
|
|
721
|
+
}
|
|
722
|
+
} else {
|
|
723
|
+
const singleQuery = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(cookieSpec);
|
|
724
|
+
cookies.push(...singleQuery);
|
|
725
|
+
}
|
|
726
|
+
return (0, $7oI3p$lodash.uniqBy)(cookies, JSON.stringify);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
async function $300d8b33187a203c$export$4d2e9997e2c23417(cookieSpec) {
|
|
731
|
+
const cookies = await (0, $8ef2ebdbd659489d$export$a65902517ae87ba8)(cookieSpec);
|
|
732
|
+
if (cookies.length == 0) throw new Error("Cookie not found");
|
|
733
|
+
const groupedByFile = (0, $7oI3p$lodash.groupBy)(cookies, (r)=>r.meta?.file);
|
|
734
|
+
return Object.keys(groupedByFile).map((file)=>{
|
|
735
|
+
const results = groupedByFile[file];
|
|
736
|
+
return (0, $9c43c2ed82e63570$export$9abc0a414b0d8b8f)(results);
|
|
737
|
+
});
|
|
531
738
|
}
|
|
532
739
|
|
|
533
740
|
|
|
534
741
|
|
|
535
742
|
|
|
743
|
+
async function $4ffeaeb7bb3c0319$export$cfc0723de5712e57(cookieSpec) {
|
|
744
|
+
const cookies = await (0, $8ef2ebdbd659489d$export$a65902517ae87ba8)(cookieSpec);
|
|
745
|
+
if (cookies.length > 0) return (0, $9c43c2ed82e63570$export$9abc0a414b0d8b8f)(cookies);
|
|
746
|
+
return "";
|
|
747
|
+
}
|
|
748
|
+
|
|
536
749
|
|
|
537
750
|
|
|
538
|
-
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
function $2d84054eb5f070a6$export$f266452a5050185d(url) {
|
|
760
|
+
const url1 = typeof url == "string" ? new URL(url) : url;
|
|
761
|
+
const cookieSpecs = [];
|
|
762
|
+
const splits = url1.hostname.split(".");
|
|
763
|
+
const tld = splits.slice(-2).join(".");
|
|
764
|
+
const cookieSpec = {
|
|
765
|
+
name: "%",
|
|
766
|
+
domain: "%." + tld
|
|
767
|
+
};
|
|
768
|
+
cookieSpecs.push(cookieSpec);
|
|
769
|
+
const cookieSpec1 = {
|
|
770
|
+
name: "%",
|
|
771
|
+
domain: url1.hostname
|
|
772
|
+
};
|
|
773
|
+
cookieSpecs.push(cookieSpec1);
|
|
774
|
+
// const isWww = splits.slice(-3)[0] === "www";
|
|
775
|
+
const cookieSpec2 = {
|
|
776
|
+
name: "%",
|
|
777
|
+
domain: tld
|
|
778
|
+
};
|
|
779
|
+
cookieSpecs.push(cookieSpec2);
|
|
780
|
+
return (0, $7oI3p$lodash.uniqBy)(cookieSpecs, JSON.stringify);
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
async function $cfc07ae4aa2c7e44$export$b24a545a0b39f491(url, options = {}, fetch = (0, $7oI3p$crossfetch.fetch)) {
|
|
785
|
+
const headers = {
|
|
786
|
+
"User-Agent": new (0, ($parcel$interopDefault($7oI3p$useragents)))().toString()
|
|
787
|
+
};
|
|
539
788
|
const defaultOptions = {
|
|
540
|
-
headers:
|
|
541
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
|
|
542
|
-
},
|
|
789
|
+
headers: headers,
|
|
543
790
|
redirect: "manual"
|
|
544
791
|
};
|
|
545
792
|
const url2 = `${url}`;
|
|
546
793
|
const url1 = new URL(url2);
|
|
547
|
-
const
|
|
548
|
-
|
|
794
|
+
const cookieSpecs = (0, $2d84054eb5f070a6$export$f266452a5050185d)(url1);
|
|
795
|
+
const cookie = await (0, $4ffeaeb7bb3c0319$export$cfc0723de5712e57)(cookieSpecs).catch(()=>"");
|
|
796
|
+
if (cookie.length > 0) (0, $7oI3p$lodash.merge)(headers, {
|
|
797
|
+
Cookie: cookie
|
|
549
798
|
});
|
|
550
|
-
|
|
551
|
-
name: "%",
|
|
552
|
-
domain: domain
|
|
553
|
-
});
|
|
554
|
-
const cookie = cookies.pop();
|
|
799
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b)["dump-request-headers"]) console.log((0, $7oI3p$colorette.blue)("Request headers:"), headers);
|
|
555
800
|
const newOptions1 = (0, $7oI3p$lodash.merge)(defaultOptions, options, {
|
|
556
|
-
headers:
|
|
557
|
-
Cookie: cookie
|
|
558
|
-
}
|
|
801
|
+
headers: headers
|
|
559
802
|
});
|
|
560
803
|
try {
|
|
561
|
-
const res = await
|
|
804
|
+
const res = await fetch(url2, newOptions1);
|
|
805
|
+
const headers1 = [];
|
|
806
|
+
res.headers.forEach((value, key)=>{
|
|
807
|
+
headers1.push([
|
|
808
|
+
key,
|
|
809
|
+
value
|
|
810
|
+
]);
|
|
811
|
+
});
|
|
812
|
+
for (const [key, value] of headers1)if (key === "set-cookie") {
|
|
813
|
+
await (0, $53a3bcc99a05dfcf$export$928a906645f9d018).setCookie(value, url2);
|
|
814
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log((0, $7oI3p$colorette.blue)(`Set-Cookie: ${(0, $7oI3p$colorette.yellow)(value)} ${(0, $7oI3p$colorette.yellow)(url2)}`));
|
|
815
|
+
// const cookie = tough.parse(value);
|
|
816
|
+
// if (cookie instanceof Cookie) {
|
|
817
|
+
// await memoryCookieStore.putCookie(cookie);
|
|
818
|
+
// }
|
|
819
|
+
}
|
|
562
820
|
const newUrl = res.headers.get("location");
|
|
563
|
-
if (res.redirected || newUrl && newUrl !== url2)
|
|
821
|
+
if (res.redirected || newUrl && newUrl !== url2) {
|
|
822
|
+
if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log((0, $7oI3p$colorette.blue)(`Redirected to `), (0, $7oI3p$colorette.yellow)(newUrl));
|
|
823
|
+
return $cfc07ae4aa2c7e44$export$b24a545a0b39f491(newUrl, newOptions1);
|
|
824
|
+
}
|
|
564
825
|
const arrayBuffer1 = res.arrayBuffer();
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
826
|
+
async function arrayBuffer() {
|
|
827
|
+
return arrayBuffer1;
|
|
828
|
+
}
|
|
829
|
+
async function buffer() {
|
|
830
|
+
return arrayBuffer().then(Buffer.from);
|
|
831
|
+
}
|
|
832
|
+
async function text() {
|
|
833
|
+
return buffer().then((buffer)=>buffer.toString("utf8"));
|
|
834
|
+
}
|
|
835
|
+
async function json() {
|
|
836
|
+
return text().then((text)=>(0, ($parcel$interopDefault($7oI3p$destr)))(text));
|
|
837
|
+
}
|
|
838
|
+
async function formData() {
|
|
839
|
+
const urlSearchParams = await text().then((text)=>new URLSearchParams(text));
|
|
840
|
+
const formData = new FormData();
|
|
841
|
+
for (const [key, value] of urlSearchParams.entries())formData.append(key, value);
|
|
842
|
+
return formData;
|
|
843
|
+
}
|
|
844
|
+
const res1 = res;
|
|
570
845
|
const source2 = {
|
|
571
|
-
status: res.status,
|
|
572
|
-
statusText: res.statusText,
|
|
573
|
-
headers: res.headers,
|
|
574
846
|
arrayBuffer: arrayBuffer,
|
|
575
|
-
buffer: buffer,
|
|
576
847
|
text: text,
|
|
577
848
|
json: json,
|
|
849
|
+
buffer: buffer,
|
|
578
850
|
formData: formData
|
|
579
851
|
};
|
|
580
|
-
return (0, $7oI3p$lodash.merge)(
|
|
852
|
+
return (0, $7oI3p$lodash.merge)(res1, source2);
|
|
581
853
|
} catch (e) {
|
|
582
854
|
throw e;
|
|
583
855
|
}
|
|
@@ -593,21 +865,6 @@ var $3d7e27b54f670f46$exports = {};
|
|
|
593
865
|
var $6c197c88880e045c$exports = {};
|
|
594
866
|
|
|
595
867
|
|
|
596
|
-
async function $cd1ba0160120c006$export$4be65e66cfa2648a(params) {
|
|
597
|
-
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $f72befa528c23ca7$export$2e2bcd8739ae039)());
|
|
598
|
-
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
599
|
-
else throw new Error("Cookie not found");
|
|
600
|
-
}
|
|
601
|
-
async function $cd1ba0160120c006$export$c44c5fdef43f0941(params) {
|
|
602
|
-
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $7bb7da9a77b2fd99$export$2e2bcd8739ae039)());
|
|
603
|
-
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
604
|
-
else throw new Error("Cookie not found");
|
|
605
|
-
}
|
|
606
|
-
async function $cd1ba0160120c006$export$e5637297e9eb6f2e(params) {
|
|
607
|
-
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $269fe42bfd555305$export$2e2bcd8739ae039)());
|
|
608
|
-
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
609
|
-
else throw new Error("Cookie not found");
|
|
610
|
-
}
|
|
611
868
|
$parcel$exportWildcard(module.exports, $d5b6386167d289d2$exports);
|
|
612
869
|
$parcel$exportWildcard(module.exports, $3d7e27b54f670f46$exports);
|
|
613
870
|
$parcel$exportWildcard(module.exports, $6c197c88880e045c$exports);
|