Discover Java Random usage

by
4 views 3d68e8a0...

Description

Use this script to print out the trace for any methods calling Random instead of SecureRandom.

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-java-random-usage.js

Replace YOUR_PACKAGE_NAME with the target app's package name.

Source Code

JavaScript
Java.perform(
    function() {
        var javaRandom = Java.use("java.util.Random");
        console.log("[!] Found random loaded");
        javaRandom.nextInt.overload("int").implementation = function(a) {
            var ret = this.nextInt(a);
            console.log("[*] The random number: " + ret.toString());
            Java.perform(function() {
                console.log("[*] Calling method:" + Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new()))
            });
            return ret;
        }
    }
);
Share this script:
Twitter LinkedIn

Comments

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