8000 Is there any support for evaling compiled scripts? · Issue #71 · frida-packages/frida-compile · GitHub
[go: up one dir, main page]

Skip to content

Is there any support for evaling compiled scripts? #71

Open

Description

@ExternalAddress4401

Frida-compile gives packaged scripts that don't seem to play well with eval. I see Frida provides Script.load and Script.execute but they don't seem to handle this container format either.

I'm testing with

import { readFileOnDevice } from '../lib/Utilities.js';

const Log = Java.use("android.util.Log");
const script = readFileOnDevice('run.js');

try {
	Log.v("game", "running");
	Script.evaluate("beatstar", script);
}
catch(e) {
	Log.v("game", e);
}

Where run.js is

const Log = Java.use("android.util.Log");
Log.v("game", "I ran");

When compiled, no output is produced and the catch statement isn't executed either.

When not compiled and left as raw code it prints out "I ran" as expected.

Is this at all supported in some way?

Activity

  1. ExternalAddress4401 commented on May 1, 2023

    @ExternalAddress4401
    Author

    I've tried #72 but it still doesn't work. The moment I include my ESM module it stops executing the script properly and since neither eval, Script.load nor Script.evaluate give any errors I have nothing to go off of.

  2. ExternalAddress4401 commented on May 2, 2023

    @ExternalAddress4401
    Author

    I'm so confused I'm ready to just give up and go back to frida-compile 10.

    import assert from 'assert';
    
    Java.perform(function () {
        var Log = Java.use("android.util.Log");
        Log.v("beatstar", "Have fun!");
    });
    

    ^ Compiled with frida-compile -S -p as #72 provides

    import fs from 'frida-fs';
    
    const Log = Java.use("android.util.Log");
    
    const script = fs.readFileSync('/sdcard/run.js').toString();
    
    async function start() {
      Java.perform(() => {
        Log.v('script', 'inside java perform');
        try {
          Log.v('script', 'loading');
          Script.load('script', script);
          Log.v('script', 'after');
        } catch (e) {
          Log.v("script", e);
        }
      })
    }
    
    start();
    

    This gives no output. Running the script directly with Frida works fine, removing the import to assert works fine, no errors or anything are output when invalid. This seems like a hopeless endeavor.

  3. ExternalAddress4401 commented on May 3, 2023

    @ExternalAddress4401
    Author

    I'm giving up in this, it's not worth it.

    My snippet above

    import assert from 'assert';
    Java.perform(function () {
        var Log = Java.use("android.util.Log");
        Log.v("beatstar", "Have fun!");
    });
    

    Doesn't work. No errors. Remove the import statement and output is given correctly.

    ESbuild doesn't work either. With no documentation on how Script.load is supposed to work I have to assume you just can't do this anymore.

  4. oleavr commented on Jun 1, 2023

    @oleavr
    Contributor

    Not yet, but we should implement that.

  5. Sinixx commented on Jan 22, 2024

    @Sinixx

    Not yet, but we should implement that.

    Is there really no option to run a string in a compiled script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0