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.
executioner
Advanced tools
Executes provided shell commands with supplied arguments. Supports parallel and templated commands
Executes provided shell commands with supplied arguments. Supports parallel and templated commands.
Notice of change of ownership: Starting version 1.0.0 this package has changed it's owner and goals. Old version (0.0.1) is still available on npm via npm install executioner@0.0.1
. Thank you.
npm install --save executioner
var executioner = require('executioner');
Simple command:
executioner('echo A', {}, function(err, result)
{
assert.equal(result, 'A');
});
Combined command:
executioner(['echo A', 'echo B', 'echo C'], {}, function(err, result)
{
assert.deepEqual(result, ['A', 'B', 'C']);
});
Parameterized command:
executioner(['echo A-${abc}', 'echo B-${abc}', 'echo C-${xyz}', 'echo D-${xyz}'], {abc: '123', xyz: '789'}, function(err, result)
{
assert.deepEqual(result, ['A-123', 'B-123', 'C-789', 'D-789']);
});
Named list of commands:
executioner({'Letter A': 'echo A', 'Letter B': 'echo B', 'Letter C': 'echo C'}, {}, function(err, result)
{
assert.deepEqual(result, ['Letter A: A', 'Letter B: B', 'Letter C: C']);
});
Prefixed commands:
executioner(['A', 'B', 'C'], {}, {cmdPrefix: 'echo prefixed'}, function(err, result)
{
assert.deepEqual(result, ['prefixed A', 'prefixed B', 'prefixed C']);
});
Non-string parameters:
executioner(['echo A:${ok}:', 'echo B:${no}:', 'echo C:${nay}:', 'echo D:${never}:'], {ok: true, no: false, nay: null, never: undefined}, function(err, result)
{
assert.deepEqual(result, ['A:1:', 'B::', 'C::', 'D::']);
});
Error messaging:
executioner('echo ABC && echo XYZ 1>&2 && false', {}, function(err, result)
{
assert.equal(err.message, 'Command failed: echo ABC && echo XYZ 1>&2 && false\nXYZ');
assert.equal(err.stdout, 'ABC');
assert.equal(err.stderr, 'XYZ');
assert.equal(result, undefined);
});
Job termination:
var job = executioner('echo ABC; sleep 5; echo XYZ', {}, function(err, result)
{
assert.ok(err.terminated);
// Partial output
assert.equal(result, 'ABC');
});
setTimeout(function()
{
executioner.terminate(job);
}, 100);
For more examples check out tests/tests.json
.
Executioner is released under the MIT license.
FAQs
Executes provided shell commands with supplied arguments. Supports parallel and templated commands
The npm package executioner receives a total of 40,287 weekly downloads. As such, executioner popularity was classified as popular.
We found that executioner 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.