
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
cli-argparse
Advanced tools
Lightweight yet feature rich argument parser.
This module does not define any options or any program requirements it simply parses arguments into an object structure that is easier for other modules to work with.
--no-color
--option=value
and --option value
-xvf
-
as special stdin flag--
npm install cli-argparse
npm test
var parse = require('cli-argparse');
var args = [
'server',
'start',
'-xvd',
'--port=80',
'--file=file.txt',
'--file',
'file.json',
'--no-color'
];
var result = parse(args);
{
"flags": {
"x": true,
"v": true,
"d": true
},
"options": {
"port": "80",
"file": [
"file.txt",
"file.json"
]
},
"raw": [
"server",
"start",
"-xvd",
"--port=80",
"--file=file.txt",
"--file",
"file.json"
],
"stdin": false,
"unparsed": [
"server",
"start"
]
}
var parse = require('cli-argparse');
var result = parse();
console.dir(result);
args
: Specific arguments to parse, default is process.argv.slice(2)
.options
: Parsing configuration options.Returns a result object.
alias
: Map of argument names to property names.flags
: Array of argument names to be treated as flags.options
: Array of argument names to be treated as options.Aliases are mapped on the raw argument name, to map -v | --verbose
to a verbose
property use {'-v --verbose': 'verbose'}
.
Use the flags array when you need to force a long argument to be treated as a
flag, for example ['--syntax-highlight']
.
Use the options array when you need to treat a short argument as accepting a
value, for example ['-f']
.
The result object contains the fields:
flags
: Object containing arguments treated as flags.options
: Object containing arguments treated as options with values.raw
: Array of the raw arguments parsed.stdin
: Boolean indicating whether -
is present in the argument list.unparsed
: Array of values that were not parsed.FAQs
Lightweight argument parser
The npm package cli-argparse receives a total of 137 weekly downloads. As such, cli-argparse popularity was classified as not popular.
We found that cli-argparse 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
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.