#electron #inject #debugging #js #command-line-tool

bin+lib electron-injector

electron-injector is an open source command-line tool written in Rust that enables you to inject JavaScript code into Electron apps at runtime. It is inspired by the Python project electron-inject and offers similar functionality.

3 stable releases

1.0.2 Jul 29, 2023
1.0.1 Mar 19, 2023
1.0.0 Mar 18, 2023

#13 in #electron

MIT/Apache

22KB
310 lines

electron-injector

electron-injector is an open source command-line tool written in Rust that enables you to inject JavaScript code into Electron apps at runtime. It is inspired by the Python project electron-inject and offers similar functionality.

Getting Started

Installation

You can download pre-compiled binaries from the releases page and add the binary to your PATH environment variable.

Alternatively, you can install electron-injector using Cargo, Rust's package manager.

$ cargo install electron-injector

Usage

To use electron-injector, simply specify the path to the Electron app and the JavaScript file that you want to inject.

$ electron-injector --script=/path/to/script.js /path/to/electron/app

Options

-a, --arg <ARG>          Additional arg for the electron app
-s, --script <SCRIPT>    Path to the javascript file to be injected    
    --host <HOST>        The remote debugging host [default: 127.0.0.1]
-p, --port <PORT>        The remote debugging port [default: 8315]     
-t, --timeout <TIMEOUT>  Timeout in ms for injecting scripts [default: 10000]
-d, --delay <DELAY>      Delay in ms to wait after spawning the process [default: 10000]
    --prelude            Inject prelude script
-h, --help               Print help
-V, --version            Print version

Contributing

We welcome contributions from the community. To contribute to electron-injector, please follow these steps:

Fork the repository

  1. Create a new branch for your changes
  2. Make your changes and commit them
  3. Push your changes to your forked repository
  4. Submit a pull request
  5. Please ensure that your code adheres to the Rust coding style guidelines and is properly formatted using rustfmt.

License

electron-injector is dual licensed under the MIT License and Apache-2.0 License. See the LICENSE-MIT and LICENSE-APACHE-2.0 files for more information.

Dependencies

~10–23MB
~321K SLoC