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.
events-broadcast
Advanced tools
events-broadcast leverages events to broadcast singly, in combination, or to all selected events.
npm i events-broadcast
var eb = require("events-broadcast"),
* to test local functionality: npm run local_test
* mocha test: npm test
"use strict"
/*
* @author Jim Manton: jrman@risebroadband.net
* @since 2019-04-24
* test application
*/
var colors = require('colors'),
log4js = require("log4js"),
log4js_tagline = require("log4js-tagline"),
events_broadcast = require('./app.js'),
tagline,
logger,
append,
lne
log4js.configure({
appenders: { myLog: { type: 'file', filename: 'my.log' } },
categories: { default: { appenders: ['myLog'], level: 'debug' } }
})
tagline = new log4js_tagline(log4js, {
"display": ["trace", "debug", "info", "warn", "error", "fatal", "mark"],
"output": {
"to_local_file": true,
"to_datadog": true
}
})
logger = log4js.getLogger('myLog')
append = tagline.appender('line')
lne = new append(tagline).setConfig({ "format": "lne(@name(): @file:@line:@column)" })
logger.debug('start of test').tag(lne).tagline()
var eb = new events_broadcast()
.set({ "group": { "name": "group-1", "events": [{ "event": "refresh", "id": 1 }, { "event": "two", "id": 2 }] } })
.set({ "group": { "name": "group-2", "events": [{ "event": "one", "id": 1 }, { "event": "two", "id": 2 }, { "event": "refresh", "id": 3 }] } })
.set({ "group": { "name": "group-3", "events": [{ "event": "refresh", "id": 1 }] } })
.error(function (errorArray) {
errorArray.forEach(function (item) {
logger.error(item).tag(lne).tagline()
})
}).success(function (data) {
logger.info(data).tag(lne).tagline()
})
.on({ "groups": "all", "events": "all" }, function (data) {
var d = JSON.stringify(data)
logger.info(d).tag(lne).tagline()
})
/*
.on({ "groups": "all", "events": "refresh" }, function (data) {
var d = JSON.stringify(data)
logger.info(d).tag(lne).tagline()
})
.on({ "groups": "all", "events": "one" }, function (data) {
var d = JSON.stringify(data)
logger.info(d).tag(lne).tagline()
})
.on({ "groups": "all", "events": "two" }, function (data) {
var d = JSON.stringify(data)
logger.info(d).tag(lne).tagline()
})
.on({ "groups": "group-2", "events": "one" }, function (data) {
var d = JSON.stringify(data)
logger.info(d).tag(lne).tagline()
})
.on({ "groups": "group-2", "events": "refresh" }, function (data) {
var d = JSON.stringify(data)
logger.info(d).tag(lne).tagline()
})
.on({ "groups": "group-1", "events": "refresh" }, function (data) {
var d = JSON.stringify(data)
logger.info(d).tag(lne).tagline()
})
.on({ "groups": "all", "events": "all" }, function (data) {
var d = JSON.stringify(data)
logger.info(d).tag(lne).tagline()
})
.on({ "groups": ["group-1", "group-2"], "events": ["one", "refresh"] }, function (data) {
var d = "This is ONE, REFRESH processing(" + JSON.stringify(data) + ")"
logger.info(d).tag(lne).tagline()
})
*/
.do({ "groups": "all", "emit": ["refresh"] })
//.do({ "groups": "all", "emit": "all" })
//.do({ "groups": ["group-1", "group-2"], "emit": ["one", "refresh"] })
.do({ "groups": "all", "emit": ["one", "two"] })
//.do({ "groups": "["group-1", "group-2"]", "emit": ["one", "refresh"] })
.do({ "groups": ["group-2"], "emit": ["two"] })
.done()
[2019-05-09T17:21:11.289] [debug] myLog - (msg: start of test) lne((): events-broadcast/test.js:36:8) [2019-05-09T17:21:11.316] [info] myLog - (msg: {"name":"group-1","event":{"event":"refresh","id":1}}) lne(callback(): events-broadcast/test.js:51:16) [2019-05-09T17:21:11.317] [info] myLog - (msg: {"name":"group-2","event":{"event":"refresh","id":3}}) lne(callback(): events-broadcast/test.js:51:16) [2019-05-09T17:21:11.319] [info] myLog - (msg: {"name":"group-3","event":{"event":"refresh","id":1}}) lne(callback(): events-broadcast/test.js:51:16) [2019-05-09T17:21:11.321] [info] myLog - (msg: {"name":"group-1","event":{"event":"two","id":2}}) lne(callback(): events-broadcast/test.js:51:16) [2019-05-09T17:21:11.323] [info] myLog - (msg: {"name":"group-2","event":{"event":"one","id":1}}) lne(callback(): events-broadcast/test.js:51:16) [2019-05-09T17:21:11.327] [info] myLog - (msg: {"name":"group-2","event":{"event":"two","id":2}}) lne(callback(): events-broadcast/test.js:51:16) [2019-05-09T17:21:11.330] [info] myLog - (msg: {"name":"group-2","event":{"event":"two","id":2}}) lne(callback(): events-broadcast/test.js:51:16) [2019-05-09T17:21:11.331] [info] myLog - (msg: success done) lne(success_callback(): events-broadcast/test.js:47:16)
FAQs
broadcast events
The npm package events-broadcast receives a total of 1 weekly downloads. As such, events-broadcast popularity was classified as not popular.
We found that events-broadcast demonstrated a healthy version release cadence and project activity because the last version was released less than 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.