@mherod/get-cookie 2.0.0-beta.3 → 2.0.0-beta.4
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/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/main.js +29 -31
- package/dist/main.js.map +1 -1
- package/dist/module.js +466 -0
- package/dist/module.js.map +1 -0
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +14 -7
- package/src/{argv.js → argv.ts} +0 -0
- package/src/{cli.js → cli.ts} +3 -8
- package/src/{index.js → index.ts} +3 -8
- package/src/queryCookies.ts +2 -1
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;AIEe;IACb,MAAM,YAAY,CAAC,IAAY,EAAE,MAAc,EAA6B;QAC1E,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EACxC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAE3C,OAAO,EAAE,CAAC;KACX;CACF;;ADTD;AEEA;AAEO,eAAe,yCAAU,CAAC,OAAe,EAAmB;IACjE,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,EACrB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,GAAK;QACtC,CAAA,GAAA,yBAAI,CAAA,CACF,OAAO,EACP;YAAE,QAAQ,EAAE,QAAQ;YAAE,SAAS,EAAE,IAAQ;SAAE,EAC3C,CAAC,KAA2B,EAAE,MAAc,EAAE,MAAc,GAAK;YAC/D,IAAI,KAAK,EAAE;gBACT,MAAM,CAAC,KAAK,CAAC,CAAC;gBACd,OAAO;aACR;YACD,IAAI,MAAM,EAAE;gBACV,MAAM,CAAC,KAAK,CAA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AC,EAC9C,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,GAAK,MAAM,IAAI,IAAI,CAAC,CAAC;SAEhD,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;CAEvC","sources":["src/index.js","src/queryCookies.ts","src/browsers/CompositeCookieQueryStrategy.ts","src/browsers/ChromeCookieQueryStrategy.ts","src/browsers/AbstractCookieQueryStrategy.ts","src/utils.ts","src/global.ts","src/findAllFiles.ts","src/CookieRow.ts","src/doSqliteQuery1.ts","src/browsers/FirefoxCookieQueryStrategy.ts","src/browsers/SafariCookieQueryStrategy.ts","src/isValidJwt.ts"],"sourcesContent":["#!/usr/bin/env node\n// noinspection JSUnusedGlobalSymbols\n\nimport { queryCookies } from \"./queryCookies\";\nimport FirefoxCookieQueryStrategy from \"./browsers/FirefoxCookieQueryStrategy\";\nimport ChromeCookieQueryStrategy from \"./browsers/ChromeCookieQueryStrategy\";\nimport CompositeCookieQueryStrategy from \"./browsers/CompositeCookieQueryStrategy\";\n\n/**\n *\n * @param params\n * @returns {Promise<string>}\n */\nexport async function getCookie(params) {\n const cookies = await queryCookies(\n params,\n new CompositeCookieQueryStrategy()\n //\n );\n if (Array.isArray(cookies) && cookies.length > 0) {\n return cookies.find((cookie) => cookie != null);\n } else {\n throw new Error(\"Cookie not found\");\n }\n}\n\n/**\n *\n * @param params\n * @returns {Promise<*>}\n */\nexport async function getFirefoxCookie(params) {\n const cookies = await queryCookies(\n params,\n new FirefoxCookieQueryStrategy()\n //\n );\n if (Array.isArray(cookies) && cookies.length > 0) {\n return cookies.find((cookie) => cookie != null);\n } else {\n throw new Error(\"Cookie not found\");\n }\n}\n\n/**\n *\n * @param params\n * @returns {Promise<*>}\n */\nexport async function getChromeCookie(params) {\n const cookies = await queryCookies(\n params,\n new ChromeCookieQueryStrategy()\n //\n );\n if (Array.isArray(cookies) && cookies.length > 0) {\n return cookies.find((cookie) => cookie != null);\n } else {\n throw new Error(\"Cookie not found\");\n }\n}\n","import CompositeCookieQueryStrategy from \"./browsers/CompositeCookieQueryStrategy\";\nimport { uniqBy } from \"lodash\";\nimport { env } from \"./global\";\nimport isValidJwt from \"./isValidJwt\";\nimport { ExportedCookie } from \"./CookieRow\";\n\nexport async function queryCookies(\n {\n name,\n domain\n }: {\n name: string;\n domain: string;\n },\n strategy = new CompositeCookieQueryStrategy()\n) {\n const results: ExportedCookie[] = await strategy.queryCookies(name, domain);\n const results1: ExportedCookie[] = uniqBy(results, JSON.stringify);\n const jwtCookies = [];\n for (const result of results1) {\n const value = result.value;\n if (isValidJwt(value)) {\n jwtCookies.push(result);\n }\n }\n const resultsUniq = env.REQUIRE_JWT ? jwtCookies : results1;\n return env.SINGLE ? [resultsUniq[0]] : resultsUniq;\n}\n","import ChromeCookieQueryStrategy from \"./ChromeCookieQueryStrategy\";\nimport FirefoxCookieQueryStrategy from \"./FirefoxCookieQueryStrategy\";\nimport SafariCookieQueryStrategy from \"./SafariCookieQueryStrategy\";\nimport AbstractCookieQueryStrategy from \"./AbstractCookieQueryStrategy\";\nimport {ExportedCookie} from \"../CookieRow\";\n\nexport default class CompositeCookieQueryStrategy extends AbstractCookieQueryStrategy {\n #strategies;\n\n constructor() {\n super();\n this.#strategies = [\n ChromeCookieQueryStrategy,\n FirefoxCookieQueryStrategy,\n SafariCookieQueryStrategy,\n ].map((strategy) => {\n return new strategy();\n });\n }\n\n async queryCookies(name: string, domain: string): Promise<ExportedCookie[]> {\n const results = await Promise.all(\n this.#strategies.map(async (strategy) => {\n // @ts-ignore\n const cookies: Promise<ExportedCookie[]> = strategy.queryCookies(name, domain);\n return cookies.catch(() => []);\n })\n );\n return results.flat();\n }\n}\n","import AbstractCookieQueryStrategy from \"./AbstractCookieQueryStrategy\";\nimport { execSimple } from \"../utils\";\nimport { env, HOME } from \"../global\";\nimport { existsSync } from \"fs\";\nimport { findAllFiles } from \"../findAllFiles\";\nimport * as crypto from \"crypto\";\nimport * as path from \"path\";\nimport { CookieRow, ExportedCookie, isCookieRow, isExportedCookie } from \"../CookieRow\";\nimport { doSqliteQuery1 } from \"../doSqliteQuery1\";\nimport { merge } from \"lodash\";\n\nexport default class ChromeCookieQueryStrategy extends AbstractCookieQueryStrategy {\n async queryCookies(name: string, domain: string): Promise<ExportedCookie[]> {\n if (process.platform !== \"darwin\") {\n throw new Error(\"This only works on macOS\");\n }\n if (env.FIREFOX_ONLY) {\n return [];\n }\n return getChromeCookies({\n requireJwt: false,\n name,\n domain\n });\n }\n}\n\nasync function getPromise1(name: string, domain: string, file: string): Promise<CookieRow[]> {\n try {\n return await getEncryptedChromeCookie({\n name: name,\n domain: domain,\n file: file\n });\n } catch (e) {\n if (env.VERBOSE) {\n console.log(\"Error getting encrypted cookie\", e);\n }\n return [];\n }\n}\n\nasync function getPromise(name: string, domain: string): Promise<CookieRow[]> {\n try {\n const files: string[] = await findAllFiles({\n path: chromeLocal,\n name: \"Cookies\"\n });\n const promises: Promise<CookieRow[]>[] = files.map((file) => getPromise1(name, domain, file));\n const results1: Awaited<CookieRow[]>[] = await Promise.all(promises);\n return results1.flat().filter(isCookieRow);\n } catch (error) {\n if (env.VERBOSE) {\n console.log(\"error\", error);\n }\n return [];\n }\n}\n\nasync function decryptValue(password: string, encryptedValue: Buffer) {\n let d: string | null;\n try {\n d = await decrypt(password, encryptedValue);\n } catch (e) {\n if (env.VERBOSE) {\n console.log(\"Error decrypting cookie\", e);\n }\n d = null;\n }\n return d ?? encryptedValue.toString(\"utf-8\");\n}\n\nasync function getChromeCookies(\n {\n name,\n domain = \"%\",\n requireJwt = false\n }: {\n name: string;\n domain: string;\n requireJwt: boolean | undefined;\n //\n }\n //\n): Promise<ExportedCookie[]> {\n const encryptedDataItems: CookieRow[] = await getPromise(name, domain);\n const password: string = await getChromePassword();\n const decrypted: Promise<ExportedCookie | null>[] = encryptedDataItems\n .filter(({ value }) => value != null && value.length > 0)\n .map(async (cookieRow: CookieRow) => {\n const encryptedValue: Buffer = cookieRow.value;\n const decryptedValue = await decryptValue(password, encryptedValue);\n const meta = {};\n merge(meta, cookieRow.meta ?? {});\n return {\n domain: cookieRow.domain,\n name: cookieRow.name,\n value: decryptedValue,\n meta: meta\n };\n });\n const results: ExportedCookie[] = (await Promise.all(decrypted)).filter(isExportedCookie);\n if (env.VERBOSE) {\n console.log(\"results\", results);\n }\n return results;\n}\n\nconst chromeLocal = path.join(\n HOME,\n \"Library\",\n \"Application Support\",\n \"Google\",\n \"Chrome\"\n);\n\nasync function getEncryptedChromeCookie(\n {\n name,\n domain,\n file = path.join(chromeLocal, \"Default\", \"Cookies\")\n //\n }: {\n name: string;\n domain: string;\n file: string;\n }): Promise<CookieRow[]> {\n if (!existsSync(file)) {\n throw new Error(`File ${file} does not exist`);\n }\n if (env.VERBOSE) {\n const s = file.split(\"/\").slice(-3).join(\"/\");\n console.log(`Trying Chrome (at ${s}) cookie ${name} for domain ${domain}`);\n }\n let sql;\n sql = `SELECT encrypted_value, name, host_key FROM cookies`;\n const wildcardRegexp = /^([*%])$/i;\n const specifiedName = name.match(wildcardRegexp) == null;\n const specifiedDomain = domain.match(wildcardRegexp) == null;\n if (specifiedName || specifiedDomain) {\n sql += ` WHERE `;\n if (specifiedName) {\n sql += `name = '${name}'`;\n if (specifiedDomain) {\n sql += ` AND `;\n }\n }\n if (specifiedDomain) {\n sql += `host_key LIKE '${domain}';`;\n }\n }\n return doSqliteQuery1(file, sql);\n}\n\nasync function getChromePassword(): Promise<string> {\n return execSimple(\n \"security find-generic-password -w -s \\\"Chrome Safe Storage\\\"\"\n );\n}\n\nasync function decrypt(password: crypto.BinaryLike, encryptedData: Buffer): Promise<string> {\n if (typeof password !== \"string\") {\n throw new Error(\"password must be a string: \" + password);\n }\n let encryptedData1: any;\n encryptedData1 = encryptedData;\n if (encryptedData1 == null || typeof encryptedData1 !== \"object\") {\n throw new Error(\"encryptedData must be a object: \" + encryptedData1);\n }\n if (!(encryptedData1 instanceof Buffer)) {\n if (Array.isArray(encryptedData1) && encryptedData1[0] instanceof Buffer) {\n [encryptedData1] = encryptedData1;\n if (env.VERBOSE) {\n console.log(\n `encryptedData is an array of buffers, selected first: ${encryptedData1}`\n );\n }\n } else {\n throw new Error(\"encryptedData must be a Buffer: \" + encryptedData1);\n }\n encryptedData1 = Buffer.from(encryptedData1);\n }\n if (env.VERBOSE) {\n console.log(`Trying to decrypt with password ${password}`);\n }\n return new Promise((resolve, reject) => {\n crypto.pbkdf2(password,\n \"saltysalt\",\n 1003,\n 16,\n \"sha1\",\n (error, buffer) => {\n try {\n if (error) {\n if (env.VERBOSE) {\n console.log(\"Error doing pbkdf2\", error);\n }\n reject(error);\n return;\n }\n\n if (buffer.length !== 16) {\n if (env.VERBOSE) {\n console.log(\n \"Error doing pbkdf2, buffer length is not 16\",\n buffer.length\n );\n }\n reject(new Error(\"Buffer length is not 16\"));\n return;\n }\n\n const str = new Array(17).join(\" \");\n const iv = Buffer.from(str, \"binary\");\n const decipher = crypto.createDecipheriv(\"aes-128-cbc\", buffer, iv);\n decipher.setAutoPadding(false);\n\n if (encryptedData1 && encryptedData1.slice) {\n encryptedData1 = encryptedData1.slice(3);\n }\n\n if (encryptedData1.length % 16 !== 0) {\n if (env.VERBOSE) {\n console.log(\n \"Error doing pbkdf2, encryptedData length is not a multiple of 16\",\n encryptedData1.length\n );\n }\n reject(new Error(\"encryptedData length is not a multiple of 16\"));\n return;\n }\n\n let decoded = decipher.update(encryptedData1);\n try {\n decipher.final(\"utf-8\");\n } catch (e) {\n if (env.VERBOSE) {\n console.log(\"Error doing decipher.final()\", e);\n }\n reject(e);\n return;\n }\n\n const padding = decoded[decoded.length - 1];\n if (padding) {\n decoded = decoded.slice(0, 0 - padding);\n }\n // noinspection JSCheckFunctionSignatures\n const decodedString = decoded.toString(\"utf8\");\n resolve(decodedString);\n } catch (e) {\n reject(e);\n }\n });\n });\n}\n","import {ExportedCookie} from \"../CookieRow\";\n\nexport default class AbstractCookieQueryStrategy {\n async queryCookies(name: string, domain: string): Promise<ExportedCookie[]> {\n if (process.env.NODE_ENV === \"development\") {\n console.log(\"queryCookie\", name, domain);\n }\n return [];\n }\n}\n","// noinspection JSUnusedGlobalSymbols\n\nimport {exec, ExecException} from \"child_process\";\n\nexport async function execSimple(command: string): Promise<string> {\n if (process.env.VERBOSE) {\n console.log(command);\n }\n return new Promise((resolve, reject) => {\n exec(\n command,\n { encoding: \"binary\", maxBuffer: 5 * 1024 },\n (error: ExecException | null, stdout: string, stderr: string) => {\n if (error) {\n reject(error);\n return;\n }\n if (stderr) {\n reject(error);\n return;\n }\n if (stdout) {\n resolve(stdout.trim());\n }\n }\n );\n });\n}\n\n// export async function execAsBuffer(command: string) {\n// if (process.env.VERBOSE) {\n// console.log(command);\n// }\n// return await new Promise((resolve, reject) => {\n// exec(\n// command,\n// { encoding: \"binary\", maxBuffer: 5 * 1024 },\n// (error: ExecException | null, stdout: string, stderr: string) => {\n// if (error) {\n// reject(error);\n// return;\n// }\n// if (stderr) {\n// reject(error);\n// return;\n// }\n// let stdoutAsBuffer: string = stdout;\n// if (typeof stdoutAsBuffer === \"string\" && stdoutAsBuffer.length > 0) {\n// // noinspection JSCheckFunctionSignatures\n// stdoutAsBuffer = Buffer.from(stdoutAsBuffer, \"binary\").slice(0, -1);\n// }\n// if (stdoutAsBuffer && stdoutAsBuffer.length > 0) {\n// resolve(stdoutAsBuffer);\n// }\n// }\n// );\n// });\n// }\n\n// @ts-ignore\nexport function toStringValue(r: any): string {\n if (process.env.VERBOSE) {\n console.log(\"Printing value\", r);\n }\n if (r) {\n if (typeof r === \"string\") {\n return r;\n } else if (r.toString) {\n // noinspection JSCheckFunctionSignatures\n return r.toString(\"utf8\");\n }\n }\n}\n\nexport function printStringValue(r: any) {\n if (process.env.VERBOSE) {\n console.log(\"Printing value\", r);\n }\n if (r) {\n if (typeof r === \"string\") {\n console.log(r);\n } else if (r.toString) {\n // noinspection JSCheckFunctionSignatures\n console.log(r.toString(\"utf8\"));\n }\n }\n}\n\n/**\n *\n * @param result\n * @returns {string|null}\n */\nexport function toStringOrNull(result: any) {\n if (result == null) {\n return null;\n }\n if (process.env.VERBOSE) {\n console.log(\"result\", result);\n }\n if (typeof result === \"string\" && result.length > 0) {\n return result;\n }\n if (result.slice && result.toString) {\n // noinspection JSCheckFunctionSignatures\n return result.toString(\"utf8\");\n }\n return null;\n}\n\nexport function invalidString(input: any): boolean {\n return typeof input !== \"string\" || input.length === 0;\n}\n\n\nexport function validString(input: any): input is string {\n return typeof input == \"string\" && input.length > 0;\n}\n","const { merge } = require(\"lodash\");\nexport const env: any = {};\nmerge(env, process.env);\nexport const HOME: string = env[\"HOME\"];\nif (!HOME) {\n throw new Error(\"HOME environment variable is not set\");\n}\n","import {env} from \"./global\";\nimport * as fs from \"fs\";\n\nexport async function findAllFiles(\n {\n path,\n name,\n maxDepth = 2\n//\n }: {\n path: string;\n name: string;\n maxDepth?: number;\n }\n): Promise<string[]> {\n if (typeof path !== \"string\") {\n throw new Error(\"path must be a string\");\n }\n if (typeof name !== \"string\") {\n throw new Error(\"name must be a string\");\n }\n\n const rootSegments = path.split(\"/\").length;\n\n if (env.VERBOSE) {\n console.log(`Searching for ${name} in ${path}`);\n }\n const files: string[] = [];\n let readdirSync;\n try {\n readdirSync = fs.readdirSync(path);\n } catch (e) {\n if (env.VERBOSE) {\n console.log(`Error reading ${path}`, e);\n }\n return [];\n }\n for (const file of readdirSync) {\n const filePath = path + \"/\" + file;\n let stat;\n try {\n stat = fs.statSync(filePath);\n } catch (e) {\n if (env.VERBOSE) {\n console.error(`Error getting stat for ${filePath}`, e);\n }\n continue;\n }\n if (stat.isDirectory()) {\n if (filePath.split(\"/\").length < rootSegments + maxDepth) {\n try {\n const subFiles = await findAllFiles({\n path: filePath,\n name: name,\n maxDepth: 2,\n });\n files.push(...subFiles);\n } catch (e) {\n if (env.VERBOSE) {\n console.error(e);\n }\n }\n }\n } else if (file === name) {\n files.push(filePath);\n }\n }\n if (env.VERBOSE) {\n if (files.length > 0) {\n console.log(`Found ${files.length} ${name} files`);\n console.log(files);\n }\n }\n return files;\n}\n","export interface CookieRow {\n domain: string;\n name: string;\n value: Buffer;\n meta?: any;\n}\n\nexport function isCookieRow(obj: any): obj is CookieRow {\n return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;\n}\n\nexport interface ExportedCookie {\n domain: string;\n name: string;\n value: string;\n meta?: any;\n}\n\nexport function isExportedCookie(obj: any): obj is ExportedCookie {\n return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;\n}\n","import * as fs from \"fs\";\nimport * as sqlite3 from \"sqlite3\";\nimport {CookieRow} from \"./CookieRow\";\n\nexport async function doSqliteQuery1(file: string, sql: string): Promise<CookieRow[]> {\n if (!fs.existsSync(file)) {\n throw new Error(`doSqliteQuery1: file ${file} does not exist`);\n }\n const db = new sqlite3.Database(file);\n return new Promise((resolve, reject) => {\n db.all(sql, (err: Error, rows: any[]) => {\n if (err) {\n if (process.env.VERBOSE) {\n console.log(`doSqliteQuery1: error ${err}`);\n }\n reject(err);\n return;\n }\n const rows1: any[] = rows;\n if (rows1 == null || rows1.length === 0) {\n if (process.env.VERBOSE) {\n console.log(`doSqliteQuery1: no rows`);\n }\n resolve([]);\n return;\n }\n if (Array.isArray(rows1)) {\n const cookieRows: CookieRow[] = rows1.map((row) => {\n return {\n domain: row[\"host_key\"],\n name: row[\"name\"],\n value: row[\"encrypted_value\"],\n meta: {\n file: file\n }\n }\n })\n resolve(cookieRows);\n return;\n }\n if (process.env.VERBOSE) {\n console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);\n }\n resolve([rows1]);\n });\n });\n}\n","import AbstractCookieQueryStrategy from \"./AbstractCookieQueryStrategy\";\nimport { env, HOME } from \"../global\";\nimport { existsSync } from \"fs\";\nimport { toStringOrNull } from \"../utils\";\nimport { findAllFiles } from \"../findAllFiles\";\nimport * as path from \"path\";\nimport { doSqliteQuery1 } from \"../doSqliteQuery1\";\nimport { ExportedCookie } from \"../CookieRow\";\n\nexport default class FirefoxCookieQueryStrategy extends AbstractCookieQueryStrategy {\n async queryCookies(name: string, domain: string): Promise<ExportedCookie[]> {\n if (process.platform !== \"darwin\") {\n throw new Error(\"This only works on macOS\");\n }\n if (env.CHROME_ONLY) {\n return [];\n }\n const cookies = await this.#getFirefoxCookie({ name, domain });\n return Array.isArray(cookies) ? cookies.map(toStringOrNull) : [];\n }\n\n /**\n *\n * @param name\n * @param domain\n * @returns {Promise<Buffer>}\n */\n async #getFirefoxCookie(\n //\n {\n name,\n domain\n }: {\n name: string,\n domain: string\n //\n }\n //\n ) {\n const files: string[] = await findAllFiles({\n path: path.join(\n HOME,\n \"Library\",\n \"Application Support\",\n \"Firefox\",\n \"Profiles\"\n ),\n name: \"cookies.sqlite\"\n });\n const all = await Promise.all(\n files.map((file) => {\n return this.#queryCookiesDb(file, name, domain);\n })\n );\n return all.flat();\n }\n\n #queryCookiesDb(file: string, name: string, domain: string) {\n if (file && !existsSync(file)) {\n throw new Error(`File ${file} does not exist`);\n }\n if (env.VERBOSE) {\n console.log(`Trying Firefox cookie ${name} for domain ${domain}`);\n }\n let sql;\n //language=SQL\n sql = \"SELECT value FROM moz_cookies\";\n if (typeof name === \"string\" || typeof domain === \"string\") {\n sql += ` WHERE `;\n if (typeof name === \"string\") {\n sql += `name = '${name}'`;\n if (typeof domain === \"string\") {\n sql += ` AND `;\n }\n }\n if (typeof domain === \"string\") {\n sql += `host LIKE '${domain}';`;\n }\n }\n return doSqliteQuery1(file, sql)\n .then((rows) => {\n return rows.map((row) => {\n return {\n domain: row.domain,\n name: row.name,\n value: row.value.toString(\"utf8\")\n };\n });\n })\n .catch(() => []);\n }\n}\n","import AbstractCookieQueryStrategy from \"./AbstractCookieQueryStrategy\";\n\nexport default class SafariCookieQueryStrategy extends AbstractCookieQueryStrategy {}\n","import jsonwebtoken from \"jsonwebtoken\";\nimport { env } from \"./global\";\n\nexport default function isValidJwt(token: any) {\n try {\n const result = jsonwebtoken.decode(token, { complete: true });\n if (env.VERBOSE) {\n console.log(result);\n }\n return true;\n } cat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OM,eAAe,yCAAgB,CAAC,MAAyC,EAAE;IAChF,MAAM,OAAO,GAAG,MAAM,CAAA,GAAA,yCAAY,CAAA,CAChC,MAAM,EACN,IAAI,CAAA,GAAA,wCAA0B,CAAA,EAAE,CAEjC,AAAC;IACF,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAC9C,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,GAAK,MAAM,IAAI,IAAI,CAAC,CAAC;SAEhD,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;CAEvC;AAOM,eAAe,yCAAe,CAAC,MAAyC,EAAE;IAC/E,MAAM,OAAO,GAAG,MAAM,CAAA,GAAA,yCAAY,CAAA,CAChC,MAAM,EACN,IAAI,CAAA,GAAA,wCAAyB,CAAA,EAAE,CAEhC,AAAC;IACF,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAC9C,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,GAAK,MAAM,IAAI,IAAI,CAAC,CAAC;SAEhD,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;CAEvC","sources":["src/index.ts","src/queryCookies.ts","src/browsers/CompositeCookieQueryStrategy.ts","src/browsers/ChromeCookieQueryStrategy.ts","src/browsers/AbstractCookieQueryStrategy.ts","src/utils.ts","src/global.ts","src/findAllFiles.ts","src/CookieRow.ts","src/doSqliteQuery1.ts","src/browsers/FirefoxCookieQueryStrategy.ts","src/browsers/SafariCookieQueryStrategy.ts","src/isValidJwt.ts"],"sourcesContent":["#!/usr/bin/env node\n// noinspection JSUnusedGlobalSymbols\n\nimport { queryCookies } from \"./queryCookies\";\nimport FirefoxCookieQueryStrategy from \"./browsers/FirefoxCookieQueryStrategy\";\nimport ChromeCookieQueryStrategy from \"./browsers/ChromeCookieQueryStrategy\";\nimport CompositeCookieQueryStrategy from \"./browsers/CompositeCookieQueryStrategy\";\n\nexport async function getCookie(params: { name: string; domain: string; }) {\n const cookies = await queryCookies(\n params,\n new CompositeCookieQueryStrategy()\n //\n );\n if (Array.isArray(cookies) && cookies.length > 0) {\n return cookies.find((cookie) => cookie != null);\n } else {\n throw new Error(\"Cookie not found\");\n }\n}\n\n/**\n *\n * @param params\n * @returns {Promise<*>}\n */\nexport async function getFirefoxCookie(params: { name: string; domain: string; }) {\n const cookies = await queryCookies(\n params,\n new FirefoxCookieQueryStrategy()\n //\n );\n if (Array.isArray(cookies) && cookies.length > 0) {\n return cookies.find((cookie) => cookie != null);\n } else {\n throw new Error(\"Cookie not found\");\n }\n}\n\n/**\n *\n * @param params\n * @returns {Promise<*>}\n */\nexport async function getChromeCookie(params: { name: string; domain: string; }) {\n const cookies = await queryCookies(\n params,\n new ChromeCookieQueryStrategy()\n //\n );\n if (Array.isArray(cookies) && cookies.length > 0) {\n return cookies.find((cookie) => cookie != null);\n } else {\n throw new Error(\"Cookie not found\");\n }\n}\n","import CompositeCookieQueryStrategy from \"./browsers/CompositeCookieQueryStrategy\";\nimport { uniqBy } from \"lodash\";\nimport { env } from \"./global\";\nimport isValidJwt from \"./isValidJwt\";\nimport { ExportedCookie } from \"./CookieRow\";\nimport AbstractCookieQueryStrategy from \"./browsers/AbstractCookieQueryStrategy\";\n\nexport async function queryCookies(\n {\n name,\n domain\n }: {\n name: string;\n domain: string;\n },\n strategy: AbstractCookieQueryStrategy = new CompositeCookieQueryStrategy()\n) {\n const results: ExportedCookie[] = await strategy.queryCookies(name, domain);\n const results1: ExportedCookie[] = uniqBy(results, JSON.stringify);\n const jwtCookies = [];\n for (const result of results1) {\n const value = result.value;\n if (isValidJwt(value)) {\n jwtCookies.push(result);\n }\n }\n const resultsUniq = env.REQUIRE_JWT ? jwtCookies : results1;\n return env.SINGLE ? [resultsUniq[0]] : resultsUniq;\n}\n","import ChromeCookieQueryStrategy from \"./ChromeCookieQueryStrategy\";\nimport FirefoxCookieQueryStrategy from \"./FirefoxCookieQueryStrategy\";\nimport SafariCookieQueryStrategy from \"./SafariCookieQueryStrategy\";\nimport AbstractCookieQueryStrategy from \"./AbstractCookieQueryStrategy\";\nimport {ExportedCookie} from \"../CookieRow\";\n\nexport default class CompositeCookieQueryStrategy extends AbstractCookieQueryStrategy {\n #strategies;\n\n constructor() {\n super();\n this.#strategies = [\n ChromeCookieQueryStrategy,\n FirefoxCookieQueryStrategy,\n SafariCookieQueryStrategy,\n ].map((strategy) => {\n return new strategy();\n });\n }\n\n async queryCookies(name: string, domain: string): Promise<ExportedCookie[]> {\n const results = await Promise.all(\n this.#strategies.map(async (strategy) => {\n // @ts-ignore\n const cookies: Promise<ExportedCookie[]> = strategy.queryCookies(name, domain);\n return cookies.catch(() => []);\n })\n );\n return results.flat();\n }\n}\n","import AbstractCookieQueryStrategy from \"./AbstractCookieQueryStrategy\";\nimport { execSimple } from \"../utils\";\nimport { env, HOME } from \"../global\";\nimport { existsSync } from \"fs\";\nimport { findAllFiles } from \"../findAllFiles\";\nimport * as crypto from \"crypto\";\nimport * as path from \"path\";\nimport { CookieRow, ExportedCookie, isCookieRow, isExportedCookie } from \"../CookieRow\";\nimport { doSqliteQuery1 } from \"../doSqliteQuery1\";\nimport { merge } from \"lodash\";\n\nexport default class ChromeCookieQueryStrategy extends AbstractCookieQueryStrategy {\n async queryCookies(name: string, domain: string): Promise<ExportedCookie[]> {\n if (process.platform !== \"darwin\") {\n throw new Error(\"This only works on macOS\");\n }\n if (env.FIREFOX_ONLY) {\n return [];\n }\n return getChromeCookies({\n requireJwt: false,\n name,\n domain\n });\n }\n}\n\nasync function getPromise1(name: string, domain: string, file: string): Promise<CookieRow[]> {\n try {\n return await getEncryptedChromeCookie({\n name: name,\n domain: domain,\n file: file\n });\n } catch (e) {\n if (env.VERBOSE) {\n console.log(\"Error getting encrypted cookie\", e);\n }\n return [];\n }\n}\n\nasync function getPromise(name: string, domain: string): Promise<CookieRow[]> {\n try {\n const files: string[] = await findAllFiles({\n path: chromeLocal,\n name: \"Cookies\"\n });\n const promises: Promise<CookieRow[]>[] = files.map((file) => getPromise1(name, domain, file));\n const results1: Awaited<CookieRow[]>[] = await Promise.all(promises);\n return results1.flat().filter(isCookieRow);\n } catch (error) {\n if (env.VERBOSE) {\n console.log(\"error\", error);\n }\n return [];\n }\n}\n\nasync function decryptValue(password: string, encryptedValue: Buffer) {\n let d: string | null;\n try {\n d = await decrypt(password, encryptedValue);\n } catch (e) {\n if (env.VERBOSE) {\n console.log(\"Error decrypting cookie\", e);\n }\n d = null;\n }\n return d ?? encryptedValue.toString(\"utf-8\");\n}\n\nasync function getChromeCookies(\n {\n name,\n domain = \"%\",\n requireJwt = false\n }: {\n name: string;\n domain: string;\n requireJwt: boolean | undefined;\n //\n }\n //\n): Promise<ExportedCookie[]> {\n const encryptedDataItems: CookieRow[] = await getPromise(name, domain);\n const password: string = await getChromePassword();\n const decrypted: Promise<ExportedCookie | null>[] = encryptedDataItems\n .filter(({ value }) => value != null && value.length > 0)\n .map(async (cookieRow: CookieRow) => {\n const encryptedValue: Buffer = cookieRow.value;\n const decryptedValue = await decryptValue(password, encryptedValue);\n const meta = {};\n merge(meta, cookieRow.meta ?? {});\n return {\n domain: cookieRow.domain,\n name: cookieRow.name,\n value: decryptedValue,\n meta: meta\n };\n });\n const results: ExportedCookie[] = (await Promise.all(decrypted)).filter(isExportedCookie);\n if (env.VERBOSE) {\n console.log(\"results\", results);\n }\n return results;\n}\n\nconst chromeLocal = path.join(\n HOME,\n \"Library\",\n \"Application Support\",\n \"Google\",\n \"Chrome\"\n);\n\nasync function getEncryptedChromeCookie(\n {\n name,\n domain,\n file = path.join(chromeLocal, \"Default\", \"Cookies\")\n //\n }: {\n name: string;\n domain: string;\n file: string;\n }): Promise<CookieRow[]> {\n if (!existsSync(file)) {\n throw new Error(`File ${file} does not exist`);\n }\n if (env.VERBOSE) {\n const s = file.split(\"/\").slice(-3).join(\"/\");\n console.log(`Trying Chrome (at ${s}) cookie ${name} for domain ${domain}`);\n }\n let sql;\n sql = `SELECT encrypted_value, name, host_key FROM cookies`;\n const wildcardRegexp = /^([*%])$/i;\n const specifiedName = name.match(wildcardRegexp) == null;\n const specifiedDomain = domain.match(wildcardRegexp) == null;\n if (specifiedName || specifiedDomain) {\n sql += ` WHERE `;\n if (specifiedName) {\n sql += `name = '${name}'`;\n if (specifiedDomain) {\n sql += ` AND `;\n }\n }\n if (specifiedDomain) {\n sql += `host_key LIKE '${domain}';`;\n }\n }\n return doSqliteQuery1(file, sql);\n}\n\nasync function getChromePassword(): Promise<string> {\n return execSimple(\n \"security find-generic-password -w -s \\\"Chrome Safe Storage\\\"\"\n );\n}\n\nasync function decrypt(password: crypto.BinaryLike, encryptedData: Buffer): Promise<string> {\n if (typeof password !== \"string\") {\n throw new Error(\"password must be a string: \" + password);\n }\n let encryptedData1: any;\n encryptedData1 = encryptedData;\n if (encryptedData1 == null || typeof encryptedData1 !== \"object\") {\n throw new Error(\"encryptedData must be a object: \" + encryptedData1);\n }\n if (!(encryptedData1 instanceof Buffer)) {\n if (Array.isArray(encryptedData1) && encryptedData1[0] instanceof Buffer) {\n [encryptedData1] = encryptedData1;\n if (env.VERBOSE) {\n console.log(\n `encryptedData is an array of buffers, selected first: ${encryptedData1}`\n );\n }\n } else {\n throw new Error(\"encryptedData must be a Buffer: \" + encryptedData1);\n }\n encryptedData1 = Buffer.from(encryptedData1);\n }\n if (env.VERBOSE) {\n console.log(`Trying to decrypt with password ${password}`);\n }\n return new Promise((resolve, reject) => {\n crypto.pbkdf2(password,\n \"saltysalt\",\n 1003,\n 16,\n \"sha1\",\n (error, buffer) => {\n try {\n if (error) {\n if (env.VERBOSE) {\n console.log(\"Error doing pbkdf2\", error);\n }\n reject(error);\n return;\n }\n\n if (buffer.length !== 16) {\n if (env.VERBOSE) {\n console.log(\n \"Error doing pbkdf2, buffer length is not 16\",\n buffer.length\n );\n }\n reject(new Error(\"Buffer length is not 16\"));\n return;\n }\n\n const str = new Array(17).join(\" \");\n const iv = Buffer.from(str, \"binary\");\n const decipher = crypto.createDecipheriv(\"aes-128-cbc\", buffer, iv);\n decipher.setAutoPadding(false);\n\n if (encryptedData1 && encryptedData1.slice) {\n encryptedData1 = encryptedData1.slice(3);\n }\n\n if (encryptedData1.length % 16 !== 0) {\n if (env.VERBOSE) {\n console.log(\n \"Error doing pbkdf2, encryptedData length is not a multiple of 16\",\n encryptedData1.length\n );\n }\n reject(new Error(\"encryptedData length is not a multiple of 16\"));\n return;\n }\n\n let decoded = decipher.update(encryptedData1);\n try {\n decipher.final(\"utf-8\");\n } catch (e) {\n if (env.VERBOSE) {\n console.log(\"Error doing decipher.final()\", e);\n }\n reject(e);\n return;\n }\n\n const padding = decoded[decoded.length - 1];\n if (padding) {\n decoded = decoded.slice(0, 0 - padding);\n }\n // noinspection JSCheckFunctionSignatures\n const decodedString = decoded.toString(\"utf8\");\n resolve(decodedString);\n } catch (e) {\n reject(e);\n }\n });\n });\n}\n","import {ExportedCookie} from \"../CookieRow\";\n\nexport default class AbstractCookieQueryStrategy {\n async queryCookies(name: string, domain: string): Promise<ExportedCookie[]> {\n if (process.env.NODE_ENV === \"development\") {\n console.log(\"queryCookie\", name, domain);\n }\n return [];\n }\n}\n","// noinspection JSUnusedGlobalSymbols\n\nimport {exec, ExecException} from \"child_process\";\n\nexport async function execSimple(command: string): Promise<string> {\n if (process.env.VERBOSE) {\n console.log(command);\n }\n return new Promise((resolve, reject) => {\n exec(\n command,\n { encoding: \"binary\", maxBuffer: 5 * 1024 },\n (error: ExecException | null, stdout: string, stderr: string) => {\n if (error) {\n reject(error);\n return;\n }\n if (stderr) {\n reject(error);\n return;\n }\n if (stdout) {\n resolve(stdout.trim());\n }\n }\n );\n });\n}\n\n// export async function execAsBuffer(command: string) {\n// if (process.env.VERBOSE) {\n// console.log(command);\n// }\n// return await new Promise((resolve, reject) => {\n// exec(\n// command,\n// { encoding: \"binary\", maxBuffer: 5 * 1024 },\n// (error: ExecException | null, stdout: string, stderr: string) => {\n// if (error) {\n// reject(error);\n// return;\n// }\n// if (stderr) {\n// reject(error);\n// return;\n// }\n// let stdoutAsBuffer: string = stdout;\n// if (typeof stdoutAsBuffer === \"string\" && stdoutAsBuffer.length > 0) {\n// // noinspection JSCheckFunctionSignatures\n// stdoutAsBuffer = Buffer.from(stdoutAsBuffer, \"binary\").slice(0, -1);\n// }\n// if (stdoutAsBuffer && stdoutAsBuffer.length > 0) {\n// resolve(stdoutAsBuffer);\n// }\n// }\n// );\n// });\n// }\n\n// @ts-ignore\nexport function toStringValue(r: any): string {\n if (process.env.VERBOSE) {\n console.log(\"Printing value\", r);\n }\n if (r) {\n if (typeof r === \"string\") {\n return r;\n } else if (r.toString) {\n // noinspection JSCheckFunctionSignatures\n return r.toString(\"utf8\");\n }\n }\n}\n\nexport function printStringValue(r: any) {\n if (process.env.VERBOSE) {\n console.log(\"Printing value\", r);\n }\n if (r) {\n if (typeof r === \"string\") {\n console.log(r);\n } else if (r.toString) {\n // noinspection JSCheckFunctionSignatures\n console.log(r.toString(\"utf8\"));\n }\n }\n}\n\n/**\n *\n * @param result\n * @returns {string|null}\n */\nexport function toStringOrNull(result: any) {\n if (result == null) {\n return null;\n }\n if (process.env.VERBOSE) {\n console.log(\"result\", result);\n }\n if (typeof result === \"string\" && result.length > 0) {\n return result;\n }\n if (result.slice && result.toString) {\n // noinspection JSCheckFunctionSignatures\n return result.toString(\"utf8\");\n }\n return null;\n}\n\nexport function invalidString(input: any): boolean {\n return typeof input !== \"string\" || input.length === 0;\n}\n\n\nexport function validString(input: any): input is string {\n return typeof input == \"string\" && input.length > 0;\n}\n","const { merge } = require(\"lodash\");\nexport const env: any = {};\nmerge(env, process.env);\nexport const HOME: string = env[\"HOME\"];\nif (!HOME) {\n throw new Error(\"HOME environment variable is not set\");\n}\n","import { env } from \"./global\";\nimport * as fs from \"fs\";\n\nexport async function findAllFiles(\n {\n path,\n name,\n maxDepth = 2\n//\n }: {\n path: string;\n name: string;\n maxDepth?: number;\n }\n): Promise<string[]> {\n const rootSegments = path.split(\"/\").length;\n\n if (env.VERBOSE) {\n console.log(`Searching for ${name} in ${path}`);\n }\n const files: string[] = [];\n let readdirSync;\n try {\n readdirSync = fs.readdirSync(path);\n } catch (e) {\n if (env.VERBOSE) {\n console.log(`Error reading ${path}`, e);\n }\n return [];\n }\n for (const file of readdirSync) {\n const filePath = path + \"/\" + file;\n let stat;\n try {\n stat = fs.statSync(filePath);\n } catch (e) {\n if (env.VERBOSE) {\n console.error(`Error getting stat for ${filePath}`, e);\n }\n continue;\n }\n if (stat.isDirectory()) {\n if (filePath.split(\"/\").length < rootSegments + maxDepth) {\n try {\n const subFiles = await findAllFiles({\n path: filePath,\n name: name,\n maxDepth: 2\n });\n files.push(...subFiles);\n } catch (e) {\n if (env.VERBOSE) {\n console.error(e);\n }\n }\n }\n } else if (file === name) {\n files.push(filePath);\n }\n }\n if (env.VERBOSE) {\n if (files.length > 0) {\n console.log(`Found ${files.length} ${name} files`);\n console.log(files);\n }\n }\n return files;\n}\n","export interface CookieRow {\n domain: string;\n name: string;\n value: Buffer;\n meta?: any;\n}\n\nexport function isCookieRow(obj: any): obj is CookieRow {\n return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;\n}\n\nexport interface ExportedCookie {\n domain: string;\n name: string;\n value: string;\n meta?: any;\n}\n\nexport function isExportedCookie(obj: any): obj is ExportedCookie {\n return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;\n}\n","import * as fs from \"fs\";\nimport * as sqlite3 from \"sqlite3\";\nimport {CookieRow} from \"./CookieRow\";\n\nexport async function doSqliteQuery1(file: string, sql: string): Promise<CookieRow[]> {\n if (!fs.existsSync(file)) {\n throw new Error(`doSqliteQuery1: file ${file} does not exist`);\n }\n const db = new sqlite3.Database(file);\n return new Promise((resolve, reject) => {\n db.all(sql, (err: Error, rows: any[]) => {\n if (err) {\n if (process.env.VERBOSE) {\n console.log(`doSqliteQuery1: error ${err}`);\n }\n reject(err);\n return;\n }\n const rows1: any[] = rows;\n if (rows1 == null || rows1.length === 0) {\n if (process.env.VERBOSE) {\n console.log(`doSqliteQuery1: no rows`);\n }\n resolve([]);\n return;\n }\n if (Array.isArray(rows1)) {\n const cookieRows: CookieRow[] = rows1.map((row) => {\n return {\n domain: row[\"host_key\"],\n name: row[\"name\"],\n value: row[\"encrypted_value\"],\n meta: {\n file: file\n }\n }\n })\n resolve(cookieRows);\n return;\n }\n if (process.env.VERBOSE) {\n console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);\n }\n resolve([rows1]);\n });\n });\n}\n","import AbstractCookieQueryStrategy from \"./AbstractCookieQueryStrategy\";\nimport { env, HOME } from \"../global\";\nimport { existsSync } from \"fs\";\nimport { toStringOrNull } from \"../utils\";\nimport { findAllFiles } from \"../findAllFiles\";\nimport * as path from \"path\";\nimport { doSqliteQuery1 } from \"../doSqliteQuery1\";\nimport { ExportedCookie } from \"../CookieRow\";\n\nexport default class FirefoxCookieQueryStrategy extends AbstractCookieQueryStrategy {\n async queryCookies(name: string, domain: string): Promise<ExportedCookie[]> {\n if (process.platform !== \"darwin\") {\n throw new Error(\"This only works on macOS\");\n }\n if (env.CHROME_ONLY) {\n return [];\n }\n const cookies = await this.#getFirefoxCookie({ name, domain });\n return Array.isArray(cookies) ? cookies.map(toStringOrNull) : [];\n }\n\n /**\n *\n * @param name\n * @param domain\n * @returns {Promise<Buffer>}\n */\n async #getFirefoxCookie(\n //\n {\n name,\n domain\n }: {\n name: string,\n domain: string\n //\n }\n //\n ) {\n const files: string[] = await findAllFiles({\n path: path.join(\n HOME,\n \"Library\",\n \"Application Support\",\n \"Firefox\",\n \"Profiles\"\n ),\n name: \"cookies.sqlite\"\n });\n const all = await Promise.all(\n files.map((file) => {\n return this.#queryCookiesDb(file, name, domain);\n })\n );\n return all.flat();\n }\n\n #queryCookiesDb(file: string, name: string, domain: string) {\n if (file && !existsSync(file)) {\n throw new Error(`File ${file} does not exist`);\n }\n if (env.VERBOSE) {\n console.log(`Trying Firefox cookie ${name} for domain ${domain}`);\n }\n let sql;\n //language=SQL\n sql = \"SELECT value FROM moz_cookies\";\n if (typeof name === \"string\" || typeof domain === \"string\") {\n sql += ` WHERE `;\n if (typeof name === \"string\") {\n sql += `name = '${name}'`;\n if (typeof domain === \"string\") {\n sql += ` AND `;\n }\n }\n if (typeof domain === \"string\") {\n sql += `host LIKE '${domain}';`;\n }\n }\n return doSqliteQuery1(file, sql)\n .then((rows) => {\n return rows.map((row) => {\n return {\n domain: row.domain,\n name: row.name,\n value: row.value.toString(\"utf8\")\n };\n });\n })\n .catch(() => []);\n }\n}\n","import AbstractCookieQueryStrategy from \"./AbstractCookieQueryStrategy\";\n\nexport default class SafariCookieQueryStrategy extends AbstractCookieQueryStrategy {}\n","import jsonwebtoken from \"jsonwebtoken\";\nimport { env } from \"./global\";\n\nexport default function isValidJwt(token: any) {\n try {\n const result = jsonwebtoken.decode(token, { complete: true });\n if (env.VERBOSE) {\n console.log(result);\n }\n return true;\n } catch (err) {\n return false;\n }\n}\n"],"names":[],"version":3,"file":"main.js.map","sourceRoot":"../"}
|
package/dist/module.js
ADDED
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {uniqBy as $cE5Fr$uniqBy, merge as $cE5Fr$merge} from "lodash";
|
|
3
|
+
import {existsSync as $cE5Fr$existsSync, readdirSync as $cE5Fr$readdirSync, statSync as $cE5Fr$statSync} from "fs";
|
|
4
|
+
import {pbkdf2 as $cE5Fr$pbkdf2, createDecipheriv as $cE5Fr$createDecipheriv} from "crypto";
|
|
5
|
+
import {join as $cE5Fr$join} from "path";
|
|
6
|
+
import {exec as $cE5Fr$exec} from "child_process";
|
|
7
|
+
import {Database as $cE5Fr$Database} from "sqlite3";
|
|
8
|
+
import $cE5Fr$jsonwebtoken from "jsonwebtoken";
|
|
9
|
+
|
|
10
|
+
class $c55d640bfb5eb523$export$2e2bcd8739ae039 {
|
|
11
|
+
async queryCookies(name, domain) {
|
|
12
|
+
if (process.env.NODE_ENV === "development") console.log("queryCookie", name, domain);
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
async function $94d34fb9fc1942e3$export$8d71c74f97c0202e(command) {
|
|
20
|
+
if (process.env.VERBOSE) console.log(command);
|
|
21
|
+
return new Promise((resolve, reject)=>{
|
|
22
|
+
(0, $cE5Fr$exec)(command, {
|
|
23
|
+
encoding: "binary",
|
|
24
|
+
maxBuffer: 5120
|
|
25
|
+
}, (error, stdout, stderr)=>{
|
|
26
|
+
if (error) {
|
|
27
|
+
reject(error);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (stderr) {
|
|
31
|
+
reject(error);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (stdout) resolve(stdout.trim());
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function $94d34fb9fc1942e3$export$33d3adc27420eed5(r) {
|
|
39
|
+
if (process.env.VERBOSE) console.log("Printing value", r);
|
|
40
|
+
if (r) {
|
|
41
|
+
if (typeof r === "string") return r;
|
|
42
|
+
else if (r.toString) // noinspection JSCheckFunctionSignatures
|
|
43
|
+
return r.toString("utf8");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function $94d34fb9fc1942e3$export$1ed1ce2ec2b4f5a3(r) {
|
|
47
|
+
if (process.env.VERBOSE) console.log("Printing value", r);
|
|
48
|
+
if (r) {
|
|
49
|
+
if (typeof r === "string") console.log(r);
|
|
50
|
+
else if (r.toString) // noinspection JSCheckFunctionSignatures
|
|
51
|
+
console.log(r.toString("utf8"));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function $94d34fb9fc1942e3$export$d53bf2de587a369(result) {
|
|
55
|
+
if (result == null) return null;
|
|
56
|
+
if (process.env.VERBOSE) console.log("result", result);
|
|
57
|
+
if (typeof result === "string" && result.length > 0) return result;
|
|
58
|
+
if (result.slice && result.toString) // noinspection JSCheckFunctionSignatures
|
|
59
|
+
return result.toString("utf8");
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
function $94d34fb9fc1942e3$export$99ce3e33a555daf1(input) {
|
|
63
|
+
return typeof input !== "string" || input.length === 0;
|
|
64
|
+
}
|
|
65
|
+
function $94d34fb9fc1942e3$export$5348b46700dd771c(input) {
|
|
66
|
+
return typeof input == "string" && input.length > 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
var $672ffeb43f5a0a33$require$merge = $cE5Fr$merge;
|
|
72
|
+
const $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3 = {};
|
|
73
|
+
$672ffeb43f5a0a33$require$merge($672ffeb43f5a0a33$export$a7b6bc01c63cdfc3, process.env);
|
|
74
|
+
const $672ffeb43f5a0a33$export$a7c5707626fc90f = $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3["HOME"];
|
|
75
|
+
if (!$672ffeb43f5a0a33$export$a7c5707626fc90f) throw new Error("HOME environment variable is not set");
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
async function $1ad80752da39350f$export$2c9faf86071156ae({ path: path , name: name , maxDepth: maxDepth = 2 }) {
|
|
82
|
+
const rootSegments = path.split("/").length;
|
|
83
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log(`Searching for ${name} in ${path}`);
|
|
84
|
+
const files = [];
|
|
85
|
+
let readdirSync;
|
|
86
|
+
try {
|
|
87
|
+
readdirSync = $cE5Fr$readdirSync(path);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log(`Error reading ${path}`, e);
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
for (const file of readdirSync){
|
|
93
|
+
const filePath = path + "/" + file;
|
|
94
|
+
let stat;
|
|
95
|
+
try {
|
|
96
|
+
stat = $cE5Fr$statSync(filePath);
|
|
97
|
+
} catch (e1) {
|
|
98
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.error(`Error getting stat for ${filePath}`, e1);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (stat.isDirectory()) {
|
|
102
|
+
if (filePath.split("/").length < rootSegments + maxDepth) try {
|
|
103
|
+
const subFiles = await $1ad80752da39350f$export$2c9faf86071156ae({
|
|
104
|
+
path: filePath,
|
|
105
|
+
name: name,
|
|
106
|
+
maxDepth: 2
|
|
107
|
+
});
|
|
108
|
+
files.push(...subFiles);
|
|
109
|
+
} catch (e2) {
|
|
110
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.error(e2);
|
|
111
|
+
}
|
|
112
|
+
} else if (file === name) files.push(filePath);
|
|
113
|
+
}
|
|
114
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) {
|
|
115
|
+
if (files.length > 0) {
|
|
116
|
+
console.log(`Found ${files.length} ${name} files`);
|
|
117
|
+
console.log(files);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return files;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
function $622a8580a5a4b38d$export$bc926c43858bd3cb(obj) {
|
|
127
|
+
return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;
|
|
128
|
+
}
|
|
129
|
+
function $622a8580a5a4b38d$export$963c8d651337e4a4(obj) {
|
|
130
|
+
return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
async function $9d2c7aa42fa2ecf2$export$f19f611d1fa7c6f3(file, sql) {
|
|
137
|
+
if (!$cE5Fr$existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
|
|
138
|
+
const db = new $cE5Fr$Database(file);
|
|
139
|
+
return new Promise((resolve, reject)=>{
|
|
140
|
+
db.all(sql, (err, rows)=>{
|
|
141
|
+
if (err) {
|
|
142
|
+
if (process.env.VERBOSE) console.log(`doSqliteQuery1: error ${err}`);
|
|
143
|
+
reject(err);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const rows1 = rows;
|
|
147
|
+
if (rows1 == null || rows1.length === 0) {
|
|
148
|
+
if (process.env.VERBOSE) console.log(`doSqliteQuery1: no rows`);
|
|
149
|
+
resolve([]);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (Array.isArray(rows1)) {
|
|
153
|
+
const cookieRows = rows1.map((row)=>{
|
|
154
|
+
return {
|
|
155
|
+
domain: row["host_key"],
|
|
156
|
+
name: row["name"],
|
|
157
|
+
value: row["encrypted_value"],
|
|
158
|
+
meta: {
|
|
159
|
+
file: file
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
resolve(cookieRows);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (process.env.VERBOSE) console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
|
|
167
|
+
resolve([
|
|
168
|
+
rows1
|
|
169
|
+
]);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class $179cc8ad79464497$export$2e2bcd8739ae039 extends (0, $c55d640bfb5eb523$export$2e2bcd8739ae039) {
|
|
177
|
+
async queryCookies(name, domain) {
|
|
178
|
+
if (process.platform !== "darwin") throw new Error("This only works on macOS");
|
|
179
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).FIREFOX_ONLY) return [];
|
|
180
|
+
return $179cc8ad79464497$var$getChromeCookies({
|
|
181
|
+
requireJwt: false,
|
|
182
|
+
name: name,
|
|
183
|
+
domain: domain
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
async function $179cc8ad79464497$var$getPromise1(name, domain, file) {
|
|
188
|
+
try {
|
|
189
|
+
return await $179cc8ad79464497$var$getEncryptedChromeCookie({
|
|
190
|
+
name: name,
|
|
191
|
+
domain: domain,
|
|
192
|
+
file: file
|
|
193
|
+
});
|
|
194
|
+
} catch (e) {
|
|
195
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log("Error getting encrypted cookie", e);
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
async function $179cc8ad79464497$var$getPromise(name, domain) {
|
|
200
|
+
try {
|
|
201
|
+
const files = await (0, $1ad80752da39350f$export$2c9faf86071156ae)({
|
|
202
|
+
path: $179cc8ad79464497$var$chromeLocal,
|
|
203
|
+
name: "Cookies"
|
|
204
|
+
});
|
|
205
|
+
const promises = files.map((file)=>$179cc8ad79464497$var$getPromise1(name, domain, file));
|
|
206
|
+
const results1 = await Promise.all(promises);
|
|
207
|
+
return results1.flat().filter((0, $622a8580a5a4b38d$export$bc926c43858bd3cb));
|
|
208
|
+
} catch (error) {
|
|
209
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log("error", error);
|
|
210
|
+
return [];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
async function $179cc8ad79464497$var$decryptValue(password, encryptedValue) {
|
|
214
|
+
let d;
|
|
215
|
+
try {
|
|
216
|
+
d = await $179cc8ad79464497$var$decrypt(password, encryptedValue);
|
|
217
|
+
} catch (e) {
|
|
218
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log("Error decrypting cookie", e);
|
|
219
|
+
d = null;
|
|
220
|
+
}
|
|
221
|
+
return d ?? encryptedValue.toString("utf-8");
|
|
222
|
+
}
|
|
223
|
+
async function $179cc8ad79464497$var$getChromeCookies({ name: name , domain: domain = "%" , requireJwt: requireJwt = false }) {
|
|
224
|
+
const encryptedDataItems = await $179cc8ad79464497$var$getPromise(name, domain);
|
|
225
|
+
const password = await $179cc8ad79464497$var$getChromePassword();
|
|
226
|
+
const decrypted = encryptedDataItems.filter(({ value: value })=>value != null && value.length > 0).map(async (cookieRow)=>{
|
|
227
|
+
const encryptedValue = cookieRow.value;
|
|
228
|
+
const decryptedValue = await $179cc8ad79464497$var$decryptValue(password, encryptedValue);
|
|
229
|
+
const meta = {};
|
|
230
|
+
(0, $cE5Fr$merge)(meta, cookieRow.meta ?? {});
|
|
231
|
+
return {
|
|
232
|
+
domain: cookieRow.domain,
|
|
233
|
+
name: cookieRow.name,
|
|
234
|
+
value: decryptedValue,
|
|
235
|
+
meta: meta
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
const results = (await Promise.all(decrypted)).filter((0, $622a8580a5a4b38d$export$963c8d651337e4a4));
|
|
239
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log("results", results);
|
|
240
|
+
return results;
|
|
241
|
+
}
|
|
242
|
+
const $179cc8ad79464497$var$chromeLocal = $cE5Fr$join((0, $672ffeb43f5a0a33$export$a7c5707626fc90f), "Library", "Application Support", "Google", "Chrome");
|
|
243
|
+
async function $179cc8ad79464497$var$getEncryptedChromeCookie({ name: name , domain: domain , file: file = $cE5Fr$join($179cc8ad79464497$var$chromeLocal, "Default", "Cookies") }) {
|
|
244
|
+
if (!(0, $cE5Fr$existsSync)(file)) throw new Error(`File ${file} does not exist`);
|
|
245
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) {
|
|
246
|
+
const s = file.split("/").slice(-3).join("/");
|
|
247
|
+
console.log(`Trying Chrome (at ${s}) cookie ${name} for domain ${domain}`);
|
|
248
|
+
}
|
|
249
|
+
let sql;
|
|
250
|
+
sql = `SELECT encrypted_value, name, host_key FROM cookies`;
|
|
251
|
+
const wildcardRegexp = /^([*%])$/i;
|
|
252
|
+
const specifiedName = name.match(wildcardRegexp) == null;
|
|
253
|
+
const specifiedDomain = domain.match(wildcardRegexp) == null;
|
|
254
|
+
if (specifiedName || specifiedDomain) {
|
|
255
|
+
sql += ` WHERE `;
|
|
256
|
+
if (specifiedName) {
|
|
257
|
+
sql += `name = '${name}'`;
|
|
258
|
+
if (specifiedDomain) sql += ` AND `;
|
|
259
|
+
}
|
|
260
|
+
if (specifiedDomain) sql += `host_key LIKE '${domain}';`;
|
|
261
|
+
}
|
|
262
|
+
return (0, $9d2c7aa42fa2ecf2$export$f19f611d1fa7c6f3)(file, sql);
|
|
263
|
+
}
|
|
264
|
+
async function $179cc8ad79464497$var$getChromePassword() {
|
|
265
|
+
return (0, $94d34fb9fc1942e3$export$8d71c74f97c0202e)('security find-generic-password -w -s "Chrome Safe Storage"');
|
|
266
|
+
}
|
|
267
|
+
async function $179cc8ad79464497$var$decrypt(password, encryptedData) {
|
|
268
|
+
if (typeof password !== "string") throw new Error("password must be a string: " + password);
|
|
269
|
+
let encryptedData1;
|
|
270
|
+
encryptedData1 = encryptedData;
|
|
271
|
+
if (encryptedData1 == null || typeof encryptedData1 !== "object") throw new Error("encryptedData must be a object: " + encryptedData1);
|
|
272
|
+
if (!(encryptedData1 instanceof Buffer)) {
|
|
273
|
+
if (Array.isArray(encryptedData1) && encryptedData1[0] instanceof Buffer) {
|
|
274
|
+
[encryptedData1] = encryptedData1;
|
|
275
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log(`encryptedData is an array of buffers, selected first: ${encryptedData1}`);
|
|
276
|
+
} else throw new Error("encryptedData must be a Buffer: " + encryptedData1);
|
|
277
|
+
encryptedData1 = Buffer.from(encryptedData1);
|
|
278
|
+
}
|
|
279
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log(`Trying to decrypt with password ${password}`);
|
|
280
|
+
return new Promise((resolve, reject)=>{
|
|
281
|
+
$cE5Fr$pbkdf2(password, "saltysalt", 1003, 16, "sha1", (error, buffer)=>{
|
|
282
|
+
try {
|
|
283
|
+
if (error) {
|
|
284
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log("Error doing pbkdf2", error);
|
|
285
|
+
reject(error);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if (buffer.length !== 16) {
|
|
289
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log("Error doing pbkdf2, buffer length is not 16", buffer.length);
|
|
290
|
+
reject(new Error("Buffer length is not 16"));
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
const str = new Array(17).join(" ");
|
|
294
|
+
const iv = Buffer.from(str, "binary");
|
|
295
|
+
const decipher = $cE5Fr$createDecipheriv("aes-128-cbc", buffer, iv);
|
|
296
|
+
decipher.setAutoPadding(false);
|
|
297
|
+
if (encryptedData1 && encryptedData1.slice) encryptedData1 = encryptedData1.slice(3);
|
|
298
|
+
if (encryptedData1.length % 16 !== 0) {
|
|
299
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log("Error doing pbkdf2, encryptedData length is not a multiple of 16", encryptedData1.length);
|
|
300
|
+
reject(new Error("encryptedData length is not a multiple of 16"));
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
let decoded = decipher.update(encryptedData1);
|
|
304
|
+
try {
|
|
305
|
+
decipher.final("utf-8");
|
|
306
|
+
} catch (e) {
|
|
307
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log("Error doing decipher.final()", e);
|
|
308
|
+
reject(e);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const padding = decoded[decoded.length - 1];
|
|
312
|
+
if (padding) decoded = decoded.slice(0, 0 - padding);
|
|
313
|
+
// noinspection JSCheckFunctionSignatures
|
|
314
|
+
const decodedString = decoded.toString("utf8");
|
|
315
|
+
resolve(decodedString);
|
|
316
|
+
} catch (e1) {
|
|
317
|
+
reject(e1);
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
class $e2bb11114a5548c6$export$2e2bcd8739ae039 extends (0, $c55d640bfb5eb523$export$2e2bcd8739ae039) {
|
|
332
|
+
async queryCookies(name, domain) {
|
|
333
|
+
if (process.platform !== "darwin") throw new Error("This only works on macOS");
|
|
334
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).CHROME_ONLY) return [];
|
|
335
|
+
const cookies = await this.#getFirefoxCookie({
|
|
336
|
+
name: name,
|
|
337
|
+
domain: domain
|
|
338
|
+
});
|
|
339
|
+
return Array.isArray(cookies) ? cookies.map((0, $94d34fb9fc1942e3$export$d53bf2de587a369)) : [];
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
*
|
|
343
|
+
* @param name
|
|
344
|
+
* @param domain
|
|
345
|
+
* @returns {Promise<Buffer>}
|
|
346
|
+
*/ async #getFirefoxCookie(//
|
|
347
|
+
{ name: name , domain: domain }) {
|
|
348
|
+
const files = await (0, $1ad80752da39350f$export$2c9faf86071156ae)({
|
|
349
|
+
path: $cE5Fr$join((0, $672ffeb43f5a0a33$export$a7c5707626fc90f), "Library", "Application Support", "Firefox", "Profiles"),
|
|
350
|
+
name: "cookies.sqlite"
|
|
351
|
+
});
|
|
352
|
+
const all = await Promise.all(files.map((file)=>{
|
|
353
|
+
return this.#queryCookiesDb(file, name, domain);
|
|
354
|
+
}));
|
|
355
|
+
return all.flat();
|
|
356
|
+
}
|
|
357
|
+
#queryCookiesDb(file, name1, domain1) {
|
|
358
|
+
if (file && !(0, $cE5Fr$existsSync)(file)) throw new Error(`File ${file} does not exist`);
|
|
359
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log(`Trying Firefox cookie ${name1} for domain ${domain1}`);
|
|
360
|
+
let sql;
|
|
361
|
+
//language=SQL
|
|
362
|
+
sql = "SELECT value FROM moz_cookies";
|
|
363
|
+
if (typeof name1 === "string" || typeof domain1 === "string") {
|
|
364
|
+
sql += ` WHERE `;
|
|
365
|
+
if (typeof name1 === "string") {
|
|
366
|
+
sql += `name = '${name1}'`;
|
|
367
|
+
if (typeof domain1 === "string") sql += ` AND `;
|
|
368
|
+
}
|
|
369
|
+
if (typeof domain1 === "string") sql += `host LIKE '${domain1}';`;
|
|
370
|
+
}
|
|
371
|
+
return (0, $9d2c7aa42fa2ecf2$export$f19f611d1fa7c6f3)(file, sql).then((rows)=>{
|
|
372
|
+
return rows.map((row)=>{
|
|
373
|
+
return {
|
|
374
|
+
domain: row.domain,
|
|
375
|
+
name: row.name,
|
|
376
|
+
value: row.value.toString("utf8")
|
|
377
|
+
};
|
|
378
|
+
});
|
|
379
|
+
}).catch(()=>[]);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
class $ae426ef38848e3ae$export$2e2bcd8739ae039 extends (0, $c55d640bfb5eb523$export$2e2bcd8739ae039) {
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
class $e4dc93e15167afaf$export$2e2bcd8739ae039 extends (0, $c55d640bfb5eb523$export$2e2bcd8739ae039) {
|
|
391
|
+
#strategies;
|
|
392
|
+
constructor(){
|
|
393
|
+
super();
|
|
394
|
+
this.#strategies = [
|
|
395
|
+
(0, $179cc8ad79464497$export$2e2bcd8739ae039),
|
|
396
|
+
(0, $e2bb11114a5548c6$export$2e2bcd8739ae039),
|
|
397
|
+
(0, $ae426ef38848e3ae$export$2e2bcd8739ae039),
|
|
398
|
+
].map((strategy)=>{
|
|
399
|
+
return new strategy();
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
async queryCookies(name, domain) {
|
|
403
|
+
const results = await Promise.all(this.#strategies.map(async (strategy)=>{
|
|
404
|
+
// @ts-ignore
|
|
405
|
+
const cookies = strategy.queryCookies(name, domain);
|
|
406
|
+
return cookies.catch(()=>[]);
|
|
407
|
+
}));
|
|
408
|
+
return results.flat();
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
function $c0e0097c98ba1117$export$2e2bcd8739ae039(token) {
|
|
418
|
+
try {
|
|
419
|
+
const result = (0, $cE5Fr$jsonwebtoken).decode(token, {
|
|
420
|
+
complete: true
|
|
421
|
+
});
|
|
422
|
+
if ((0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).VERBOSE) console.log(result);
|
|
423
|
+
return true;
|
|
424
|
+
} catch (err) {
|
|
425
|
+
return false;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
async function $bea00efd5f6bccda$export$e6d428437cf2cacb({ name: name , domain: domain }, strategy = new (0, $e4dc93e15167afaf$export$2e2bcd8739ae039)()) {
|
|
431
|
+
const results = await strategy.queryCookies(name, domain);
|
|
432
|
+
const results1 = (0, $cE5Fr$uniqBy)(results, JSON.stringify);
|
|
433
|
+
const jwtCookies = [];
|
|
434
|
+
for (const result of results1){
|
|
435
|
+
const value = result.value;
|
|
436
|
+
if ((0, $c0e0097c98ba1117$export$2e2bcd8739ae039)(value)) jwtCookies.push(result);
|
|
437
|
+
}
|
|
438
|
+
const resultsUniq = (0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).REQUIRE_JWT ? jwtCookies : results1;
|
|
439
|
+
return (0, $672ffeb43f5a0a33$export$a7b6bc01c63cdfc3).SINGLE ? [
|
|
440
|
+
resultsUniq[0]
|
|
441
|
+
] : resultsUniq;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
async function $32bf08fc0ad0b0fe$export$4be65e66cfa2648a(params) {
|
|
449
|
+
const cookies = await (0, $bea00efd5f6bccda$export$e6d428437cf2cacb)(params, new (0, $e4dc93e15167afaf$export$2e2bcd8739ae039)());
|
|
450
|
+
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
451
|
+
else throw new Error("Cookie not found");
|
|
452
|
+
}
|
|
453
|
+
async function $32bf08fc0ad0b0fe$export$c44c5fdef43f0941(params) {
|
|
454
|
+
const cookies = await (0, $bea00efd5f6bccda$export$e6d428437cf2cacb)(params, new (0, $e2bb11114a5548c6$export$2e2bcd8739ae039)());
|
|
455
|
+
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
456
|
+
else throw new Error("Cookie not found");
|
|
457
|
+
}
|
|
458
|
+
async function $32bf08fc0ad0b0fe$export$e5637297e9eb6f2e(params) {
|
|
459
|
+
const cookies = await (0, $bea00efd5f6bccda$export$e6d428437cf2cacb)(params, new (0, $179cc8ad79464497$export$2e2bcd8739ae039)());
|
|
460
|
+
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
461
|
+
else throw new Error("Cookie not found");
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
export {$32bf08fc0ad0b0fe$export$4be65e66cfa2648a as getCookie, $32bf08fc0ad0b0fe$export$c44c5fdef43f0941 as getFirefoxCookie, $32bf08fc0ad0b0fe$export$e5637297e9eb6f2e as getChromeCookie};
|
|
466
|
+
//# sourceMappingURL=module.js.map
|