逆向工程 - Frida - Send Message



參考資訊:
https://github.com/frida/frida
https://frida.re/docs/functions/
https://frida.re/docs/installation/

hook.py

import os
import sys
import frida

def on_message(message, data):
    print(message)

os.system('sleep 3&')

session = frida.attach("sleep")
script = session.create_script("send(1234);")
script.on('message', on_message)
script.load()

sys.stdin.read()

P.S. sys.stdin.read()只是用來停留,等待Ctrl+C結束程式

編譯、執行

$ python3 ./hook.py
    {'type': 'send', 'payload': 1234}

P.S. send()用來傳送訊息回Python程式