
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.
limit-spawn
Advanced tools
Kills a child process created with spawn after X bytes are sent and emits an event.
npm install limit-spawn
This is a soft limit, meaning that after more than MAX data is received the process is closed and the 'max-limit-exceeded' is emitted. So this implies that you can receive more data than the limit (depending on the last chunk).
var spawn = require('child_process').spawn,
limit = require('../index'),
assert = require('assert'),
child, ps, bytesReceived, MAX_LIMIT;
MAX_LIMIT = 100 * 1024; // 100 Kb
child = spawn('node', ['forever-output.js'], {
cwd: __dirname
});
limit(child, MAX_LIMIT);
bytesReceived = 0;
child.stdout.on('data', function(data) {
bytesReceived += data.length;
});
child.stderr.pipe(process.stderr);
child.on('max-limit-exceeded', function(size) {
console.log('limit exceeded: ' + parseInt(size / 1024, 10) + ' Kb sent');
});
// shortly after the 'max-limit-exceeded' event is emitted the child dies
child.on('close', function(code) {
console.log('child process exited');
});
npm test
MIT
FAQs
Kills a child process created with spawn after X bytes are sent
The npm package limit-spawn receives a total of 20,673 weekly downloads. As such, limit-spawn popularity was classified as popular.
We found that limit-spawn 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
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.