
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Tiny module for buffering and redirecting console methods.
$ npm install concap --save
var concap = require('concap');
console.log('1');
concap.hijack();
console.log('3'); // `3` captured here
concap.restore();
console.log('2');
concap.flush(); // and flushed here
will output:
1
2
3
warn callvar concap = require('concap');
concap.hijack();
console.warn('buffered', /output/, function sir(){});
concap.restore();
var calls = concap.getClean();
console.log(calls);
console.log(concap.render(calls));
will show:
[ { method: 'warn', args: [ 'buffered', /output/, function sir(){} ] } ]
console.warn("buffered", /output/, function sir(){});
It is also possible to make console instance to use it locally:
var concap = require('concap');
var local = new concap.Console();
var calls = [];
local.on('data', e => calls.push(e));
local.warn('today is:', new Date());
console.log(concap.render(calls, { object: 'this.cons' }));
will generate:
this.cons.warn("today is:", new Date(1452619284325));
var concap = require('./');
var res = concap.capture(() => template.apply({
head: '<link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico">',
body: `<p>This is just an example of parkur ninja style.</p>
<p>Please don't repeat this by yourself: it's dangerous!</p>`
}));
console.log(inject(res, `<script>\n${concap.render(concap.getClean())}\n</script>`));
function template() {
console.warn('Wake up! You using deprecated template!');
return `<html>
<head>${this.head||''}</head>
<body>${this.body||''}</body>
</html>`;
}
function inject(html, log) {
return html.replace(/(<\/body>\s*)?(<\/html>\s*)?$/, m => log + m);
}
<html>
<head><link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico"></head>
<body><p>This is just an example of parkur ninja style.</p>
<p>Please don't repeat this by yourself: it's dangerous!</p><script>
console.warn("Wake up! You using deprecated template!");
</script></body>
</html>
MIT
FAQs
Tiny console capturing library
We found that concap 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.