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