Skip to content

How to inject to open devtools in Electron #20

Closed

Description

@CHENKAI00

I successfully injected your config. But But I can't see any effect. Where are the parameters of “console.log ” logged? In addition, This project seems to only support injecting native v8 functions, which I am not sure. I have a question. If I want to open devtools, What code should I inject instead? I tried this script:
var allWebContents = require('electron').webContents.getAllWebContents() allWebContents.forEach((contents)=>{ if (contents.openDevTools) { contents.openDevTools(); } } But failed.
I don't know if my way is wrong. I sincerely look forward to your reply. Thank you very much.

Activity

  1. changed the title [-]Injection succeeded[/-] [+]Injection failed[/+] on Oct 26, 2023
  2. ShellWen commented on Oct 26, 2023

    @ShellWen
    Owner

    It will log to stdout default. Could you provide log?

  3. CHENKAI00 commented on Oct 26, 2023

    @CHENKAI00
    Author

    **E:\app\v8_killer-master\target\debug>v8_killer_launcher.exe E:\bilibili-debugger\bilibili\bi.exe
    [] Executable: E:\bilibili-debugger\bilibili\bi.exe
    [
    ] Args: []
    [] Core lib path: E:\app\v8_killer-master\target\debug\v8_killer_core.dll
    [
    ] Creating process.
    [] PID: 16900
    [
    ] Alloc core lib path memory.
    [] Remote lib path memory Address: 0x1f7bca20000.
    [
    ] Writing core lib path to process.
    [] Getting LoadLibraryW address.
    [
    ] Creating remote thread.
    [] Core lib inject success. Waiting for thread end.
    [
    ] V8_KILLER_CONFIG_FILE_PATH: E:\app\v8_killer-master\examples\configs\simple.toml
    [] Read Config success
    [
    ] Config: Config { rules: {"hook_console_log": ConfigRule { matcher: ResourceNameKeywordMatcher(ResourceNameKeywordMatcher { keyword: "hello_world.js" }), processors: [InsertBeforeProcessor(InsertBeforeProcessor { content: "const originalConsoleLog = console.log\n console.log = function (x) {\n\t\tdebugger;\n\t\t\n originalConsoleLog('now you see :)',x)\n return originalConsoleLog.apply(this, arguments)\n }" }), InsertAfterProcessor(InsertAfterProcessor { content: "console.log = originalConsoleLog;\n\n " })] }} }
    [] v8_script_compiler_compile_function_internal found: 0x7ff60524c0a0
    [
    ] Thread ended. Resume original thread.
    [*] --- Following is the original process output ---

    21:17:34.331 (AppIndex) > Starting...
    21:17:34.353 (AppIndex) > Process args ["E:\bilibili-debugger\bilibili\bi.exe"]
    21:17:34.550 (AppIndex) > Creating new instance!**
    This is the log. In your config file, You replaced “originalConsoleLog” with “console.log” and added 'now you see:' log. But I can not see it. The hook script seems to have no effect.

  4. CHENKAI00 commented on Oct 26, 2023

    @CHENKAI00
    Author

    Sorry, I seem to know where I am wrong

  5. CHENKAI00 commented on Oct 26, 2023

    @CHENKAI00
    Author

    But I still do not konw what script I can inject to open devtools.

  6. CHENKAI00 commented on Oct 26, 2023

    @CHENKAI00
    Author

    In addition, I found some electron applications were started with "jsc" files, and the injection failed again.
    I'm very sorry to keep submitting issues to you. I'm sorry if I have disturbed you.

  7. changed the title [-]Injection failed[/-] [+]How to inject to open devtools in Electron[/+] on Oct 26, 2023
  8. Repository owner locked and limited conversation to collaborators on Oct 26, 2023
  9. converted this issue into a discussion #21 on Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions