Пример #1
0
            try:

                # create directory or extract file

                if file.isFolder():
                    os.makedirs(winpath, exist_ok=True)

                else:
                    with open(winpath, 'wb') as f:
                        f.write(file.getContent())

                # apply lxattrb

                os.chmod(winpath, 0o777)

                attrb = lxattrb.fromsfs(file).generate()
                ntfsea.writeattr(path_trans(winpath), 'lxattrb', attrb)

            except Exception as err:
                clear_progress()
                print('%s[!]%s Failed to extract %s: %s' %
                      (Fore.YELLOW, Fore.RESET, name, err))
                pass

    finally:
        img.close()
        clear_progress()
        show_cursor()

else:
			try:

				# create directory or extract file

				if file.isFolder():
					os.makedirs(winpath, exist_ok = True)

				else:
					with open(winpath, 'wb') as f:
						f.write(file.getContent())

				# apply lxattrb

				os.chmod(winpath, 0o777)

				attrb = lxattrb.fromsfs(file).generate()
				ntfsea.writeattr(path_trans(winpath), 'lxattrb', attrb)

			except Exception as err:
				clear_progress()
				print('%s[!]%s Failed to extract %s: %s' % (Fore.YELLOW, Fore.RESET, name, err))
				pass

	finally:
		img.close()
		clear_progress()
		show_cursor()

else:

	# the TarFile class has a list of supported compression methods, but this is stored