-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
device: Add open_service() and Service API
Co-authored-by: Håvard Sørbø <[email protected]>
- Loading branch information
Showing
9 changed files
with
317 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import frida | ||
import pprint | ||
|
||
device = frida.get_usb_device() | ||
|
||
deviceinfo = device.open_service("dtx:com.apple.instruments.server.services.deviceinfo") | ||
response = deviceinfo.request({"method": "runningProcesses"}) | ||
pprint.pp(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import frida | ||
import sys | ||
|
||
|
||
def on_message(message): | ||
print("on_message:", message) | ||
|
||
|
||
device = frida.get_usb_device() | ||
|
||
opengl = device.open_service("dtx:com.apple.instruments.server.services.graphics.opengl") | ||
opengl.on("message", on_message) | ||
opengl.request( | ||
{ | ||
"method": "setSamplingRate:", | ||
"args": [5.0], | ||
} | ||
) | ||
opengl.request( | ||
{ | ||
"method": "startSamplingAtTimeInterval:", | ||
"args": [0.0], | ||
} | ||
) | ||
|
||
sys.stdin.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import frida | ||
import sys | ||
|
||
|
||
def on_close(): | ||
print("on_close") | ||
|
||
|
||
def on_message(message): | ||
print("on_message:", message) | ||
|
||
|
||
device = frida.get_usb_device() | ||
|
||
processcontrol = device.open_service("dtx:com.apple.instruments.server.services.processcontrol") | ||
processcontrol.on("close", on_close) | ||
processcontrol.on("message", on_message) | ||
pid = processcontrol.request( | ||
{ | ||
"method": "launchSuspendedProcessWithDevicePath:bundleIdentifier:environment:arguments:options:", | ||
"args": [ | ||
"", | ||
"no.oleavr.HelloIOS", | ||
{}, | ||
[], | ||
{ | ||
"StartSuspendedKey": False, | ||
}, | ||
], | ||
} | ||
) | ||
processcontrol.request({"method": "startObservingPid:", "args": [pid]}) | ||
|
||
print(f"App spawned, PID: {pid}. Kill it to see an example message being emitted.") | ||
sys.stdin.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import frida | ||
import sys | ||
|
||
if len(sys.argv) != 2: | ||
print(f"Usage: {sys.argv[0]} outfile.png", file=sys.stderr) | ||
sys.exit(1) | ||
outfile = sys.argv[1] | ||
|
||
device = frida.get_usb_device() | ||
|
||
screenshot = device.open_service("dtx:com.apple.instruments.server.services.screenshot") | ||
response = screenshot.request({"method": "takeScreenshot"}) | ||
with open(outfile, "wb") as f: | ||
f.write(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import frida | ||
import sys | ||
import time | ||
|
||
|
||
def on_message(message): | ||
print("on_message:", message) | ||
|
||
|
||
device = frida.get_usb_device() | ||
|
||
sysmontap = device.open_service("dtx:com.apple.instruments.server.services.sysmontap") | ||
sysmontap.on("message", on_message) | ||
sysmontap.request( | ||
{ | ||
"method": "setConfig:", | ||
"args": [ | ||
{ | ||
"ur": 1000, | ||
"cpuUsage": True, | ||
"sampleInterval": 1000000000, | ||
}, | ||
], | ||
} | ||
) | ||
sysmontap.request({"method": "start"}) | ||
time.sleep(5) | ||
sysmontap.request({"method": "stop"}) | ||
|
||
sys.stdin.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import frida | ||
|
||
device = frida.get_usb_device() | ||
|
||
diag = device.open_service("plist:com.apple.mobile.diagnostics_relay") | ||
diag.request({"type": "query", "payload": {"Request": "RSDCheckin", "ProtocolVersion": "2", "Label": "Frida"}}) | ||
diag.request({"type": "read"}) | ||
diag.request({"type": "query", "payload": {"Request": "Sleep", "WaitForDisconnect": True}}) | ||
diag.request({"type": "query", "payload": {"Request": "Goodbye"}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import frida | ||
import pprint | ||
|
||
device = frida.get_usb_device() | ||
|
||
appservice = device.open_service("xpc:com.apple.coredevice.appservice") | ||
response = appservice.request( | ||
{ | ||
"CoreDevice.featureIdentifier": "com.apple.coredevice.feature.listprocesses", | ||
"CoreDevice.action": {}, | ||
"CoreDevice.input": {}, | ||
} | ||
) | ||
pprint.pp(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.