Frida----基本代码

代码来自官网:https://www.frida.re/docs/examples/android/

import frida, sys

 

def on_message(message, data):

if message['type'] == 'send':

print("[*] {0}".format(message['payload']))

else:

print(message)

 

jscode = """

Java.perform(function () {

// Function to hook is defined here

// 加载类文件

var MainActivity = Java.use('类名');

 

// Whenever button is clicked

// hook函数

MainActivity.onClick.implementation = function (v) {

// Show a message to know that the function got called

// 发送消息,返回到on_message()函数中

send('onClick');

 

// Call the original onClick handler

// 调用自己

this.onClick(v);

 

// Set our values after running the original onClick handler

// 修改变量内容

this.m.value = 0;

this.n.value = 1;

this.cnt.value = 999;

 

// Log to the console that it's done, and we should have the flag!

// 发送消息,返回到on_message()函数中

console.log('Done:' + JSON.stringify(this.cnt));

};

});

"""

 

process = frida.get_usb_device().attach('包名')

#获取连接到电脑上设备中进程句柄

script = process.create_script(jscode)

#创建代码

script.on('message', on_message)

#监听事件

print('[*] Running CTF')

script.load()

#加载代码

sys.stdin.read()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值