mirror of
https://github.com/frida/frida-python.git
synced 2026-11-07 09:35:57 -10:00
session: Add support for the new snapshot APIs (#212)
This commit is contained in:
1 parent
39c684de90
commit
85229982a6
3 files changed
+146
-13
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import frida
|
||||
|
||||
|
||||
embed_script = """
|
||||
const button = {
|
||||
color: 'blue',
|
||||
};
|
||||
|
||||
function mutateButton() {
|
||||
button.color = 'red';
|
||||
}
|
||||
"""
|
||||
|
||||
warmup_script = """
|
||||
mutateButton();
|
||||
"""
|
||||
|
||||
test_script = """
|
||||
console.log('Button before:', JSON.stringify(button));
|
||||
mutateButton();
|
||||
console.log('Button after:', JSON.stringify(button));
|
||||
"""
|
||||
|
||||
runtime = "v8"
|
||||
|
||||
|
||||
session = frida.attach(0)
|
||||
|
||||
snapshot = session.snapshot_script(embed_script, warmup_script=warmup_script, runtime=runtime)
|
||||
|
||||
def on_message(message, data):
|
||||
print("on_message:", message)
|
||||
|
||||
script = session.create_script(test_script, snapshot=snapshot, runtime=runtime)
|
||||
script.on("message", on_message)
|
||||
script.load()
|
||||
Reference in new issue
Block a user