frida / frida-tools

Frida CLI tools
Other
338 stars 95 forks source link

How to load script and exit frida environment after removing `--no-pause`? #122

Closed StackOverflowExcept1on closed 1 year ago

StackOverflowExcept1on commented 1 year ago

--no-pause behaviour was changed in a557bfea93e1ac109687b1814bed49177ee184fe

hello.c

#include <stdio.h>
#include <unistd.h>

void
f (int n)
{
  printf ("Number: %d\n", n);
}

int
main (int argc,
      char * argv[])
{
  int i = 0;

  printf ("f() is at %p\n", f);

  while (1)
  {
    f (i++);
    sleep (1);
  }
}

$ gcc -Wall hello.c -o hello

hello.js

Interceptor.attach(ptr("0x55c9f407e169"), {
    onEnter(args) {
        args[0] = ptr("1337");
    }
})
./hello
f() is at 0x55c9f407e169
Number: 0
Number: 1
Number: 2
Number: 3
Number: 4
Number: 5
# since frida 16 --no-pause removed :(
frida hello -l hello.js

     ____
    / _  |   Frida 16.0.1 - A world-class dynamic instrumentation toolkit
   | (_| |
    > _  |   Commands:
   /_/ |_|       help      -> Displays the help system
   . . . .       object?   -> Display information about 'object'
   . . . .       exit/quit -> Exit
   . . . .
   . . . .   More info at https://frida.re/docs/home/
   . . . .
   . . . .   Connected to Local System (id=local)

[Local::hello ]->

Is there any way to exit from [Local::hello ]-> after script loaded?

StackOverflowExcept1on commented 1 year ago

For example I want to use frida --load injector.js with Module.load(...) and exit from js script after performing stuff. It seems to me that this used to work with --load --no-pause

StackOverflowExcept1on commented 1 year ago

Whoops, it can be done via -q flag