Home

Awesome

swift-frida

Swift runtime interop from Frida -- interact with iOS apps written in Swift, using Frida. (See frida-swift instead, if you're looking to script the Frida debugging session using Swift code you write.)

Status

The functionality described below is mostly stable and working, but probably still has some bugs that need to be fixed (please report them!).

I'm mainly testing things on iOS 11.1.2 (64bit), and on iOS 9.3.5 (32bit). Other operating systems are not supported for now. Only apps using Swift 4.0.* are supported at the moment.

Usage

Clone the project, and install its dependencies:

git clone https://github.com/maltek/swift-frida.git
cd swift-frida
npm install

In your script, add this line:

const Swift = require('/path/to/swift-frida/');

Afterwards, compile your script with frida-compile like this:

frida-compile -w -o /tmp/compiled.js your-script.js

To play around with the API interactively, you can load the compiled loader.js into the REPL:

$ frida-compile -w -o /tmp/swift.js loader.js
$ frida -U -n Foo -l /tmp/swift.js
     ____
    / _  |   Frida 12.2.14 - A world-class dynamic instrumentation toolkit
   | (_| |
    > _  |   Commands:
   /_/ |_|       help      -> Displays the help system
   . . . .       object?   -> Display information about 'object'
   . . . .       exit/quit -> Exit
   . . . .
   . . . .   More info at http://www.frida.re/docs/home/

[iOS Device::Foo]-> Swift.available
true

More Information

You can have a look at a video recording and slides of a presentation about this project at r2con 2018.

Available APIs

Right now, the following functions are available in the Swift namespace, when the script is loaded:

But, again, this is completely unstable and might change at any time.

License

Code in metadata.js is based on Apache-2.0 licensed Swift compiler source code. Code in runtime-api.js is based on wxWindows-3.1 licensed frida-objc source code.

The compatible intersection of those licenses is LGPL-3.0 (or later) with wxWindows exceptions. So that's also the license terms under which we release the original code in this repository.