一.模板
function douyinencode(data) {
var result = {};
Java.perform(function () {
try {
var Test = Java.use("类名");
result = Test.方法名(入参);
result = {"code": 0, "value":result};
} catch (e) {
result = {"code": 1, "value": e.toString()};
}
});
return result
};
二.结合flask
from flask import Flask,jsonify,request
import frida
app =Flask(__name__)
js ='''function Fun(args){
Java.perform(function () {
var result;
var Test = Java.use("类名");
result = Test.方法名(args); //入参
result = {"code": 0, "value": result};
});
return result
}'''
def show(message,data):
print(message)
rdev = frida.get_remote_device()
session = rdev.attach("com.lianjia.beike") #app包名
script = session.create_script(js)
script.on("message",show)
# 加载脚本
script.load()
@app.route("/test")
def index():
args = request.args['args']
res = script.exports.Fun(args) #script.exports.js文件方法名,入参
return res
if __name__ == '__main__':
app.run()