Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.221.175.172
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/node_modules/npm/node_modules/@npmcli/redact/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/lib/node_modules/npm/node_modules/@npmcli/redact/lib/index.js
const matchers = require('./matchers')
const { redactUrlPassword } = require('./utils')

const REPLACE = '***'

const redact = (value) => {
  if (typeof value !== 'string' || !value) {
    return value
  }
  return redactUrlPassword(value, REPLACE)
    .replace(matchers.NPM_SECRET.pattern, `npm_${REPLACE}`)
    .replace(matchers.UUID.pattern, REPLACE)
}

// split on \s|= similar to how nopt parses options
const splitAndRedact = (str) => {
  // stateful regex, don't move out of this scope
  const splitChars = /[\s=]/g

  let match = null
  let result = ''
  let index = 0
  while (match = splitChars.exec(str)) {
    result += redact(str.slice(index, match.index)) + match[0]
    index = splitChars.lastIndex
  }

  return result + redact(str.slice(index))
}

// replaces auth info in an array of arguments or in a strings
const redactLog = (arg) => {
  if (typeof arg === 'string') {
    return splitAndRedact(arg)
  } else if (Array.isArray(arg)) {
    return arg.map((a) => typeof a === 'string' ? splitAndRedact(a) : a)
  }
  return arg
}

module.exports = {
  redact,
  redactLog,
}

Anon7 - 2022
AnonSec Team