{"id":20613996,"url":"https://github.com/evanpatchouli/device-interception-example","last_synced_at":"2025-03-06T18:42:38.642Z","repository":{"id":254392239,"uuid":"846388387","full_name":"Evanpatchouli/device-interception-example","owner":"Evanpatchouli","description":"An example Node.js application to capture keyboard and mouse strokes.","archived":false,"fork":false,"pushed_at":"2024-09-04T13:05:21.000Z","size":2321,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-17T04:09:54.089Z","etag":null,"topics":["cs2","hack","interception","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Evanpatchouli.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-23T05:22:33.000Z","updated_at":"2024-09-04T13:05:25.000Z","dependencies_parsed_at":"2024-11-16T11:11:43.335Z","dependency_job_id":"4a73c246-1bbf-4689-9f62-545af2070464","html_url":"https://github.com/Evanpatchouli/device-interception-example","commit_stats":null,"previous_names":["evanpatchouli/device-interception-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Evanpatchouli%2Fdevice-interception-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Evanpatchouli%2Fdevice-interception-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Evanpatchouli%2Fdevice-interception-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Evanpatchouli%2Fdevice-interception-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Evanpatchouli","download_url":"https://codeload.github.com/Evanpatchouli/device-interception-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242268636,"owners_count":20100067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cs2","hack","interception","nodejs"],"created_at":"2024-11-16T11:11:37.327Z","updated_at":"2025-03-06T18:42:38.615Z","avatar_url":"https://github.com/Evanpatchouli.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Device Interception Example\n\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"#\"\u003e\u003cimg alt=\"github\" src=\"https://img.shields.io/badge/Github-grey.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"#\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/badge/license-LGPL3-green.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"#\"\u003e\u003cimg alt=\"platform\" src=\"https://img.shields.io/badge/os-windows_11-blue.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"#\"\u003e\u003cimg alt=\"NodeJS\" src=\"https://img.shields.io/badge/NodeJS-16+-green.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"#\"\u003e\u003cimg alt=\"CS:GO\" src=\"https://img.shields.io/badge/CS:GO-black.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nAn example Node.js application to capture keyboard and mouse strokes on **windows**.\n\n## Disclaimer\n\n\u003cfont color=\"red\"\u003eWarn! This project is for learning and communication purposes only, and if it is used in the game, you may be banned by VAC! We are not responsible if you are banned for this\u003c/font\u003e\n\n### Installing the driver\n\nUsing a command prompt with **Administrative Privileges**:\n\n```cmd\nnpm run install:driver\n```\n\n\u003e You can uninstall it later using `npm run uninstall:driver` instead.\n\nYou'll need to **restart** for the driver installation to be complete.\n\n## Example Usage\n\nIn example codes below, stop-automatic and some throw-actions in _Counter-Strike 2_ are applied, and `J` is set to toggle whether or not to enable the automatic-emergency-stop hack. `F7` is set to trigger the jump-throw action.\n\nYou can execuate `npm run start:node` or `npm run start:bun` to run `index.js` with **node** or **bun**.\n\n```javascript\nfunction main() {\n  logger.info(\"Press any key or move the mouse to generate strokes.\");\n  logger.info(`Press ${chalk.blueBright(\"ESC\")} to exit and restore back control.`);\n  logger.info(\"【F7】跳投\");\n  logger.info(\"【F8】右键跳投\");\n  logger.info(\"【F9】前跳投\");\n  logger.info(\"【F10】双键跳投\");\n  logger.info(\"【F11】前双键跳投\");\n  logger.info(\"【F12】Mirage VIP 慢烟\");\n\n  state.SET_JITING(true);\n  state.SET_USE_JT_DURATION_CALC(true);\n  logger.info(`${chalk.yellow(\"Stop Emergency\")} is ${chalk.yellow(!state.useJiting ? \"disabled\" : \"enabled\")}`);\n\n  core\n    .listen(\"keyboard\", {\n      after: async (stroke, input, baseKey, device) =\u003e {\n        concurrentify(\n          // Add your side-effect handler below  往下添加附作用事件\n          jiting(stroke, input, \"J\"), // automatic-emergency-stop  jiting(stroke, input, \"J\", \"K\"), set the fourth parameter to switch the duration key.\n          jumpThrow(stroke, input, \"F7\"), // jump + attack1\n          jumpThrow2(stroke, input, \"F8\"), // jump + attack2\n          forwardJumpThrow(stroke, input, \"F9\"), // forward + jump + attack1\n          jumpDoubleThrow(stroke, input, \"F10\"), // jump + attack1 + attack2\n          forwardJumpDoubleThrow(stroke, input, \"F11\"), // forward + jump + attack1 + attack2\n          rightJumpThrow(stroke, input, \"F12\") // right + wait(200) + jump + attack1\n        );\n      },\n    })\n    .catch((error) =\u003e logger.error(error));\n}\n```\n\n## Run with PM2\n\nYou can use `pm2` to keep running the script in the background.\n\nI have provided a two pm2 configuration files at the pm2 directory. Before using it, you need to install `pm2` globally:\n\n```shell\nnpm install -g pm2\n```\n\nAnd modify these files to fit your environment. Mainly, you need to update thehe premeters:\n\n- `cwd`: the root directory to execute the script\n- `interpreter`: the interpreter of the script, such as the absolute path of `bun.exe`\n- `out_file`: the path of the output file, could be absolute or relative (cwd)\n- `error_file`: the path of the error file, could be absolute or relative (cwd)\n- `env`: if you need to set some environment variables\n\nThen you can run the script with pm2 just like:\n\n```shell\n# my project path is at D:\\Work\\device-interception-example\npm2 start ./pm2/serve.json\n```\n\nBy this way, the server is running in the background, and i can use web monitor to manage it.\n\n## Exception\n\nIf you encounter the following error:\n\n- script is running, but hack is not working, maybe the device used is not the one actually used in the game.\n  - You can check the device by `console.log(device)` in the handler to know which device in devices is used.\n- script is running as well as hack, but the output action is not as expected, maybe the key-binding at your machine is different from the example codes.\n  - You can run the `check.js` to check the key-binding, and update the `key_codes` and `mouse_codes` in `core` yourself.\n- script is terminated, maybe it is killed by the anti-hack system of the game.\n  - For this case, you'd better not to run this script in the game. Because it may cause you to be banned by the game.\n\n## Credits\n\n- [Oblitum] for creating the original interception library.\n- [Rami Sabbagh] for the wrapper library `node-interception`.\n- [Evanpatchouli] for creating this project.\n\n[GitHub]: https://github.com/Evanpatchouli/device-interception-example\n[Driver]: https://github.com/oblitum/Interception\n[Oblitum]: https://github.com/oblitum\n[node-interception]: https://github.com/Rami-Sabbagh/node-interception\n[Rami Sabbagh]: https://github.com/Rami-Sabbagh\n[Evanpatchouli]: https://github.com/Evanpatchouli\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevanpatchouli%2Fdevice-interception-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevanpatchouli%2Fdevice-interception-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevanpatchouli%2Fdevice-interception-example/lists"}