Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frida/frida-swift
Frida Swift bindings
https://github.com/frida/frida-swift
Last synced: 3 months ago
JSON representation
Frida Swift bindings
- Host: GitHub
- URL: https://github.com/frida/frida-swift
- Owner: frida
- License: other
- Created: 2016-04-03T23:05:12.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2024-04-12T21:49:43.000Z (7 months ago)
- Last Synced: 2024-04-13T02:46:31.618Z (7 months ago)
- Language: Swift
- Size: 105 KB
- Stars: 138
- Watchers: 10
- Forks: 36
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
- awesome-hacking-lists - frida/frida-swift - Frida Swift bindings (Swift)
README
# frida-swift
Swift bindings for [Frida](https://frida.re).
## Install
- Run:
make
- Copy `build/Frida/Frida.framework` into your project, or run `make install`
if you need a shared installation. In the latter case you may want to first
run `./configure` with a suitable `--prefix`.## Example
```swift
func testFullCycle() {
let pid: UInt = 20854let expectation = self.expectation(description: "Got message from script")
class TestDelegate : ScriptDelegate {
let expectation: XCTestExpectation
var messages: [Any] = []init(expectation: XCTestExpectation) {
self.expectation = expectation
}func scriptDestroyed(_: Script) {
print("destroyed")
}func script(_: Script, didReceiveMessage message: Any, withData data: Data?) {
print("didReceiveMessage")
messages.append(message)
if messages.count == 2 {
expectation.fulfill()
}
}
}
let delegate = TestDelegate(expectation: expectation)let manager = DeviceManager()
var script: Script? = nil
manager.enumerateDevices { result in
let devices = try! result()
let localDevice = devices.filter { $0.kind == Device.Kind.local }.first!
localDevice.attach(to: pid) { result in
let session = try! result()
session.createScript("console.log(\"hello\"); send(1337);") { result in
let s = try! result()
s.delegate = delegate
s.load() { result in
_ = try! result()
print("Script loaded")
}
script = s
}
}
}self.waitForExpectations(timeout: 5.0, handler: nil)
print("Done with script \(script), messages: \(delegate.messages)")
}
```