
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
A nodejs lib for controlling a tosr0x board via USB port.
npm i tosr0x --save
This current project only contains an API. End users might want to try those projects in order to directly control the board with nodejs without having to code anything.
Usage is pretty strait forward: You either create a Tosr0x
instance or request one.
var Tosr0x = require('tosr0x').Tosr0x;
// when you know the usb port uri
var board = new Tosr0x(uri);
// when you do not know it
Tosr0x.fromPortScan().then(function (board) {});
// when you get input from a random variable that might be empty
// hit: this ALWAYS returns a Promise :)
Tosr0x.create(uri).then(function (board) {});
The api is 99% built on promises but most methods also accepts callbacks. Callbacks should respect the node convention and always have this signature:
function callback(err, returnValue) { ... }
The promise implementation currently used is rsvp.js. This document assume your are familiar with thenable operations in Promise/A+.
Resolving promises always get back the current instance of Tosr0x
. If there is a return value, a hash containing both is pass onto the resolver function.
Optional parameters are inclosed [in brackets]
The Tosr0x
constructor. Initialises the Tosr0x
object.
Tosr0x
object.These are the method you call directly on the Tosr0x
object.
Scans all serial ports and try to find a match, according to the device parameter.
Tosr0x
object.Wraps Tosr0x.fromPortScan()
and new Tosr0x()
into a single operation that always returns a Promise
. Also uses the default device fingerprint.
Tosr0x
object.These are the members you can access directly on the Tosr0x
object.
Default values for the options parameter.
{
// serial port specific
baudRate: 9600,
dataBits: 8,
parity: 'none',
stopBits: 1,
flowControl: false,
// Tosr0x specific
debug: false, // outputs usefull things in stdout
relayCount: 2, // may be 4 or 8
timeout: 1500 // in ms
};
Note: serial port specific options should not be change unless you know what your are doing.
Default values for device fingerprinting. This should not need to change as they sould remain constant across all boards.
{
// serial port specific, usign FTDI values
vendorId: '0x0403',
productId: '0x6001',
// Tosr0x specific
moduleId: 15 // used for version command
};
Default values for Tosr0x
binary commands. Note that string values are ASCII chars and integer values are bytes. This should not neet to change and are here for reference only. Please use them in your code (Tosr0x.commands.X
) when sending commands.
{
version : 'Z',
states : '[',
voltage : ']',
temperature: 'b',
on : 100,
off : 110
};
These are the methods you call on the instance of Tosr0x
you get by calling new
or any of the factory methods.
Opens the communication channel with the serial port. This operation is required before attemping to send any commands to the board.
Getter for the connected state of the instance. Returns true if the communication channel is open, false otherwise.
Getter for the current options values are.
Getter for the internal state representation of a relay. If the relay parameter is undefined, all states are returned.
Closes the communication channel with the serial port and releases any resources held.
Closes the communication channel with the serial port and releases any resources held without waiting for the response of the board.
Send immediately the value specified as a cmd. May be a valid ASCII char or bytes.
This method is primarly a internal function (this is why it does not returns a Promise
). It should only be used to get notified when a read event occurs.
Send a command to put the realy into the on position.
Alias for .send(Tosr0x.commands.on/off + relay, callback);
Send the command to switch the relay to on.
Alias for .switch(relay, true, callback);
Send the command to switch the relay to off.
Alias for .switch(relay, false, callback);
Send the command to switch toggle the relay, i.e., invert the current state. Note make sure that the internal state representation is up to date with the state of the board. Try calling .states().then(function () { .toggle() }) instead.
Send the command to get the current state of all the relays on the board. The return value is a hash object in the form {'1': true, '2': false}, true meaning that the relay is on.
Old name of .states();
Send the command to get the current version of the embedded software.
Send the command to get the current voltage powering the board. Should be 5 Volts.
Send the command to get the current temperature mesure with the external temperature probe (not included in the board). This method will always timeout if the probe is not present.
Made with love in Montréal by https://deuxhuithuit.com
Licensed under the MIT License: http://deuxhuithuit.mit-license.org
We are not affiliate with any sort with the usb boards manifacturer or reseller. Please refer to the license of the projet and the licenses emitted by the board manufacturer for all information.
FAQs
A nodejs lib for controlling a tosr0x board via USB port
The npm package tosr0x receives a total of 0 weekly downloads. As such, tosr0x popularity was classified as not popular.
We found that tosr0x demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.