
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A high-performance, cross-platform global keyboard event listener for Node.js, written in Rust.
A high-performance, cross-platform global keyboard event listener for Node.js, written in Rust.
rustcatch allows your Node.js application to listen for keyboard events from any application across the entire operating system, not just the focused terminal window. It's ideal for creating system-wide hotkeys, shortcuts, or capturing input from devices that emulate a keyboard, like a USB barcode scanner.
rustcatch?This module uses a pre-compiled binary approach. When you install rustcatch via npm, it downloads a .node file that is already compiled for your operating system and architecture. This means you don't need Rust, C++ compilers, or any other build tools to use this package in your project.
| OS | Supported | Notes for Users |
|---|---|---|
| Windows | ✅ | Works out of the box. |
| macOS | (TBD) | Requires Accessibility permissions for the terminal/app in settings. |
| Linux (X11) | (TBD) | Requires libxdo-dev, libxtst-dev, and other X11 development libs. |
npm install rustcatch
The package will automatically download the correct pre-built binary for your system.
Here is a simple example of how to use rustcatch to log key presses.
const rustcatch = require('rustcatch');
console.log('Starting global listener... Press any key.');
console.log('This script will be kept alive by a timer. Press Ctrl+C to exit.');
// Add a listener for the 'keydown' event
rustcatch.on('keydown', (event) => {
console.log('Key Down:', event);
// Example event: { type: 'keydown', key: 'KeyA' }
});
// Add a listener for the 'keyup' event
rustcatch.on('keyup', (event) => {
console.log('Key Up: ', event);
// Example event: { type: 'keyup', key: 'KeyA' }
});
// Start the global listener
try {
rustcatch.start();
console.log('Global listener started successfully.');
} catch (error) {
console.error('Failed to start listener:', error);
process.exit(1);
}
// See the "Important Note on Usage" below
setInterval(() => {}, 1000 * 60 * 60);
process.on('SIGINT', () => {
if (rustcatch.isRunning) {
rustcatch.stop();
console.log('\nGlobal listener stopped.');
}
process.exit(0);
});
Because rustcatch runs its core logic in a separate background thread, the main Node.js process might not see any pending tasks and exit immediately after starting.
To prevent this, you must keep the Node.js event loop busy. You can do this by:
setInterval as shown in the example above to keep the process alive indefinitely.The rustcatch module is an instance of EventEmitter.
rustcatch.start()Starts the global keyboard listener. It will begin emitting keydown and keyup events. Throws an error if the listener cannot be started.
rustcatch.stop()Stops the global keyboard listener. No more events will be emitted.
rustcatch.isRunningboolean (Read-only)true if the listener is currently active, otherwise false.true immediately after calling start().on('keydown', callback)callback(event): The event object.
event.type: 'keydown'event.key: A string representation of the key (e.g., 'KeyA', 'Space', 'Num1', 'Return').on('keyup', callback)callback(event): The event object.
event.type: 'keyup'event.key: A string representation of the key.If you want to contribute to the project or build the binaries for your own system, you'll need to compile the Rust source code.
build-essential and libxdo-dev libxtst-dev.git clone https://github.com/Xzdes/rustcatch.git
cd rustcatch
cargo-cp-artifact.
npm install
.node file to the correct location (build/Release/addon.node).
npm run build
npm test
Contributions are welcome! Please feel free to open an issue to discuss a bug or feature, or submit a pull request with your changes.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A high-performance, cross-platform global keyboard event listener for Node.js, written in Rust.
The npm package rustcatch receives a total of 2 weekly downloads. As such, rustcatch popularity was classified as not popular.
We found that rustcatch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.