Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
simple utilities for open sound control in node.js
This package provides some node.js utilities for working with
OSC, a format for sound and systems control.
Here we implement the OSC 1.1 specification. OSC is a transport-independent
protocol, so we don't provide any server objects, as you should be able to
use OSC over any transport you like. The most common is probably udp, but tcp
is not unheard of.
The easiest way to get osc-min is through NPM. After install npm, you can install osc-min in the current directory with
npm install osc-min
If you'd rather get osc-min through github (for example, if you're forking it), you still need npm to install dependencies, which you can do with
npm install --dev
Once you've got all the dependencies you should be able to run the unit tests with
npm test
npm run-script coverage
sock = udp.createSocket "udp4", (msg, rinfo) ->
try
console.log osc.fromBuffer msg
catch error
console.log "invalid OSC packet"
sock.bind inport
sendHeartbeat = () ->
buf = osc.toBuffer(
address : "/heartbeat"
arguments : [
12
"sttttring"
new Buffer "beat"
{type : "integer", value : 7}
]
)
udp.send buf, 0, buf.length, outport, "localhost"
setInterval sendHeartbeat, 2000
sock = udp.createSocket "udp4", (msg, rinfo) ->
try
redirected = osc.applyAddressTransform msg, (address) -> "/redirect" + address
sock.send(
redirected,
0,
redirected.length,
outport,
"localhost"
)
catch error
console.log "error redirecting: " + error
sock.bind inport
more examples are available in the examples/
directory.
takes a node.js Buffer of a complete OSC Packet and outputs the javascript representation, or throws if the buffer is ill-formed.
strict
is an optional parameter that makes the function fail more often.
takes a OSC packet javascript representation as defined below and returns a node.js Buffer, or throws if the representation is ill-formed.
alternative syntax for above. Assumes this is an OSC Message as defined below,
and arguments
is an array of OSC Arguments or single OSC Argument
takes a callback that takes a string and outputs a string, and applies that to the address of the message encoded in the buffer, and outputs an encoded buffer.
If the buffer encodes an OSC Bundle, this applies the function to each address in the bundle.
There's two subtle reasons you'd want to use this function rather than
composing fromBuffer
and toBuffer
:
fromBuffer
will throw. The only time
when applyAddressTranform
might fail is if the address is malformed.takes a function that takes and returns a javascript OSC Message representation, and applies that to each message encoded in the buffer, and outputs a new buffer with the new address.
If the buffer encodes an osc-bundle, this applies the function to each message in the bundle.
See notes above for applyAddressTransform for why you might want to use this. While this does parse and re-pack the messages, the bundle timetags are left in their accurate and prestine state.
See the spec for more information on the OSC types.
An OSC Packet is an OSC Message or an OSC Bundle.
An OSC Message:
{
oscType : "message"
address : "/address/pattern/might/have/wildcards"
arguments : [arg1,arg2]
}
Where arguments is an array of OSC Arguments. oscType
is optional.
arguments
can be a single element.
An OSC Argument is represented as a javascript object with the following layout:
{
type : "string"
value : "value"
}
Where the type
is one of the following:
string
- string valuefloat
- numeric valueinteger
- numeric valueblob
- node.js Buffer valuetrue
- value is boolean truefalse
- value is boolean falsenull
- no valuebang
- no value (this is the I
type tag)timetag
- numeric valueNote that type
is always a string - i.e. "true"
rather than true
.
The following non-standard types are also supported:
double
- numeric value (encodes to a float64 value)
For messages sent to the toBuffer
function, type
is optional.
If the argument is not an object, it will be interpreted as either
string
, float
, or blob
, depending on its javascript type.
An OSC Bundle is represented as a javascript object with the following layout
{
oscType : "bundle"
timetag : 7
elements : [element1, element]
}
Where the timetag is a javascript-native numeric value of the timetag,
and elements is an array of either an OSC Bundle or an OSC Message
The oscType
field is optional, but is always returned by api functions.
FAQs
Simple utilities for open sound control in node.js
The npm package osc-min receives a total of 337 weekly downloads. As such, osc-min popularity was classified as not popular.
We found that osc-min demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.