maltek / swift-frida

Frida library for interacting with Swift programs. Superseded by https://github.com/frida/frida-swift-bridge
96 stars 20 forks source link

Incompatible with latest Frida #12

Closed pandasauce closed 6 years ago

pandasauce commented 6 years ago

Steps:

  1. Compile a script with just const Swift = require('./swift-frida/index.js');
  2. Spawn an iOS app with this script using frida -U -l tmp.js -f app.name
  3. Script crashes with Failed to load script: gDBus.Error:re.frida.Error.InvalidArgument: Script(line 5): SyntaxError: parse error
  4. This does not occur when running scripts built with frida-compile that don't rely on this library.

This is line 5: let convention;

Using a iOS 11.1 device, Frida 12.2.14.

maltek commented 6 years ago

Weird! Happens to me, too. But it seems to work when requiring the directory without the index.js. Seems like a bug in frida-compile/babelify to me, but I can't say I know a lot about the node module system.

pandasauce commented 6 years ago

If I omit index.js, compiling doesn't work at all:

Error: Cannot find module 'babelify' from '~/ff/swift-frida'
    at ~/sdk/node-v10.12.0-linux-x64/lib/node_modules/frida-compile/node_modules/resolve/lib/async.js:51:31
    at processDirs (~/sdk/node-v10.12.0-linux-x64/lib/node_modules/frida-compile/node_modules/resolve/lib/async.js:185:39)
    at ondir (~/sdk/node-v10.12.0-linux-x64/lib/node_modules/frida-compile/node_modules/resolve/lib/async.js:200:13)
    at load (~/sdk/node-v10.12.0-linux-x64/lib/node_modules/frida-compile/node_modules/resolve/lib/async.js:83:43)
    at onex (~/sdk/node-v10.12.0-linux-x64/lib/node_modules/frida-compile/node_modules/resolve/lib/async.js:108:17)
    at ~/sdk/node-v10.12.0-linux-x64/lib/node_modules/frida-compile/node_modules/resolve/lib/async.js:12:69
    at FSReqWrap.oncomplete (fs.js:154:21)
pandasauce commented 6 years ago

Managed to resolve this. Usage instructions are missing a critical step:

cd swift-frida
npm install

This installs npm dependencies for swift-frida at the versions from package.json