discover-exported-components

by
4 views 9ce82724...

Description

discover exported components while the code is obufsecated or u can't read it

How to Use

Download the script and run it with Frida CLI:

Download Script

Then run with Frida:

frida -U -f YOUR_PACKAGE_NAME -l discover-exported-components.js

Replace YOUR_PACKAGE_NAME with the target app's package name.

Source Code

JavaScript
function main() {
    Java.perform(function() {
        var ActivityThread = Java.use("android.app.ActivityThread");
        var PackageManager = Java.use("android.content.pm.PackageManager");

        // Get the current application context
        var context = ActivityThread.currentApplication().getApplicationContext();
        var packageName = context.getPackageName();
        var packageInfo = context.getPackageManager().getPackageInfo(packageName,
            PackageManager.GET_ACTIVITIES.value | PackageManager.GET_SERVICES.value | PackageManager.GET_RECEIVERS.value
        );

        console.log("\n[+] Package Name: " + packageName);

        function logExportedComponents(componentInfoArray, componentType) {
            if (componentInfoArray) {
                for (var i = 0; i < componentInfoArray.length; i++) {
                    var component = componentInfoArray[i];
                    if (component.exported.value) {
                        console.log("  [-] Exported " + componentType + " " + packageName + "/" + component.name.value);
                    }
                }
            }
        }

        console.log("\n[+] Exported Activities:");
        logExportedComponents(packageInfo.activities.value, "Activity: ");

        console.log("\n[+] Exported Services:");
        logExportedComponents(packageInfo.services.value, "Service: ");

        console.log("\n[+] Exported Broadcast Receivers:");
        logExportedComponents(packageInfo.receivers.value, "Broadcast Receiver: ");

        console.log("\n[+] Done.");
    });
}

setTimeout(function() {
    Java.scheduleOnMainThread(main);
}, 50);
Share this script:
Twitter LinkedIn

Comments

Login or Sign up to leave a comment.
Loading comments...