Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
shebang-command
Advanced tools
The shebang-command npm package is used to parse the shebang (#!) line of a file to determine which interpreter should be used to execute the file. This is particularly useful when working with scripts in a Node.js environment where you might need to identify the interpreter specified in a script file.
Parse shebang line
This feature allows you to extract the command from the shebang line of a script. The code sample represents a script file with a shebang line that specifies that the script should be run with Node.js.
"#!/usr/bin/env node\nconsole.log('Hello, world!');"
The shebang-regex package provides a regular expression for matching shebang lines. It is similar to shebang-command in that it helps with shebang lines, but it does not parse the line to extract the command; it only provides the regex for matching.
The hashbang package is another tool that can be used to manage shebang lines in scripts. It is similar to shebang-command but offers a different API and might have different use cases or preferences for developers.
Get the command from a shebang
$ npm install shebang-command
const shebangCommand = require('shebang-command');
shebangCommand('#!/usr/bin/env node');
//=> 'node'
shebangCommand('#!/bin/bash');
//=> 'bash'
Type: string
String containing a shebang.
FAQs
Get the command from a shebang
The npm package shebang-command receives a total of 68,189,188 weekly downloads. As such, shebang-command popularity was classified as popular.
We found that shebang-command 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.