Git Product home page Git Product logo

frida-scripts's Introduction

frida-scripts

"Just because you're paranoid doesn't mean they aren't after you."

-- Joseph Heller, Catch-22

A collection of my Frida.re instrumentation scripts to facilitate reverse engineering of mobile apps.

Blog post:
https://web.archive.org/web/20200623001844/https://techblog.mediaservice.net/2017/09/tracing-arbitrary-methods-and-function-calls-on-android-and-ios/

For a well-maintained project that includes some of my Frida scripts, refer to:
https://github.com/federicodotta/Brida

iOS

Android

frida-scripts's People

Contributors

0xdea avatar mustafairan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

frida-scripts's Issues

Several Connection Support

Hi,

Sometimes there is a need to instrument 2 device at the same time. As far as I know , there is no option to choose which device is instrumented. So, it goes random and indtruments one of them only. Could you add support for more device ?

how to use frida to reflect a method

For example, a java function

public byte[] aesEncrypt(String plaintext)

I want to reflect this method,

 var class_name1 = "com.example.cryptutils.util.CryptoUtils";
  var Platform1  = Java.use(class_name1);
var method = Platform1.getDeclaredMethod("aesEncrypt",XXXXX);

how to input the XXXX ?

Lots of undefined printed out in enum

I think that catch needs a return; statement. When I try to enumerate all classes , it prints lots of undefined because you push null values to the allclasses eventhough it catches an error

classes.forEach(function(aClass) {
	try {
		var className = aClass.match(/[L](.*);/)[1].replace(/\//g, ".");
	}
	catch(err) {} // avoid TypeError: cannot read property 1 of null
	allClasses.push(className);
});

I think needs to be

classes.forEach(function(aClass) {
	try {
		var className = aClass.match(/[L](.*);/)[1].replace(/\//g, ".");
	}
	catch(err) {return;} // avoid TypeError: cannot read property 1 of null
	allClasses.push(className);
});

TypeError: cannot read property 1 of null

Title says it all.

$ frida -U -f com.target.app -l frida-scripts/raptor_frida_android_trace.js --no-pause
     ____
    / _  |   Frida 12.6.10 - A world-class dynamic instrumentation toolkit
   | (_| |
    > _  |   Commands:
   /_/ |_|       help      -> Displays the help system
   . . . .       object?   -> Display information about 'object'
   . . . .       exit/quit -> Exit
   . . . .
   . . . .   More info at http://www.frida.re/docs/home/
Spawned `com.target.app`. Resuming main thread!                
[OnePlus ONEPLUS A3003::com.target.app]-> TypeError: cannot read property 1 of null
    at [anon] (../../../frida-gum/bindings/gumjs/duktape.c:56648)
    at /repl1.js:46
    at frida/node_modules/frida-java/index.js:182
    at forEach (native)
    at /_java.js:2682
    at frida/node_modules/frida-java/index.js:110
    at trace (/repl1.js:51)                                                                                                                                                          
    at /repl1.js:175
    at frida/node_modules/frida-java/lib/vm.js:42
    at E (frida/node_modules/frida-java/index.js:348)
    at frida/node_modules/frida-java/index.js:300
    [...]

System info:

$ ./adb shell
OnePlus3:/ $ su
OnePlus3:/ # uname -a
Linux localhost 3.18.66-perf+ #1 SMP PREEMPT Thu Dec 6 00:54:59 CST 2018 aarch64
OnePlus3:/ # exit
OnePlus3:/ $ exit
$ uname -a
Linux FJIEW 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u3 (2019-06-16) x86_64 GNU/Linux

Cannot trace any function - java.lang.ClassNotFoundException

I'm trying to trace functions of a specific class of an old old game with broken in-apps.

Having decompiled the game through apktool, I found a class I'm interested.
But no matter how I run the trace function, the game launches, then frida throws an error: Error: java.lang.ClassNotFoundException: Didn't find class "com.game.tka" on path: DexPathList[[zip file "/data/app/~~tnL0853xrVQX1h4toIMrDA==/com.game.tka-aq3_iPPP9AhvI_iyOxSG6g==/base.apk"],nativeLibraryDirectories=[/data/app/~~tnL0853xrVQX1h4toIMrDA==/com.game.tka-aq3_iPPP9AhvI_iyOxSG6g==/lib/arm64, /system/lib64, /system_ext/lib64]]
The main app class is com.game.tka, and I'd like to trace methods of com.game.tka.Dungeons, trace("com.game.tka.Dungeons") doesn't work however.

Am I doing something wrong, or is this script no longer maintained and possibly broken?

ReferenceError: identifier 'i' undefined

error:
Snipaste_2020-08-06_11-13-36

code at /raptor_frida_ios_autoIntercept.js:66

your code:

				// print args
				for (i = 0; i < argCount; i++) {
					printType("\narg " + (i + 1) + " type:\t", args[i + 2]);
					printValue("arg " + (i + 1) + " value:\t", args[i + 2]);
				}

changed code:

				// print args
				for (var i = 0; i < argCount; i++) {
					printType("\narg " + (i + 1) + " type:\t", args[i + 2]);
					printValue("arg " + (i + 1) + " value:\t", args[i + 2]);
				}

frida version:
12.7.5

iOS version:
11.1

end:
Sorry, my English is not very good, hope you can understand this issue, welcome to email me: [email protected]
Look forward to hearing from you~

Android Trace Issue

Hello, I am using raptor_frida_android_trace.js and I am getting an error upon the app being spawned.

Spawned APP. Resuming main thread! [DEVICE::APP]-> TypeError: cannot read property 1 of null at [anon] (duk_hobject_props.c:2385) at [anon] (repl1.js:46) at frida/node_modules/frida-java/index.js:190 at forEach (native) at d (java.js:2216) at frida/node_modules/frida-java/index.js:120 at trace (repl1.js:51) at [anon] (repl1.js:174) at frida/node_modules/frida-java/lib/vm.js:39 at v (frida/node_modules/frida-java/index.js:338) at frida/node_modules/frida-java/index.js:309 [...]

It looks like the issue is on line 46:
var className = aClass.match(/[L](.*);/)[1].replace(/\//g, ".");

Is there an easy fix like a null check? Could this issue be caused by obfuscation?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.