Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/parse-passwd/ |
Upload File : |
'use strict'; /** * Parse the content of a passwd file into a list of user objects. * This function ignores blank lines and comments. * * ```js * // assuming '/etc/passwd' contains: * // doowb:*:123:123:Brian Woodward:/Users/doowb:/bin/bash * console.log(parse(fs.readFileSync('/etc/passwd', 'utf8'))); * * //=> [ * //=> { * //=> username: 'doowb', * //=> password: '*', * //=> uid: '123', * //=> gid: '123', * //=> gecos: 'Brian Woodward', * //=> homedir: '/Users/doowb', * //=> shell: '/bin/bash' * //=> } * //=> ] * ``` * @param {String} `content` Content of a passwd file to parse. * @return {Array} Array of user objects parsed from the content. * @api public */ module.exports = function(content) { if (typeof content !== 'string') { throw new Error('expected a string'); } return content .split('\n') .map(user) .filter(Boolean); }; function user(line, i) { if (!line || !line.length || line.charAt(0) === '#') { return null; } // see https://en.wikipedia.org/wiki/Passwd for field descriptions var fields = line.split(':'); return { username: fields[0], password: fields[1], uid: fields[2], gid: fields[3], // see https://en.wikipedia.org/wiki/Gecos_field for GECOS field descriptions gecos: fields[4], homedir: fields[5], shell: fields[6] }; }