Exemple #1
0
class AppWindow(QMainWindow):
    def __init__(self, dwarf_args, flags=None, *args, **kwargs):
        super().__init__(flags, *args, **kwargs)

        self.app = App(self)
        self.adb = Adb(self.app)

        self.dwarf = Dwarf(self)

        self.update_title()

        self.setCentralWidget(self.app)
        self.app.setup_ui()

        self.menu = MenuBar(self)
        if dwarf_args.package is not None:
            self.dwarf.spawn(dwarf_args.package, dwarf_args.script)

    def get_adb(self):
        return self.adb

    def get_app_instance(self):
        return self.app

    def on_context_info(self):
        self.get_menu().on_context_info()

    def get_dwarf(self):
        return self.dwarf

    def get_menu(self):
        return self.menu

    def on_script_destroyed(self):
        self.menu.on_script_destroyed()
        self.app.on_script_destroyed()

    def on_script_loaded(self):
        self.menu.on_script_loaded()
        self.app.on_script_loaded()

    def update_title(self, title_str="Dwarf"):
        self.setWindowTitle(title_str)
Exemple #2
0
class AppWindow(QMainWindow):
    def __init__(self, dwarf_args, flags=None, *args, **kwargs):
        super().__init__(flags, *args, **kwargs)

        self.app = App(self)
        self.adb = Adb()

        self.dwarf = Dwarf(self)

        self.update_title()

        self.setCentralWidget(self.app)
        self.app.setup_ui()

        self.menu = MenuBar(self)
        if dwarf_args.package is not None:
            # we skip welcome ui here
            if not self.get_adb().available():
                # additional check if we have a local server to starts with
                if frida.get_local_device() is None:
                    utils.show_message_box(
                        'adb/device/emu not found or not rooted! see details or output',
                        self.app.get_adb().get_states_string())
                    return

            if dwarf_args.spawn is not None:
                err = self.dwarf.spawn(dwarf_args.package, dwarf_args.script)
            else:
                err = self.dwarf.attach(dwarf_args.package,
                                        dwarf_args.script,
                                        print_debug_error=False)
                if err > 0:
                    if err == 1:
                        # no device? kidding?
                        pass
                    elif err == 2:
                        # no proc to attach - fallback to spawn
                        err = self.dwarf.spawn(dwarf_args.package,
                                               dwarf_args.script)

    def get_adb(self):
        return self.adb

    def get_app_instance(self):
        return self.app

    def on_context_info(self):
        self.get_menu().on_context_info()

    def get_dwarf(self):
        return self.dwarf

    def get_menu(self):
        return self.menu

    def on_script_destroyed(self):
        self.menu.on_script_destroyed()
        self.app.on_script_destroyed()

    def on_script_loaded(self):
        self.menu.on_script_loaded()
        self.app.on_script_loaded()

    def update_title(self, title_str="Dwarf"):
        self.setWindowTitle(title_str)