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.
A simple args parser
$ npm install --save argi
const argi = require('argi');
// Options
argi.option('name', 'description', { default: 'bob', aliases: 'n', isBool: false, hidden: false });
// Commands
argi.command('sayhi', 'description', { hidden: false });
// Parse argv
const parsed = a.parse(process.argv.slice(2));
if (parsed.sayhi) {
console.log(`Hi ${ parsed.name }!`);
} else {
console.log(args.help());
}
Type: string
The option's name.
Type: string
What the option does. Will be used for help.
Type: object
Type: string
The options default value.
Type: string
, array
Alias names for the option.
Type: boolean
Default: false
Specifies whether the option is a boolean(true
/false
) or a string. If set to true arguments after the option will count as a command.
Example:
...
argi.option('boolean', 'description', { isBool: true });
const parsed = argi.parse(['--boolean', 'value'])
parsed.boolean // => true
parsed._ // => ['value']
...
Type: boolean
Default: false
If option should be displayed in help.
Type: string
The command's name.
Type: string
What the command does. Will be used for help.
Type: object
Type: boolean
Default: false
If command should be displayed in help.
Returns a help string. Will throw an error if it's called before argi.parse()
An array of cli options. You should probably set it to process.argv.slice(2)
Returns an object with the option's values and if commands should be executed.
Example:
...
const parsed = argi.parse(['--test', '--opt', 'yes', 'build']);
// => {
// => test: true,
// => opt: 'yes',
// => build: true
// => }
...
MIT © Tobias Herber
FAQs
A simple args parser
The npm package argi receives a total of 3 weekly downloads. As such, argi popularity was classified as not popular.
We found that argi 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.