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.
This library gives you bindings to ØMQ from node.js. This is not terribly well tested, but there is at least one company successfully using these bindings in production. Bug reports welcome.
First, get ØMQ 2.1, Homebrew on Mac will get you what you need.
Debian/Ubuntu users may also need to install the libev-dev
package.
Then use npm to install zeromq.node:
$ npm install zmq
npm
will yell at you if you don't have node 0.3.0, as that is required.
The API contains elements of the ØMQ API. You should refer to it for in depth detail of the expected behaviors of the system. These methods will never return error codes, but may throw an exception if any of the errors described in the ØMQ documentation occur.
First, include the module:
zmq = require('zmq');
After that, you can create sockets with:
socket = zmq.createSocket('req');
A socket is where the action happens. You can send and receive things and it is oh such fun.
function(type)
ZMQ_*
constants, sans the ZMQ_
prefix.connect(address) - Connect to another socket. address
should be a string
as described in the ØMQ API docs. This method is not
asynchronous because it is non-blocking. ØMQ will use the provided address
when it's necessary and will not block here.
bind(address, callback) - Bind to a socket to wait for incoming data.
address
should be a string as described in the ØMQ API docs.
callback
will be called when binding is complete and takes one argument,
which may be an Error
, or simply undefined
if everything's peachy.
send(message, ...) - message
is a string to send across the wire. The
message is not sent immediately, but there is no callback indicating when
it has been transmitted. Have your server ack or something if you care that
much.
The message must be a Buffer
object or a string. It is assumed that
strings should be transmitted as UTF-8. If you provide more than one
argument to send, then a multipart ØMQ message will be sent.
close() - Closes the socket
To set a socket option on a socket, use socket[property]. For example,
socket['identity'] = "mainLoop";
The following properties are available (the ZMQ_XXX constant describes the name in the ZeroMQ documentation available at ØMQ setsockopt API):
The following apply to message buffering and reconnection:
The following options are applicable to multicast:
The following properties are exposed but not normally used by client code (they are used internally by the library):
message - A message was received. The arguments are the parts of the
message. So, for example, if you have an xrep
socket with plain req
sockets on the other end, you can do something like:
socket.on('message', function(envelope, blank, data) {
socket.send(envelope, blank, compute_reply_for(data));
});
error - There was some error. The only argument is an Error
object
explaining what the error was.
$ node-waf configure build
Tests are pretty incomplete right now, but to run what's there:
$ npm install vows
$ vows
Licensed under the very permissive MIT License.
FAQs
Bindings for node.js and io.js to ZeroMQ
The npm package zmq receives a total of 2,947 weekly downloads. As such, zmq popularity was classified as popular.
We found that zmq demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.