
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
password-prompt
Advanced tools
The password-prompt npm package is designed to securely prompt for a password in a Node.js application. It hides the input as the user types, making it suitable for CLI applications where sensitive information needs to be entered by the user.
Secure Password Input
This feature allows for the secure input of passwords. The code sample demonstrates how to prompt the user for a password without showing the input on the screen.
const passwordPrompt = require('password-prompt');
async function getPassword() {
const password = await passwordPrompt('Password: ');
console.log('Password entered:', password);
}
getPassword();
Inquirer.js is a comprehensive library for creating interactive CLI prompts. It supports various types of inputs including passwords, where the input can be hidden similar to password-prompt. Inquirer.js offers a broader range of functionalities beyond password input, making it more versatile but also heavier.
Prompt is a library for building interactive command-line interfaces. It supports password fields among other input types. Compared to password-prompt, it provides a more extensive set of features for handling various kinds of user inputs but might be more complex to use for simple password prompting needs.
Readline-sync is a synchronous readline library for Node.js. It can be used to handle user input in a synchronous manner, including password inputs where the entered text is not displayed. It's simpler and more straightforward for synchronous operations compared to password-prompt, but lacks the asynchronous capabilities.
Node cross-platform password prompt.
Supported Environments:
prompt -- Prompt for a password
Returns: Promise.<string>
- input from user
Param | Type | Default | Description |
---|---|---|---|
[ask] | string | prompt output | |
[options] | Object | ||
[options.method] | string | "mask" | mask or hide |
Example
let prompt = require('password-prompt')
let password = prompt('password: ')
// password: ******
FAQs
cross-platform masked or hidden prompt
We found that password-prompt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.