【经验分享】Frida里Java.choose找到某个类的实例,在调用该实例方法时出现“script should be invoke on MainThread”问题的解决:
// Assign the javascript code to a variable. jsCode = """ // Create a method called Cheese that will be exported. function Cheese() { // Perform the code from injected context. Java.perform(function () { // Variable to store the view representing the button // to click programmatically. var view; // Define the Runnable type javascript wrapper. var Runnable = Java.use("java.lang.Runnable");
// Find the MainActivity class in myApp. Java.choose("com.example.myApp.MainActivity", { // Once it has been found execute the following code. onMatch: function(instance) { // Get the view representing button to click. // 2131436712 id derived from decompiling app. view = instance.findViewById(2131436712); // Define a new class that implements Runnable and provide // the implementation of the run() method which, will // execute from the Main thread. const MyRunnable = Java.registerClass({ name:'com.example.MyRunnable', implements: [Runnable], methods: { // run executes button click. run(){ instance.onClick(view); }, } });
// Create an instance of the class just created. var MyGuiUpdate = MyRunnable .$new(); // Schedule the run method in MyGuiUpdate to // execute on the UI thread. instance.runOnUiThread(MyGuiUpdate );
【经验分享】Playwright库使用context.route()/page.route()过滤HTTP(S)请求时发现有Ajax漏包的情况。查官方文档,发现有云: browser_context.route() will not intercept requests intercepted by Service Worker. See this issue. We recommend disabling Service Workers when using request interception by setting browser.new_context.service_workers to 'block'.