Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
parse-passwd
Advanced tools
The parse-passwd npm package is designed to parse the /etc/passwd file from Unix/Linux systems. This file contains user account information, and parsing it can be useful for system administration, security analysis, and user management tasks. The package provides a simple interface to convert the content of the /etc/passwd file into a JavaScript object for easy manipulation and access.
Parsing /etc/passwd file content
This feature allows you to parse the content of an /etc/passwd file. The code sample demonstrates how to use the parse-passwd package to convert a string representing the content of an /etc/passwd file into an array of user objects. Each object contains information about a user, such as username, password, UID, GID, full name, home directory, and shell.
const parsePasswd = require('parse-passwd');
const passwdContent = 'root:x:0:0:root:/root:/bin/bash\n';
const users = parsePasswd(passwdContent);
console.log(users);
passwd-user is a package that allows you to get user details by their username from the /etc/passwd file. Unlike parse-passwd, which parses the entire file content, passwd-user focuses on retrieving information for a specific user, making it more suitable for targeted queries.
Parse a passwd file into a list of users.
Install with npm:
$ npm install --save parse-passwd
var parse = require('parse-passwd');
Example
// 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'
//=> }
//=> ]
Params
content
{String}: Content of a passwd file to parse.returns
{Array}: Array of user objects parsed from the content.Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the contributing guide for avice on opening issues, pull requests, and coding standards.
(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)
To generate the readme and API documentation with verb:
$ npm install -g verb verb-generate-readme && verb
Install dev dependencies:
$ npm install -d && npm test
Brian Woodward
Copyright © 2016, Brian Woodward. Released under the MIT license.
This file was generated by verb-generate-readme, v0.2.0, on October 19, 2016.
FAQs
Parse a passwd file into a list of users.
The npm package parse-passwd receives a total of 5,677,862 weekly downloads. As such, parse-passwd popularity was classified as popular.
We found that parse-passwd demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.