frida-node icon indicating copy to clipboard operation
frida-node copied to clipboard

Rebuilding frida bindings

Open jeanbmar opened this issue 2 years ago • 5 comments

@oleavr I've developed a one-liner to get the proper binaries since it could be a bit tedious to manually find the frida dependency, delete it and set the environment variables:

https://www.npmjs.com/package/frida-rebuild

Usage: npx frida-rebuild --runtime=electron --target=16.0.0

It will locate frida automatically and climb the directories if used in a workspace / monorepo. Creating an issue so future users can find it from Google :).

jeanbmar avatar Feb 12 '22 11:02 jeanbmar

Thank you very much for your help, but frida-Rebuild does not seem to work for the Nodev16 version of Electron

moweixuanshou avatar Feb 28 '22 21:02 moweixuanshou

It should work, I did use it, e.g. https://github.com/jeanbmar/black-moon-rewind/blob/master/packages/launcher/package.json What's your error message?

jeanbmar avatar Feb 28 '22 21:02 jeanbmar

Thank you very much for your reply. When I try to install frida for electronV17.1.0, I run the npx frida-rebuild -- Runtime =electron --target=17.1.0 command to build, and the following error occurs

> prebuild-install || node-gyp rebuild

prebuild-install WARN install read ECONNRESET
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 3.10.2 found at "C:\Python310\python.exe"
gyp info find VS using VS2022 (17.1.32210.238) found at:
gyp info find VS "D:\Program Files\Microsoft Visual Studio\2022\Community"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python310\python.exe
gyp info spawn args [
gyp info spawn args   'D:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\lxl\\WebstormProjects\\electrondemo\\node_modules\\frida\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\lxl\\AppData\\Local\\node-gyp\\Cache\\17.1.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\lxl\\AppData\\Local\\node-gyp\\Cache\\17.1.0',
gyp info spawn args   '-Dnode_gyp_dir=D:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\lxl\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\17.1.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\lxl\\WebstormProjects\\electrondemo\\node_modules\\frida',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\lxl\\WebstormProjects\\electrondemo\\node_modules\\frida\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
    at file:///C:/Users/lxl/WebstormProjects/electrondemo/node_modules/frida-rebuild/lib/index.js:21:5
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 20164,
  stdout: null,
  stderr: null
}

moweixuanshou avatar Feb 28 '22 21:02 moweixuanshou

Unfortunately I'm not sure Frida binaries for electron 17 are available yet

jeanbmar avatar Feb 28 '22 21:02 jeanbmar

Thank you very much for your reply. I have tried the version of electron 16 and it can run normally. Thank you very much for helping me solve my most trouble this week

moweixuanshou avatar Mar 01 '22 02:03 moweixuanshou