Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tintinweb/electron-inject
Inject javascript into closed source electron applications e.g. to enable developer tools for debugging.
https://github.com/tintinweb/electron-inject
debugging-tool electron electron-app
Last synced: 5 days ago
JSON representation
Inject javascript into closed source electron applications e.g. to enable developer tools for debugging.
- Host: GitHub
- URL: https://github.com/tintinweb/electron-inject
- Owner: tintinweb
- Created: 2017-03-27T18:49:40.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-09-22T17:48:20.000Z (about 1 year ago)
- Last Synced: 2024-10-22T19:48:22.350Z (12 days ago)
- Topics: debugging-tool, electron, electron-app
- Language: Python
- Homepage:
- Size: 22.5 KB
- Stars: 332
- Watchers: 9
- Forks: 37
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- stars - tintinweb/electron-inject - Inject javascript into closed source electron applications e.g. to enable developer tools for debugging. (Python)
README
# 💉 electron-inject
You find yourself locked out of closed source electron applications with no easy way to enable developer tools? ↷ *electron-inject* is here to help 👲
*electron-inject* is an application wrapper that utilizes the remote debug console to inject javascript code into electron based applications. For example, this can be pretty handy to enable otherwise unavailable features like the built-in developer console.
![slack](https://cloud.githubusercontent.com/assets/2865694/24376228/70b2c2b0-133b-11e7-893c-c7a0ad262343.gif)
# install
$ pip install electron-inject
or$ python setup.py install
# usage$ python -m electron_inject --help
Usage:
usage:
electron_inject [options] -example:
electron_inject --enable-devtools-hotkeys - /path/to/electron/powered/application [--app-params app-args]Options:
-h, --help show this help message and exit
-d, --enable-devtools-hotkeys
Enable Hotkeys F12 (Toggle Developer Tools) and F5
(Refresh) [default: False]
-b, --browser Launch Devtools in default browser. [default: False]
-t TIMEOUT, --timeout=TIMEOUT
Try hard to inject for the time specified [default:
none]
-r RENDER_SCRIPTS, --render-script=RENDER_SCRIPTS
Add a script to be injected into each window (render
thread)# Showcase
Inject hotkeys *F12:toggle devconsole* and *F5:reload* into closed source apps with devconsole disabled.
`--enable-devtools-hotkeys` .. enable developer hotkeys
`--timeout=xx` .. patch all known remote webContent/windows in a timeframe of `xx` seconds. set this to an arbitrary high value to make sure we're patching all future windows.`$ python -m electron_inject -d -t 60 - \\PATH\TO\Local\WhatsApp\app-0.2.2244\WhatsApp.exe`
![whatsapp gif](https://cloud.githubusercontent.com/assets/2865694/24376256/81d44e88-133b-11e7-961f-060e7b8201ed.gif)
If this gives you an error try launching it with the alternative browser method:
`$ python -m electron_inject --browser - \PATH\TO\Local\WhatsApp\app-0.2.2244\WhatsApp.exe`
## slack
`$ python -m electron_inject -d -t 60 - \\PATH\TO\Local\slack\app-2.5.2\slack.exe`
![slack](https://cloud.githubusercontent.com/assets/2865694/24376228/70b2c2b0-133b-11e7-893c-c7a0ad262343.gif)
# Render Scripts
Passing the -r file parameter allows to pass a list of scripts to be injected into the render thread. It does not follow imports, just evaluate the text
`python -m electron_inject -r ./test.js -r ~/test2.js -r /usr/bin/test3.js - /opt/electron-api-demos/Electron\ API\ Demos`
# Acknowledgments
- [NathanPB](https://github.com/NathanPB) - #7