Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@threaded
@log_errors
def decode_file(self, decoder):
choose_file = self.get_file(decoder.TARGET)
if choose_file and os.path.isfile(choose_file):
file_path = os.path.realpath(choose_file)
logger.info(f'Decoding: {os.path.basename(file_path)}')
work_dir = self.OUTPUT.get() or os.path.split(file_path)[0]
dec = decoder.__class__(work_dir, file_path)
html_rep = dec.report_html()
report = work_dir / pathlib.Path(html_rep)
webbrowser.open_new_tab(report.as_uri())
dec.report_xlsx()
@threaded
def RunAbExtraction(self, event):
with disable_control(event):
output_dir = self.OUTPUT.get()
if not output_dir:
messages.select_output()
elif os.path.exists(output_dir):
ab_file = self.get_file('', ftype=[('AB File', '*.ab')])
if ab_file and os.path.isfile(ab_file):
self.StatusMsg.set('Running...')
drill = driller.ChainExecution(
output_dir,
backup=ab_file,
status_msg=self.StatusMsg,
logger=logger)
drill.CreateWorkDir()
drill.DataExtraction()
@utils.threaded
def upgrade_package(self, package=__package_name__, logger=logger):
from .adb_conn import ADBConn
cmd = f'{sys.executable} -m pip install {package} -U'
for line in ADBConn.cmditer(cmd):
logger.info(line)
@threaded
def ab_to_tar(self):
ab_file = self.get_file('', ftype=[('AB File', '*.ab')])
if ab_file:
logger.info(f'Converting {ab_file}')
self.StatusMsg.set('Converting to tar...')
tar_ = DrillerTools.ab_to_tar(ab_file, to_tmp=False)
logger.info(f'Converted to: {tar_}')
self.StatusMsg.set('Finished')
@threaded
def RunUsbExtraction(self, event):
with disable_control(event):
output_dir = self.OUTPUT.get()
if not output_dir:
messages.select_output()
elif self.DeviceStatus.get().endswith('!'):
messages.device_not_detected()
return
elif os.path.exists(output_dir):
self.StatusMsg.set('Running...')
drill = driller.ChainExecution(
output_dir,
status_msg=self.StatusMsg,
do_shared=self.extract_shared.get(),
use_adb=True,
logger=logger)
@threaded
def set_output(self):
choose_dir = self.get_dir(path='default_path')
if choose_dir and os.path.isdir(choose_dir):
self.OUTPUT.set(os.path.realpath(choose_dir))
@utils.threaded
def check_latest_version(self, logger=logger):
url = f'https://pypi.org/pypi/{__package_name__}/json'
with suppress(Exception):
response = requests.get(url)
if response.ok and response.headers.get('Content-Type') == 'application/json':
latest = max(response.json()['releases'])
logger.debug(f'Fetched latest version from PYPI: {latest}')
if utils.totupe(__version__) < utils.totupe(latest):
logger.warning(f' ** Update available: {latest} **')
self.update_available = True
@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())
@threaded
def check_usb(self, event):
with disable_control(event):
self.DeviceStatus.set('Please wait...')
if not self.adb.adb_bin:
self.DeviceStatus.set('ADB is not configured!')
return
self.adb('start-server')
serial, status = self.adb.device()
if status == 'offline':
self.DeviceStatus.set('Device is OFFLINE!')
elif status == 'unauthorized':
self.DeviceStatus.set('Device is UNAUTHORIZED!')
else:
self.DeviceStatus.set(f'Serial ID: {serial}' if serial else 'Device not detected!')
@threaded
def start(self, **kwargs):
self.result_field.configure(foreground='grey')
try:
self.menubar.entryconfig(0, state=tk.DISABLED)
self.start_button.configure(state=tk.DISABLED)
self.stop_button.configure(state=tk.NORMAL)
self.close_button.configure(state=tk.DISABLED)
crack = cracking.PasswordCrack(
self.HASH.get(), self.SALT.get(),
start=self.START.get(), end=self.END.get(),
update_rate=int(self.conf('update_rate')), **kwargs)
result = crack.crack_password(
self.RESULT,
self.STOP,
self.TRIED if self.stats_enabled else None,
self.RATE if self.stats_enabled else None,