
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Command-line interface to muxrpc servers. Works by converting the command-line parameters into args for the RPC calls. Also adds some standard behaviors for usage calls.
Parameters are parsed with minimist. The first positional param is mapped to the rpc command. Any subsequent positional params are passed as arguments. Then, the object constructed by the named parameters (if there are any) is passed as the last argument.
Examples:
$ program command arg1 arg2
invokes `server.command("arg1", "arg2")`
$ program command -a beep -b boop
invokes `server.command({ a: "beep", b: "boob" })'
$ program command arg1 arg2 -a beep -b boop
invokes `server.command("arg1", "arg2", { a: "beep", b: "boob" })'
$ program command -a beep -b boop arg1 arg2
invokes `server.command("arg1", "arg2", { a: "beep", b: "boob" })'
If a stream is supplied to stdin, it will be parsed as JSON and used instead of the CLI parameters.
$ echo '{"a":"beep","b":"boop"}' | program command
invokes `server.command({ a: "beep", b: "boob" })'
Usage-calls are the help which is output when a command fails, or when help is requested. They are used in the following situations:
TypeError
, UsageError
, BadParamError
, or BadArgError
, does a usage call for that command.-h
or --help
switches are given, does a toplevel or command usage call.A usage-call is a call to the usage(cmd)
function on the RPC server.
A 'top-level' usage call will leave cmd
falsey.
The usage
method should return a string to display.
var zerr = require('zerr')
var MissingArgError = zerr('BadArg', '"%" is required')
var BadTypeError = zerr('BadArg', '"%" must be a valid %')
var manifest = {
usage: 'sync',
whoami: 'sync',
ping: 'async'
}
var api = {}
// muxrpc(null, manifest)(api) is called
api.usage = function (cmd) {
switch (cmd) {
case 'whoami':
return 'whoami. get your profile info.'
case 'ping':
return 'ping {target} [-n times]. send `n` pings to `target`, defaults to 1'
}
return [
'myexample usage:'
' - ' + api.usage('whoami'),
' - ' + api.usage('ping')
].join('\n')
}
api.whoami = function() { return 'bob, obviously' }
api.ping = function(target, opts, cb) {
if (!target) return cb(MissingArgError('target'))
if (!isAddress(target)) return cb(BadTypeError('target', 'address'))
var n = 1
if (opts && opts.n) {
n = +opts.n
if (isNaN(n)) return cb(BadTypeError('n', 'number'))
}
// ...
}
Here's how a session would behave with this server:
$ myexample
myexample usage:
- whoami. get your profile info.
- ping {target} [-n times]. send `n` pings to `target. defaults to 1
$ myexample whoami -h
whoami. get your profile info.
$ myexample ping -h
ping {target} [-n times]. send `n` pings to `target. defaults to 1
$ myexample whoami
bob, obviously
$ myexample ping 127.0.0.1
...
$ myexample ping 1123123123
[BadArgError: "target" must be a valid address]
ping {target} [-n times]. send `n` pings to `target. defaults to 1
$ myexample ping 127.0.0.1 -n foobar
[BadArgError: "n" must be a valid number]
ping {target} [-n times]. send `n` pings to `target. defaults to 1
FAQs
command-line interface to mux rpc servers
The npm package muxrpcli receives a total of 201 weekly downloads. As such, muxrpcli popularity was classified as not popular.
We found that muxrpcli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 19 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.