How to use the andriller.utils.human_bytes 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 / decoders.py View on Github external
# Process main messages
        table = 'messages'
        kw = {'where': {'!status': [6, -1]}, 'order_by': 'timestamp'}
        for i in self.sql_table_as_dict(table, **kw):
            i['sender'] = self.get_sender(i)
            i['recipients'] = self.get_recipients(i)
            i['x_recipients'] = '\n'.join(i['recipients'])
            i['x_message'] = f"{i['data'] or ''}"
            i['timestamp'] = self.unix_to_time_ms(i['timestamp'])
            i['type'] = 'Sent' if i['key_from_me'] else 'Inbox'
            i['raw_data'] = self.encode_raw_data(i)
            data_obj = self.get_javaobj(i)
            if hasattr(data_obj, 'file') and hasattr(data_obj.file, 'path'):
                i['file_path'] = data_obj.file.path
            if hasattr(data_obj, 'fileSize') and data_obj.fileSize:
                i['file_size'] = utils.human_bytes(data_obj.fileSize)
            i['chat'] = self.chats.get(i['key_remote_jid'], self.key_jid(i))
            self.DATA.append(i)
github den4uk / andriller / andriller / windows.py View on Github external
def check_dir(self):
        self.crypts.clear()
        self.file_box.delete(*self.file_box.get_children())
        path_ = os.path.join(self.work_dir, '*.crypt*')
        for f in glob.iglob(path_):
            done = os.path.exists(f'{os.path.splitext(f)[0]}{self.SUFFIX}')
            size = human_bytes(os.path.getsize(f))
            item = self.file_box.insert('', tk.END, text=os.path.basename(f), values=[size, done])
            self.crypts[item] = f
github den4uk / andriller / andriller / decoders.py View on Github external
def main(self):
        self.process_ab()
        args = (self.tar_file, self.work_dir)
        for member in self.tools.extract_tar_members(*args, match=self.match):
            if not member.isfile() or not member.size:
                continue
            i = {}
            p = pathlib.PurePosixPath(member.path)
            i['full_path'] = p
            i['directory'] = p.parents[0]
            i['fname'] = p.name
            i['size'] = utils.human_bytes(member.size)
            i['mtime'] = self.unix_to_time(member.mtime)
            self.DATA.append(i)
github den4uk / andriller / andriller / decoders.py View on Github external
def main(self):
        table = 'downloads'
        kw = {'order_by': 'lastmod'}
        for i in self.sql_table_as_dict(table, **kw):
            i['total_size'] = utils.human_bytes(i['total_bytes'])
            i['status'] = self.http_status(i['status'])
            i['lastmod'] = self.unix_to_time_ms(i['lastmod'])
            self.DATA.append(i)