⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
invoice
/
node_modules
/
executioner
/
lib
/
View File Name :
parse.js
// public API module.exports = parse; /** * Parses command and updated with provided parameters * * @param {string} cmd - command template * @param {object} params - list of parameters * @returns {string} - updated command */ function parse(cmd, params) { return Object.keys(params).reduce(iterator.bind(this, params), cmd); } /** * Iterator over params elements * * @param {object} params - list of parameters * @param {string} cmd - command template * @param {string} p - parameter key * @returns {string} - updated command or empty string * if one of the params didn't pass the filter */ function iterator(params, cmd, p) { var value = params[p]; // shortcut if (!cmd) return cmd; // fold booleans into strings accepted by shell if (typeof value == 'boolean') { value = value ? '1' : ''; } if (value !== null && ['undefined', 'string', 'number'].indexOf(typeof value) == -1) { // empty out cmd to signal the error return ''; } // use empty string for `undefined` return cmd.replace(new RegExp('\\$\\{' + p + '\\}', 'g'), (value !== undefined && value !== null) ? value : ''); }