Skip to content

Instantly share code, notes, and snippets.

@kopos
Last active November 24, 2017 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kopos/ffa4f2b0a0aadd22c6abeb11a80c8cf6 to your computer and use it in GitHub Desktop.
Save kopos/ffa4f2b0a0aadd22c6abeb11a80c8cf6 to your computer and use it in GitHub Desktop.
import frida, sys
native_hook_code = """
Java.perform(function() {
Privilege = Java.user("com.android.engineeringmode.qualcomm.Privilege");
Privilege.escalate.implementation = function(v) {
console.log('escalate Done: ');
return true;
};
Privilege = Java.user("com.android.engineeringmode.qualcomm.Privilege");
Privilege.isEscalated.implementation = function(v) {
console.log('isEscalated Done: ');
return false;
};
Privilege = Java.user("com.android.engineeringmode.qualcomm.Privilege");
Privilege.recover.implementation = function(v) {
console.log('recover Done: ');
};
});
"""
def on_message(message, data):
if message['type'] == 'send':
print "[*] {0}".format(message['payload'])
else:
print message
process = frida.get_usb_device().attach('com.android.engineeringmode')
script = process.create_script(native_hook_code)
script.on('message', on_message)
script.load()
sys.stdin.read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment