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.
Further examples available in the examples
folder.
const sock = udp.createSocket("udp4", (msg) => {
try {
console.log(osc.fromBuffer(msg));
} catch (e) {
console.log("invalid OSC packet", e);
}
});
sock.bind(inport);
const sendHeartbeat = () => {
const buf = toBuffer({
address: "/heartbeat",
args: [
12,
"sttttring",
new TextEncoder().encode("beat"),
{
type: "integer",
value: 7,
},
],
});
return udp.send(buf, 0, buf.byteLength, outport, "localhost");
};
setInterval(sendHeartbeat, 2000);
const sock = dgram.createSocket("udp4", (msg) => {
try {
const redirected = osc.applyAddressTransform(
msg,
(address) => `/redirect${address}`
);
return sock.send(
redirected,
0,
redirected.byteLength,
outport,
"localhost"
);
} catch (e) {
return console.log(`error redirecting: ${e}`);
}
});
sock.bind(inport);
See the [spec][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"
args : [arg1,arg2]
}
Where args is an array of OSC Arguments. oscType
is optional.
args
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 valuecolor
- JS object containing red
, green
, blue
, alpha
in range 0-255midi
- four-element array of numbers representing a midi packet of datasymbol
- string valuecharacter
- a single-character stringdouble
- numeric valuebigint
- 64-bit bigint
value (watch out, this will be truncated to 64 bits!)blob
- ArrayBuffer
, DataView
, TypedArray
or node.js Buffer
true
- value is boolean truefalse
- value is boolean falsenull
- no valuebang
- no value (this is the I
type tag)timetag
- Javascript Date
array
- array of OSC ArgumentsNote 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
, array
or blob
, depending on its javascript type
(String, Number, Array, Buffer, respectively)
An OSC Bundle is represented as a javascript object with the following fields:
{
oscType : "bundle"
timetag : 7
elements : [element1, element]
}
oscType
"bundle"
timetag
is one of:
Date
- a JavaScript Date objectArray
- [numberOfSecondsSince1900, fractionalSeconds]
Both values are number
s. This gives full timing accuracy of 1/(2^32) seconds.elements
is an Array
of either OSC Message or OSC Bundle
There have been a few breaking changes from the 1.0 version:
Buffer
now return DataView
Date
s or [number, number]
arrays, and are always returned as [number, number]
arrays. To convert between arrays and Date
s, use dateToTimetag
and timetagToDate
.toBuffer
has been removed.Licensed under the terms found in COPYING (zlib license)
FAQs
Simple utilities for open sound control in node.js
The npm package osc-min receives a total of 652 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.