How to use jnitrace - 4 common examples

To help you get started, we’ve selected a few jnitrace examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chame1eon / jnitrace / jnitrace / jnitrace.py View on Github external
def on_message(self, message, data):
        """
        Frida on_message callback, for formatting output data.
        :param message - JSON formatted output
        :param data - binary data for some JNI method calls
        """
        if TraceFormatter._is_error(message):
            return

        payload = message["payload"]

        if TraceFormatter._is_meta_message(payload):
            return

        if self._buffer_output:
            self._update_output_buffer(message["payload"], data)

        self._current_ts = payload["timestamp"]

        self._color_manager.update_current_color(payload["thread_id"])

        self._print_method_call(payload, data)

        if self._config["show_backtrace"]:
            self._print_backtrace(payload["backtrace"])

        print()
github chame1eon / jnitrace / jnitrace / jnitrace.py View on Github external
"""
    Main function to process command arguments and to inject Frida.
    """
    jscode = resource_string("jnitrace.build", "jnitrace.js").decode()
    jscode = jscode.replace("IS_IN_REPL = true", "IS_IN_REPL = false")

    args = _parse_args()

    b_t = False

    if args.backtrace == "accurate":
        b_t = True
    elif args.backtrace == "fuzzy":
        b_t = True

    formatter = TraceFormatter({
        "show_backtrace": b_t,
        "show_data": not args.hide_data
    }, args.output is not None)

    device = frida.get_usb_device(3)
    if args.inject_method == "spawn":
        pid = device.spawn([args.target])
    else:
        pid = device.get_process(args.target).pid

    session = device.attach(pid)
    scripts = {}

    if args.prepend:
        prepend = session.create_script(args.prepend.read(), runtime="v8")
        prepend.on("message", _custom_script_on_message)
github chame1eon / jnitrace / jnitrace / jnitrace.py View on Github external
def on_message(self, message, data):
        """
        Frida on_message callback, for formatting output data.
        :param message - JSON formatted output
        :param data - binary data for some JNI method calls
        """
        if TraceFormatter._is_error(message):
            return

        payload = message["payload"]

        if TraceFormatter._is_meta_message(payload):
            return

        if self._buffer_output:
            self._update_output_buffer(message["payload"], data)

        self._current_ts = payload["timestamp"]

        self._color_manager.update_current_color(payload["thread_id"])

        self._print_method_call(payload, data)
github chame1eon / jnitrace / jnitrace / jnitrace.py View on Github external
def __init__(self, _config, _buffer_output):
        self._config = _config
        self._buffer_output = _buffer_output

        self._current_ts = None
        self._color_manager = ColorManager()
        self._output_buffer = []
        self._is_64b = False

jnitrace

A tool for tracing use of the JNI in Android apps

MIT
Latest version published 2 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages