
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.
robotjs_addon
Advanced tools
· English · 中文
This project is forked from robot.js: https://robotjs.io/. The main purposes are as follows:
Use node-api to re-encapsulate the c++ interface. The original robot.js c++ package uses v8 api. Different node.js versions are not compatible. Switching node.js versions requires recompiling. Now using node-api, there is no such problem.
Need to solve the problem of typestring input being too slow The official library has been basically unmaintained since 2020. When I used version 0.6 of this library, I found that when using typestring, it takes a long time to input each character. Very poor experience.
Upgrade the dependent node-gyp version The node-gyp version used by the old robot.js is too low, and it also relies on python 2.7, a version that is no longer officially maintained. If the computer is in a python 3 environment, it will not compile.
It is convenient for bug checking and customization, and you can also learn the knowledge of node addon in sequence.
npm install robotjs_addon
const robot = require("robotjs_addon");
robot.typeString("Hello World");
robot.keyTap("enter");
export function setKeyboardDelay(ms: number): void
export function setMouseDelay(delay: number): void
export function getScreenSize(): { width: number; height: number }
export function updateScreenMetrics(): void
//keyboard
export function keyTap(key: string, modifier?: string | string[]): void
export function keyToggle(key: string, down: string, modifier?: string | string[]): void
export function typeString(string: string): void
//mouse
export function dragMouse(x: number, y: number): void
export function moveMouse(x: number, y: number): void
export function moveMouseSmooth(x: number, y: number, speed?: number): void
export function mouseClick(button?: MouseButton, double?: boolean): void
export function mouseToggle(down?: boolean, button?: MouseButton): void
export function scrollMouse(x: number, y: number): void
export function getMousePos(): { x: number; y: number }
This library has been pre-compiled for windows/linux/mac, and does not require a c++ compilation environment during installation.
npm install --build-from-source
npm run pack
Code using node-pre-gyp-github
This is just to explain, it has been integrated into github_action
go to Settings -> Developer settings
click Personal access tokens
click Generate new token
Select public_repo and repo_deployment
Generate Token
copy the key that's generated and set NODE_PRE_GYP_GITHUB_TOKEN environment variable to it. Within your command prompt:
SET NODE_PRE_GYP_GITHUB_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
After setting the environment variable NODE_PRE_GYP_GITHUB_TOKEN, you can publish it.
npm run release
Responsible for compiling node modules for each platform and uploading them to github release
Responsible for packaging npm package and uploading to npm registry
../node_modules/node-addon-api/napi-inl.h:2464:34: error: cannot bind non-const lvalue reference of type ‘Napi::CallbackInfo&’ to an rvalue of type ‘Napi::CallbackInfo’
The reason is
Napi::Object node_getMousePos(Napi::CallbackInfo &info)
The parameters should be added const
Napi::Object node_getMousePos(const Napi::CallbackInfo &info)
./src/mouse.c:12:10: fatal error: X11/extensions/XTest.h: No such file or directory
It says online that you need to install the library
ubuntu:
$ sudo apt-get install xorg-dev
centeros
$ sudo yum install xorg-x11\*
If you have any questions, you can raise an issue and we can make progress together.
FAQs
Node.js Desktop Automation.
The npm package robotjs_addon receives a total of 26 weekly downloads. As such, robotjs_addon popularity was classified as not popular.
We found that robotjs_addon demonstrated a not healthy version release cadence and project activity because the last version was released 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.

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.