Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_prog(self, obj, n, total):
if obj:
done_ = n / total * 100
rem_ = utils.human_time((total - n) // self.rate)
obj.set(f'{done_:,.2f} % \t{rem_} reamining')
def get_hash(key: str) -> bytes:
if not key or not utils.is_hex(key) or not (len(key) in [40, 72]):
raise PasswordCrackError('Must enter HASH value.')
return binascii.unhexlify(key[:40])
def main(self):
self.populate_parts()
artefacts_of_interest = ['Text', 'title', 'url', 'thumbnail', 'alt_text',
'FileName', 'Title', 'URL', 'ThumbnailURL', 'ActionBody', 'Image']
table = 'messages'
kw = {'where': {'!token': 1}, 'order_by': 'msg_date'}
for i in self.sql_table_as_dict(table, **kw):
i['sender'] = self.get_part(i)
i['x_sender'] = f"{i['sender'].get('number','')} ({i['sender'].get('name','')})"
i['recipients'] = self.get_convo(i)
i['x_recipients'] = '\n'.join(f"{r.get('number','')} ({r.get('name','')})" for r in i['recipients'])
i['msg_info'] = json.loads(i['msg_info'])
if i['msg_info']:
i['media'] = utils.get_koi(i['msg_info'], artefacts_of_interest)
i['send_type'] = 'Outgoing' if i['send_type'] else 'Incoming'
i['msg_date'] = self.unix_to_time_ms(i['msg_date'])
self.DATA.append(i)