How to use the andriller.windows.BaseWindow function in andriller

To help you get started, we’ve selected a few andriller 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 den4uk / andriller / andriller / windows.py View on Github external
raise FileHandlerError('The file selected is of unexpected size.')
            path_ = os.path.split(dialog)[0]
            self.conf.update_conf(**{'DEFAULT': {lpath: path_}})
            dialog = os.path.realpath(dialog)
            return dialog

    def get_dir(self, path='last_path'):
        dialog = filedialog.askdirectory(initialdir=self.conf(path))
        if dialog:
            dialog = os.path.realpath(dialog)
            self.conf.update_conf(**{'DEFAULT': {'last_path': dialog}})
            return dialog


# Main Window -----------------------------------------------------------------
class MainWindow(BaseWindow):

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.set_title()
        # ADB moved to the bottom once the logger handler is configured
        # self.adb = adb_conn.ADBConn(logger=logger, log_level=self.log_level)
        self.registry = decoders.Registry()
        self.menubar = tk.Menu(self.root, tearoff=0)
        self.root['menu'] = self.menubar
        self.build_file_menus()
        self.build_decoders_menus()
        self.build_utils_menus()
        self.build_locks_menus()
        self.build_tools_menus()
        self.build_adb_menus()
        self.build_help_menus()
github den4uk / andriller / andriller / windows.py View on Github external
def make_range(self):
        selection = ''.join([k for k, v in {
            string.ascii_lowercase: self.LOWER.get(),
            string.ascii_uppercase: self.UPPER.get(),
            string.digits: self.DIGITS.get(),
            self.CUSTVALS.get(): self.CUSTOM.get(),
        }.items() if v])
        return selection

    def start(self):
        super().start(alpha=True, alpha_range=self.make_range(),
            min_len=self.MIN.get(), max_len=self.MAX.get())


# --------------------------------------------------------------------------- #
class ScreenCap(BaseWindow):

    def __init__(self, root=None, title=f'{__app_name__}: Screen Capture'):
        super().__init__(root=root, title=title)

        self.store = screencap.ScreenStore()

        self.REPCOUNT = tk.StringVar()
        self.REPCOUNT.set('Report')
        self.OUTPUTLAB = tk.StringVar()
        self.OUTPUTLAB.set('(Not saving screen shots)')
        self.REMEMBER = tk.IntVar()
        self.REMEMBER.set(0)

        ttk.Label(self.mainframe, font=self.FontTitle, text=f'\n{title}\n').grid(row=1, column=0, columnspan=3)
        # Make an empty Canvas
        self.snap_frame = ttk.Labelframe(self.mainframe, text='Screen View', padding=(1, 0, 1, 0))
github den4uk / andriller / andriller / windows.py View on Github external
if len(sha) != 40:
            return  # TODO: error message
        self.VISUAL.delete(tk.ALL)
        self.draw_pattern(self.VISUAL, None)
        self.PATTERN.set('Decoding...')
        pat = cracking.crack_pattern(sha)
        if pat:
            pat = str(pat)
            self.PATTERN.set(pat)
            self.draw_pattern(self.VISUAL, pat)
        else:
            self.PATTERN.set(':(')


# Generic PIN Cracking Window -------------------------------------------------
class LockscreenBase(BaseWindow):
    def __init__(self, root=None, title=None):
        super().__init__(root=root, title=title)

        ttk.Label(self.mainframe, font=self.FontTitle, text=f'\n{title}\n').grid(row=1, column=0, columnspan=3)

        self.START = tk.StringVar()
        self.END = tk.StringVar()
        self.START.set('0000')
        self.END.set('9999')
        self.HASH = tk.StringVar()
        self.SALT = tk.IntVar()
        self.SALT.set('')
        self.RESULT = tk.StringVar()
        self.DICTFILE = tk.StringVar()
        self.DICTLAB = tk.StringVar()
        self.TRIED = tk.StringVar()
github den4uk / andriller / andriller / windows.py View on Github external
logger.error(f'WhatsAppCrypt: {err}')
                        self.file_box.item(i, tags='failure')
                        messagebox.showerror('WhatsApp decryption error', str(err))
                    except Exception as err:
                        logger.error(f'WhatsAppCrypt: {fname}: {err}')
                        self.file_box.item(i, tags='failure')
        finally:
            self.file_box.selection_set()
            self.controls_state(tk.NORMAL)

    def get_supported(self):
        return {kls.CRYPT: kls for kls in decrypts.WhatsAppCrypt.__subclasses__()}


# Pattern Decoding Window -----------------------------------------------------
class BrutePattern(BaseWindow):
    CANVAS_SIZE = 210
    FACTOR = 3

    def __init__(self, root=None, title='Lockscreen Gesture Pattern'):
        super().__init__(root=root, title=title)

        ttk.Label(self.mainframe, font=self.FontTitle, text=f'\n{title}\n').grid(row=1, column=0, columnspan=3)
        self.FILE = tk.StringVar()
        self.HASH = tk.StringVar()
        self.PATTERN = tk.StringVar()

        browse = ttk.Button(self.mainframe, text='Browse', command=self.select_file)
        browse.grid(row=2, column=0, sticky=tk.E)
        createToolTip(browse, "Select 'gesture.key' and it will be decoded automatically.")
        ttk.Label(self.mainframe, textvariable=self.FILE).grid(row=2, column=1, columnspan=2, sticky=tk.W)
github den4uk / andriller / andriller / windows.py View on Github external
self.StatusMsg.set('Running...')
                    drill = driller.ChainExecution(
                        output_dir,
                        src_dir=src_dir,
                        status_msg=self.StatusMsg,
                        logger=logger)
                    drill.CreateWorkDir()
                    drill.ExtractFromDir()
                    drill.DataDecoding()
                    drill.GenerateHtmlReport()
                    drill.GenerateXlsxReport()
                    drill.CleanUp()


# WhatsApp Crypt --------------------------------------------------------------
class WhatsAppCrypt(BaseWindow):
    KEY_SIZE = decrypts.WhatsAppCrypt.KEY_SIZE
    SUFFIX = decrypts.WhatsAppCrypt.SUFFIX

    def __init__(self, root=None, title='WhatsApp Crypt Decryptor'):
        super().__init__(root=root, title=title)
        self.guide = statics.WHATSAPP_CRYPT
        self.work_dir = None
        self.crypts = {}
        self.key_file = None
        self.supported = self.get_supported()
        self._info = tk.StringVar()
        self._info_but = tk.StringVar()
        self._info_but.set('Show Info')

        ttk.Label(self.mainframe, text=title, font=self.FontTitle).grid(row=1, column=0, columnspan=2)
        tk.Button(self.mainframe, textvariable=self._info_but, relief='flat', command=self.info_toggle)\
github den4uk / andriller / andriller / windows.py View on Github external
filetypes=[('Portable Network Graphics', '*.png')])
        if savefilename:
            shutil.copy2(file_location, savefilename)

    @threaded
    def report(self, event=None):
        with disable_control(event):
            if not self.store.count:
                messagebox.showinfo('No Captures', "Nothing to report yet")
                return
            report = pathlib.Path(self.store.report())
            webbrowser.open_new_tab(report.as_uri())


# Preferences -----------------------------------------------------------------
class Preferences(BaseWindow):
    def __init__(self, root=None, title='User Preferences'):
        super().__init__(root=root, title=title)

        self.fields = {
            'default_path': {
                'label': 'Default OUTPUT path',
                'tooltip': 'This will be the default location path where report outputs will be saved.',
                'var': tk.StringVar,
                'control': ttk.Entry,
                'browse': True
            },
            'update_rate': {
                'label': 'Cracking update rate',
                'tooltip': 'Rate at which the UI is updated with a current value during password cracking.',
                'var': tk.IntVar,
                'control': tk.Spinbox,